Knowledge Graph — Coursera NotesAcademic disciplinesInformation Technology / Computer ScienceMachine Learning

Model evaluation

concept · part of Machine Learning

TensorFlow's evaluate method simplifies evaluation. PyTorch requires manual computation of accuracy. Both frameworks achieve around 70% test accuracy on CIFAR-10 after 10 epochs.

Test accuracy is calculated to measure how well the model predicts diabetes for unseen patients, achieving approximately 75% accuracy.

After fine-tuning, the Trainer's predict method generates predictions on the test set. Accuracy and weighted F1 score are computed using sklearn.metrics.accuracy_score and f1_score with average='weighted'.

predictions = trainer.predict(test_dataset)
preds = predictions.predictions.argmax(-1)
labels = test_dataset['label']
accuracy = accuracy_score(labels, preds)
f1 = f1_score(labels, preds, average='weighted')

The test set must be distinct from the validation set: the validation set is used during fine-tuning for hyperparameter tuning and monitoring, while the test set is used only after fine-tuning for final evaluation to obtain an unbiased measure of generalization.

For balanced datasets use accuracy. For imbalanced use precision, recall, F1, or ROC-AUC. When false positives costly use precision and specificity. When false negatives costly use recall. When both matter use F1.

Inside Model evaluation (4)

This is the text view of an interactive 3D knowledge graph — open this page with JavaScript enabled to explore it visually.

🧠 Knowledge Graph

Select a node

The owner's editing tools — shown here so you can see how the graph is grown, but read-only.

Click a bubble to drill in · click again to collapse · drag to move around