The following are several strategies used by the dummy classifier to predict the class label.
- Most common: The classifier always predicts the most common class label in the training data.
- Stratified: generates predictions, respecting the distribution of classes over the training data. It differs from the "most frequent" strategy in that it instead associates the probability that each data point is the most frequent class label.
- Uniform: It generates predictions evenly at random.
- Constant: the classifier always predicts the constant label and is mainly used when classifying non-majority class labels.
Now let’s see the implementation of the dummy classifiers using the sklearn library —
Step 1: Import the required libraries
|
Step 2: Read the dataset
|
Step 3: Train the mock model
|
Step 4: Analyze Our Results
|
Step 5: Train the KNN model
|
Comparing the scores of the KNN classifier with the fictitious classifier, we conclude that the KNN classifier is actually a good classifier for data.