Search⌘ K
AI Features

Baseline Accuracy and Machine Learning Model Selection

Explore how to calculate baseline accuracy and compare logistic regression with KNN models for classification tasks. Learn to train, evaluate, and select the best model based on accuracy and practical considerations for improved prediction in business datasets.

If we think about two situations where our model blindly predicts either of the classes in the target column for all data points, our preferred model will be the one that predicts the most frequently occurring class. This would be the baseline model. Under such circumstances, let’s determine the baseline accuracy score for the given dataset.

Python 3.8
# we can use normalize=True for this purpose
print(df.target.value_counts(normalize=True))

So, if the model always predicts the benign class, ...