liveBook · Manning

Classification report

As explained in Graph Algorithms for Data Science

A classification report summarizes predictive performance for each class using measures such as precision, recall, and F1 score.

A classification report summarizes predictive performance for each class with measures such as precision, recall, and F1 score. It helps assess whether a machine-learning model predicts classes reliably. section 9.3.6

Generate the report from test labels and model predictions with scikit-learn. Compare class-level results rather than relying only on overall accuracy, especially when class sizes differ. section 9.3.6

Predicting streamer languages

A random forest predicts stream languages from node2vec embeddings. Calling classification_report(y_test, y_pred) produces the report; the test set contains 384 English, 54 French, and 19 Italian examples. The F1 score and weighted F1 score are both 0.91, supporting the hypothesis that shared audiences often connect streams using the same language. section 9.2 section 9.3.6

Pair the report with a confusion matrix to inspect actual-versus-predicted classes and identify which classes are confused. In the language example, errors occur between English and other languages, not between Korean and Portuguese. section 9.3.6

Listing 9.13 Producing the classification report
from sklearn.metrics import classification_report

y_pred = rfc.predict(X_test)
print(classification_report(y_test,y_pred))

Use the executable listing to generate a classification report from test labels and predictions. section 9.3.6

Figure 9.17 Classification report
09-17

Inspect the rendered report produced for the streamer-language classifier. section 9.3.6

How Graph Algorithms for Data Science covers it

How deep it goes
Explains report generation, class imbalance, F1 interpretation, and confusion-matrix follow-up without detailing metric formulas.
Examples
Uses streamer-language prediction and link prediction, including imbalanced language classes and a 92% link-prediction accuracy.
What it assumes
Assumes trained predictions and test labels while introducing report-based evaluation through concrete machine-learning workflows.
What you can do after
Apply it via scikit-learn to evaluate test predictions and diagnose class-specific confusion.
How it connects
Connects classification reports with precision, recall, F1 score, confusion matrices, random forests, node classification, and link prediction.

Also explained in

Compare how 2 books explain classification report →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.