Dummy Estimators and Handling Imbalance Class Problem
Explore how dummy estimators provide baseline models for classification tasks and understand the impact of imbalanced datasets on model performance. Learn techniques such as oversampling, undersampling, and cost-sensitive learning to effectively address class imbalance problems in machine learning.
We'll cover the following...
Dummy estimators
Dummy estimators help us to define a baseline model for the problem at hand. We saw them in the case of regression problems, too. In the case of classification, we have the following dummy estimators:
-
stratified: It predicts the random class label by respecting the training set class distribution. -
most_frequent: It always predicts the most common label in the training dataset. -
prior: It predicts the class that maximizes the class prior. -
uniform: It generates the predictions uniformly at random. -
constant: It always predicts the constant label provided by the user.
prior always predicts the class that maximizes the class prior (like most_frequent) and predict_proba returns the class prior.
- On lines 1–2, we load the necessary modules.
- On line 3, we load the iris dataset.
- On line 4, we split the iris dataset into training and test datasets. Note that train_size=0.7 indicates that 70% of the rows are included in the training dataset and 30% in the test dataset.
- On line 9