Sklearn Quick Reference
Sklearn Quick Reference
1. This document is to help you as a quick reference for sklearn modules and APIs.
Models
Following is the list of most commonly used ML models:
Category Library module API
DummyRegressor
Baseline model sklearn.dummy
DummyClassifier
Ridge
Ridge regression/Classification sklearn.linear_model
Ridge Classifier
BernoulliNB
Naïve Bayes sklearn.naïve_bayes MultinomialNB
Categorical NB
KneighborsClassifier
Nearest Neighbours sklearn.neighbors
KneighborsRegressor
RadiusNeighborsClassifier
Nearest Neighbours sklearn.neighbors
RadiusNeighborsRegressor
LinearSVC
Support Vector Machines sklearn.svm
LinearSVR
SVC
Support Vector Machines sklearn.svm
SVR
NuSVC
Support Vector Machines sklearn.svm
NuSVR
DecisionTreeRegressor
Decision Trees sklearn.tree
DecisionTreeClassifier
VotingRegressor
Voting models sklearn.ensemble
VotingClassifier
BaggingRegressor
Bagging models sklearn.ensemble
BaggingClassifier
RandomForestRegressor
Random Forest sklearn.ensemble
RandomForestClassifier
AdaBoostRegressor
Adaptive Boosting sklearn.ensemble
AdaBoostClassifier
GradientBoostingRegressor
Gradient Boosting sklearn.ensemble
GradientBoostingClassifier
MLPRegressor
Artificial Neural Networks sklearn.neural_network
MLPClassifier
MultiOutputClassifier
Meta estimators sklearn.multioutput
MultiOutputRegressor
ClassifierChain
Meta estimators sklearn.multioutput
RegressorChain
Metrics
Following is the list of most commonly used ML metrics APIs:
Classification sklearn.metrics.precision_score
Classification sklearn.metrics.recall_score
Classification sklearn.metrics.f1_score
Classification sklearn.metrics.classification_report
Classification sklearn.metrics.confusion_matrix
Classification sklearn.metrics.precision_recall_curve
Classification sklearn.metrics.roc_curve
Classification sklearn.metrics.ConfusionMatrixDisplay
Classification sklearn.metrics.PrecisionRecallDisplay
Classification sklearn.metrics.RocCurveDisplay
Regression sklearn.metrics.explained_variance
Regression sklearn.metrics.r2_score
Regression sklearn.metrics.mean_absolute_error
Regression sklearn.metrics.mean_squared_error
Regression sklearn.metrics.mean_squared_log_error
Regression sklearn.metrics.mean_absolute_percentage_error
Classification sklearn.metrics.hinge_loss
Classification sklearn.metrics.log_loss
Classification sklearn.metrics.balanced_accuracy_score
Classification sklearn.metrics.roc_auc_score
Classification sklearn.metrics.top_k_accuracy_score
Data Preprocessing, feature selection and
model selection
Following is the list of most commonly used data preprocessing, feature selectiona nd model
selection APIs:
Broad
Sub category Library module API
category
Data pre-
Preprocessing sklearn.preprocessing add_dummy_feature
processing
Broad
Sub category Library module API
category
Wrapper
Feature
feature sklearn.feature_selection RFE
Selection
selection
Wrapper
Feature
feature sklearn.feature_selection RFECV
Selection
selection
Wrapper
Feature
feature sklearn.feature_selection SelectFromModel
Selection
selection
Wrapper
Feature
feature sklearn.feature_selection SequentialFeatureSelector
Selection
selection
Model Cross
sklearn.model_selection KFold
Selection validation
Model Cross
sklearn.model_selection LeaveOneOut
Selection validation
Model Cross
sklearn.model_selection ShuffleSplit
Selection validation
Model Cross
sklearn.model_selection cross_val_score
Selection validation
Model Cross
sklearn.model_selection cross_validate
Selection validation
Model Cross
sklearn.model_selection learning_curve
Selection validation
Model Cross
sklearn.model_selection validation_curve
Selection validation
Target Target
sklearn.utils.multiclass type_of_target
identification identification
2. import sklearn
3. Type sklearn. (notice the dot . after module name) and press Ctrl + Space Bar
together. A pop up will show up as in the following image:
as you can see in the above image, a scrollable list of all sub modules is presented.
4. Let's say you want to see APIs in the impute module. Then follow the same procedure as
above, you will see a pop up like following:
5. Now, say you want to know more about SimpleImputer and want to see what it does, its
signature, info on its parameters and possibly some examples, then use ? operator as
following