liveBook · Manning

Accuracy

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

Accuracy is the proportion of classification predictions that match the corresponding true labels.

Accuracy measures the share of classification predictions that match their true labels. It gives a direct answer to a practical question: how often is the model correct? section 3.3.1

Use accuracy as a standard measure for balanced binary or multiclass problems, especially when classes have approximately equal sample sizes. For uneven classes, ROC-AUC or average precision may be more suitable. section 4.3

A practical evaluation workflow is:

  • Choose accuracy as the classification evaluation metric. section 4.3
  • Measure it consistently with cross-validation rather than relying on a single split. section 4.1 section 4.3
  • Report the average and standard deviation across folds to reveal both typical performance and variation between samples. section 4.3

Comparing classification models

For the Airbnb NYC price-classification problem, XGBoost produced test accuracy between 79% and 81%, while the Keras model produced 80% to 81%. The similar accuracy did not imply identical operating choices: XGBoost trained in roughly 3–4 seconds, compared with 10–15 seconds for Keras without a Colab GPU. section 3.3.1

y_pred = model.predict(xgb_X_test)
xgb_predictions = [round(value) for value in y_pred]
xgb_accuracy = accuracy_score(test.target, xgb_predictions)
print("Accuracy: %.2f%%" % (xgb_accuracy * 100.0))

Inspect a compact Python pattern that rounds classification predictions, computes accuracy with accuracy_score, and prints the result as a percentage. section 3.3.1

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Defines correctness, demonstrates direct computation, and extends evaluation through cross-validation, but defers imbalanced-class alternatives.
Examples
Uses synthetic classification data, Scikit-learn cross-validation output, and Airbnb NYC price-category predictions.
What it assumes
Assumes labeled classification data and predictions, while introducing metric selection and cross-validation procedures.
What you can do after
Evaluate classification models with accuracy, cross-validation, and percentage-based prediction reports.
How it connects
Connects classification accuracy with cross-validation, pipelines, logistic regression, XGBoost, Keras, ROC-AUC, and average precision.

Also explained in

Compare how 32 books explain accuracy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.