This is the class and function reference of scikit-learn. Please refer to the full user guide <user_guide>
for further details, as the class and function raw specifications may not be enough to give full guidelines on their uses. For reference on concepts repeated across the API, see glossary
.
sklearn.base
sklearn
base.BaseEstimator base.BiclusterMixin base.ClassifierMixin base.ClusterMixin base.DensityMixin base.RegressorMixin base.TransformerMixin
sklearn
base.clone base.is_classifier base.is_regressor config_context get_config set_config show_versions
sklearn.calibration
User guide: See the calibration
section for further details.
sklearn
calibration.CalibratedClassifierCV
calibration.calibration_curve
sklearn.cluster
User guide: See the clustering
section for further details.
sklearn
cluster.AffinityPropagation cluster.AgglomerativeClustering cluster.Birch cluster.DBSCAN cluster.FeatureAgglomeration cluster.KMeans cluster.MiniBatchKMeans cluster.MeanShift cluster.OPTICS cluster.SpectralClustering
cluster.affinity_propagation cluster.cluster_optics_dbscan cluster.cluster_optics_xi cluster.compute_optics_graph cluster.dbscan cluster.estimate_bandwidth cluster.k_means cluster.mean_shift cluster.spectral_clustering cluster.ward_tree
sklearn.cluster.bicluster
User guide: See the biclustering
section for further details.
sklearn.cluster.bicluster
SpectralBiclustering SpectralCoclustering
sklearn.compose
User guide: See the combining_estimators
section for further details.
sklearn
compose.ColumnTransformer compose.TransformedTargetRegressor
compose.make_column_transformer
sklearn.covariance
User guide: See the covariance
section for further details.
sklearn
covariance.EmpiricalCovariance covariance.EllipticEnvelope covariance.GraphicalLasso covariance.GraphicalLassoCV covariance.LedoitWolf covariance.MinCovDet covariance.OAS covariance.ShrunkCovariance
covariance.empirical_covariance covariance.graphical_lasso covariance.ledoit_wolf covariance.oas covariance.shrunk_covariance
sklearn.cross_decomposition
User guide: See the cross_decomposition
section for further details.
sklearn
cross_decomposition.CCA cross_decomposition.PLSCanonical cross_decomposition.PLSRegression cross_decomposition.PLSSVD
sklearn.datasets
User guide: See the datasets
section for further details.
sklearn
datasets.clear_data_home datasets.dump_svmlight_file datasets.fetch_20newsgroups datasets.fetch_20newsgroups_vectorized datasets.fetch_california_housing datasets.fetch_covtype datasets.fetch_kddcup99 datasets.fetch_lfw_pairs datasets.fetch_lfw_people datasets.fetch_olivetti_faces datasets.fetch_openml datasets.fetch_rcv1 datasets.fetch_species_distributions datasets.get_data_home datasets.load_boston datasets.load_breast_cancer datasets.load_diabetes datasets.load_digits datasets.load_files datasets.load_iris datasets.load_linnerud datasets.load_sample_image datasets.load_sample_images datasets.load_svmlight_file datasets.load_svmlight_files datasets.load_wine
sklearn
datasets.make_biclusters datasets.make_blobs datasets.make_checkerboard datasets.make_circles datasets.make_classification datasets.make_friedman1 datasets.make_friedman2 datasets.make_friedman3 datasets.make_gaussian_quantiles datasets.make_hastie_10_2 datasets.make_low_rank_matrix datasets.make_moons datasets.make_multilabel_classification datasets.make_regression datasets.make_s_curve datasets.make_sparse_coded_signal datasets.make_sparse_spd_matrix datasets.make_sparse_uncorrelated datasets.make_spd_matrix datasets.make_swiss_roll
sklearn.decomposition
User guide: See the decompositions
section for further details.
sklearn
decomposition.DictionaryLearning decomposition.FactorAnalysis decomposition.FastICA decomposition.IncrementalPCA decomposition.KernelPCA decomposition.LatentDirichletAllocation decomposition.MiniBatchDictionaryLearning decomposition.MiniBatchSparsePCA decomposition.NMF decomposition.PCA decomposition.SparsePCA decomposition.SparseCoder decomposition.TruncatedSVD
decomposition.dict_learning decomposition.dict_learning_online decomposition.fastica decomposition.non_negative_factorization decomposition.sparse_encode
sklearn.discriminant_analysis
User guide: See the lda_qda
section for further details.
sklearn
discriminant_analysis.LinearDiscriminantAnalysis discriminant_analysis.QuadraticDiscriminantAnalysis
sklearn.dummy
User guide: See the model_evaluation
section for further details.
sklearn
dummy.DummyClassifier dummy.DummyRegressor
sklearn.ensemble
User guide: See the ensemble
section for further details.
sklearn
ensemble.AdaBoostClassifier ensemble.AdaBoostRegressor ensemble.BaggingClassifier ensemble.BaggingRegressor ensemble.ExtraTreesClassifier ensemble.ExtraTreesRegressor ensemble.GradientBoostingClassifier ensemble.GradientBoostingRegressor ensemble.IsolationForest ensemble.RandomForestClassifier ensemble.RandomForestRegressor ensemble.RandomTreesEmbedding ensemble.StackingClassifier ensemble.StackingRegressor ensemble.VotingClassifier ensemble.VotingRegressor ensemble.HistGradientBoostingRegressor ensemble.HistGradientBoostingClassifier
sklearn.exceptions
sklearn
exceptions.ChangedBehaviorWarning exceptions.ConvergenceWarning exceptions.DataConversionWarning exceptions.DataDimensionalityWarning exceptions.EfficiencyWarning exceptions.FitFailedWarning exceptions.NotFittedError exceptions.NonBLASDotWarning exceptions.UndefinedMetricWarning
sklearn.experimental
sklearn
experimental.enable_hist_gradient_boosting experimental.enable_iterative_imputer
sklearn.feature_extraction
User guide: See the feature_extraction
section for further details.
sklearn
feature_extraction.DictVectorizer feature_extraction.FeatureHasher
sklearn.feature_extraction.image
sklearn
feature_extraction.image.extract_patches_2d feature_extraction.image.grid_to_graph feature_extraction.image.img_to_graph feature_extraction.image.reconstruct_from_patches_2d
- template
class.rst
feature_extraction.image.PatchExtractor
sklearn.feature_extraction.text
sklearn
feature_extraction.text.CountVectorizer feature_extraction.text.HashingVectorizer feature_extraction.text.TfidfTransformer feature_extraction.text.TfidfVectorizer
sklearn.feature_selection
User guide: See the feature_selection
section for further details.
sklearn
feature_selection.GenericUnivariateSelect feature_selection.SelectPercentile feature_selection.SelectKBest feature_selection.SelectFpr feature_selection.SelectFdr feature_selection.SelectFromModel feature_selection.SelectFwe feature_selection.RFE feature_selection.RFECV feature_selection.VarianceThreshold
feature_selection.chi2 feature_selection.f_classif feature_selection.f_regression feature_selection.mutual_info_classif feature_selection.mutual_info_regression
sklearn.gaussian_process
User guide: See the gaussian_process
section for further details.
sklearn
gaussian_process.GaussianProcessClassifier gaussian_process.GaussianProcessRegressor
Kernels:
gaussian_process.kernels.CompoundKernel gaussian_process.kernels.ConstantKernel gaussian_process.kernels.DotProduct gaussian_process.kernels.ExpSineSquared gaussian_process.kernels.Exponentiation gaussian_process.kernels.Hyperparameter gaussian_process.kernels.Kernel gaussian_process.kernels.Matern gaussian_process.kernels.PairwiseKernel gaussian_process.kernels.Product gaussian_process.kernels.RBF gaussian_process.kernels.RationalQuadratic gaussian_process.kernels.Sum gaussian_process.kernels.WhiteKernel
sklearn.impute
User guide: See the Impute
section for further details.
sklearn
impute.SimpleImputer impute.IterativeImputer impute.MissingIndicator impute.KNNImputer
sklearn.inspection
sklearn
inspection.partial_dependence inspection.permutation_importance
sklearn
inspection.PartialDependenceDisplay
inspection.plot_partial_dependence
sklearn.isotonic
User guide: See the isotonic
section for further details.
sklearn
isotonic.IsotonicRegression
isotonic.check_increasing isotonic.isotonic_regression
sklearn.kernel_approximation
User guide: See the kernel_approximation
section for further details.
sklearn
kernel_approximation.AdditiveChi2Sampler kernel_approximation.Nystroem kernel_approximation.RBFSampler kernel_approximation.SkewedChi2Sampler
sklearn.kernel_ridge
User guide: See the kernel_ridge
section for further details.
sklearn
kernel_ridge.KernelRidge
sklearn.linear_model
User guide: See the linear_model
section for further details.
The following subsections are only rough guidelines: the same estimator can fall into multiple categories, depending on its parameters.
sklearn
linear_model.LogisticRegression linear_model.LogisticRegressionCV linear_model.PassiveAggressiveClassifier linear_model.Perceptron linear_model.RidgeClassifier linear_model.RidgeClassifierCV linear_model.SGDClassifier
linear_model.LinearRegression linear_model.Ridge linear_model.RidgeCV linear_model.SGDRegressor
The following estimators have built-in variable selection fitting procedures, but any estimator using a L1 or elastic-net penalty also performs variable selection: typically ~linear_model.SGDRegressor
or ~sklearn.linear_model.SGDClassifier
with an appropriate penalty.
linear_model.ElasticNet linear_model.ElasticNetCV linear_model.Lars linear_model.LarsCV linear_model.Lasso linear_model.LassoCV linear_model.LassoLars linear_model.LassoLarsCV linear_model.LassoLarsIC linear_model.OrthogonalMatchingPursuit linear_model.OrthogonalMatchingPursuitCV
linear_model.ARDRegression linear_model.BayesianRidge
These estimators fit multiple regression problems (or tasks) jointly, while inducing sparse coefficients. While the inferred coefficients may differ between the tasks, they are constrained to agree on the features that are selected (non-zero coefficients).
linear_model.MultiTaskElasticNet linear_model.MultiTaskElasticNetCV linear_model.MultiTaskLasso linear_model.MultiTaskLassoCV
Any estimator using the Huber loss would also be robust to outliers, e.g. ~linear_model.SGDRegressor
with loss='huber'
.
linear_model.HuberRegressor linear_model.RANSACRegressor linear_model.TheilSenRegressor
A generalization of linear models that allows for response variables to have error distribution other than a normal distribution is implemented in the following models,
linear_model.PoissonRegressor linear_model.TweedieRegressor linear_model.GammaRegressor
linear_model.PassiveAggressiveRegressor linear_model.enet_path linear_model.lars_path linear_model.lars_path_gram linear_model.lasso_path linear_model.orthogonal_mp linear_model.orthogonal_mp_gram linear_model.ridge_regression
sklearn.manifold
User guide: See the manifold
section for further details.
sklearn
manifold.Isomap manifold.LocallyLinearEmbedding manifold.MDS manifold.SpectralEmbedding manifold.TSNE
manifold.locally_linear_embedding manifold.smacof manifold.spectral_embedding manifold.t_sne.trustworthiness
See the model_evaluation
section and the metrics
section of the user guide for further details.
sklearn.metrics
sklearn
See the scoring_parameter
section of the user guide for further details.
metrics.check_scoring metrics.get_scorer metrics.make_scorer
See the classification_metrics
section of the user guide for further details.
metrics.accuracy_score metrics.auc metrics.average_precision_score metrics.balanced_accuracy_score metrics.brier_score_loss metrics.classification_report metrics.cohen_kappa_score metrics.confusion_matrix metrics.dcg_score metrics.f1_score metrics.fbeta_score metrics.hamming_loss metrics.hinge_loss metrics.jaccard_score metrics.log_loss metrics.matthews_corrcoef metrics.multilabel_confusion_matrix metrics.ndcg_score metrics.precision_recall_curve metrics.precision_recall_fscore_support metrics.precision_score metrics.recall_score metrics.roc_auc_score metrics.roc_curve metrics.zero_one_loss
See the regression_metrics
section of the user guide for further details.
metrics.explained_variance_score metrics.max_error metrics.mean_absolute_error metrics.mean_squared_error metrics.mean_squared_log_error metrics.median_absolute_error metrics.r2_score metrics.mean_poisson_deviance metrics.mean_gamma_deviance metrics.mean_tweedie_deviance
See the multilabel_ranking_metrics
section of the user guide for further details.
metrics.coverage_error metrics.label_ranking_average_precision_score metrics.label_ranking_loss
See the clustering_evaluation
section of the user guide for further details.
sklearn.metrics.cluster
sklearn
metrics.adjusted_mutual_info_score metrics.adjusted_rand_score metrics.calinski_harabasz_score metrics.davies_bouldin_score metrics.completeness_score metrics.cluster.contingency_matrix metrics.fowlkes_mallows_score metrics.homogeneity_completeness_v_measure metrics.homogeneity_score metrics.mutual_info_score metrics.normalized_mutual_info_score metrics.silhouette_score metrics.silhouette_samples metrics.v_measure_score
See the biclustering_evaluation
section of the user guide for further details.
sklearn
metrics.consensus_score
See the metrics
section of the user guide for further details.
sklearn.metrics.pairwise
sklearn
metrics.pairwise.additive_chi2_kernel metrics.pairwise.chi2_kernel metrics.pairwise.cosine_similarity metrics.pairwise.cosine_distances metrics.pairwise.distance_metrics metrics.pairwise.euclidean_distances metrics.pairwise.haversine_distances metrics.pairwise.kernel_metrics metrics.pairwise.laplacian_kernel metrics.pairwise.linear_kernel metrics.pairwise.manhattan_distances metrics.pairwise.nan_euclidean_distances metrics.pairwise.pairwise_kernels metrics.pairwise.polynomial_kernel metrics.pairwise.rbf_kernel metrics.pairwise.sigmoid_kernel metrics.pairwise.paired_euclidean_distances metrics.pairwise.paired_manhattan_distances metrics.pairwise.paired_cosine_distances metrics.pairwise.paired_distances metrics.pairwise_distances metrics.pairwise_distances_argmin metrics.pairwise_distances_argmin_min metrics.pairwise_distances_chunked
See the visualizations
section of the user guide for further details.
sklearn
metrics.plot_roc_curve
metrics.RocCurveDisplay
sklearn.mixture
User guide: See the mixture
section for further details.
sklearn
mixture.BayesianGaussianMixture mixture.GaussianMixture
sklearn.model_selection
User guide: See the cross_validation
, grid_search
and learning_curve
sections for further details.
sklearn
model_selection.GroupKFold model_selection.GroupShuffleSplit model_selection.KFold model_selection.LeaveOneGroupOut model_selection.LeavePGroupsOut model_selection.LeaveOneOut model_selection.LeavePOut model_selection.PredefinedSplit model_selection.RepeatedKFold model_selection.RepeatedStratifiedKFold model_selection.ShuffleSplit model_selection.StratifiedKFold model_selection.StratifiedShuffleSplit model_selection.TimeSeriesSplit
sklearn
model_selection.check_cv model_selection.train_test_split
sklearn
model_selection.GridSearchCV model_selection.ParameterGrid model_selection.ParameterSampler model_selection.RandomizedSearchCV
model_selection.fit_grid_point
sklearn
model_selection.cross_validate model_selection.cross_val_predict model_selection.cross_val_score model_selection.learning_curve model_selection.permutation_test_score model_selection.validation_curve
sklearn.multiclass
User guide: See the multiclass
section for further details.
sklearn
multiclass.OneVsRestClassifier multiclass.OneVsOneClassifier multiclass.OutputCodeClassifier
sklearn.multioutput
User guide: See the multiclass
section for further details.
sklearn
multioutput.ClassifierChain multioutput.MultiOutputRegressor multioutput.MultiOutputClassifier multioutput.RegressorChain
sklearn.naive_bayes
User guide: See the naive_bayes
section for further details.
sklearn
naive_bayes.BernoulliNB naive_bayes.CategoricalNB naive_bayes.ComplementNB naive_bayes.GaussianNB naive_bayes.MultinomialNB
sklearn.neighbors
User guide: See the neighbors
section for further details.
sklearn
neighbors.BallTree neighbors.DistanceMetric neighbors.KDTree neighbors.KernelDensity neighbors.KNeighborsClassifier neighbors.KNeighborsRegressor neighbors.KNeighborsTransformer neighbors.LocalOutlierFactor neighbors.RadiusNeighborsClassifier neighbors.RadiusNeighborsRegressor neighbors.RadiusNeighborsTransformer neighbors.NearestCentroid neighbors.NearestNeighbors neighbors.NeighborhoodComponentsAnalysis
neighbors.kneighbors_graph neighbors.radius_neighbors_graph
sklearn.neural_network
User guide: See the neural_networks_supervised
and neural_networks_unsupervised
sections for further details.
sklearn
neural_network.BernoulliRBM neural_network.MLPClassifier neural_network.MLPRegressor
sklearn.pipeline
sklearn
pipeline.FeatureUnion pipeline.Pipeline
pipeline.make_pipeline pipeline.make_union
sklearn.preprocessing
User guide: See the preprocessing
section for further details.
sklearn
preprocessing.Binarizer preprocessing.FunctionTransformer preprocessing.KBinsDiscretizer preprocessing.KernelCenterer preprocessing.LabelBinarizer preprocessing.LabelEncoder preprocessing.MultiLabelBinarizer preprocessing.MaxAbsScaler preprocessing.MinMaxScaler preprocessing.Normalizer preprocessing.OneHotEncoder preprocessing.OrdinalEncoder preprocessing.PolynomialFeatures preprocessing.PowerTransformer preprocessing.QuantileTransformer preprocessing.RobustScaler preprocessing.StandardScaler
preprocessing.add_dummy_feature preprocessing.binarize preprocessing.label_binarize preprocessing.maxabs_scale preprocessing.minmax_scale preprocessing.normalize preprocessing.quantile_transform preprocessing.robust_scale preprocessing.scale preprocessing.power_transform
sklearn.random_projection
User guide: See the random_projection
section for further details.
sklearn
random_projection.GaussianRandomProjection random_projection.SparseRandomProjection
random_projection.johnson_lindenstrauss_min_dim
sklearn.semi_supervised
User guide: See the semi_supervised
section for further details.
sklearn
semi_supervised.LabelPropagation semi_supervised.LabelSpreading
sklearn.svm
User guide: See the svm
section for further details.
sklearn
svm.LinearSVC svm.LinearSVR svm.NuSVC svm.NuSVR svm.OneClassSVM svm.SVC svm.SVR
svm.l1_min_c
svm.libsvm.cross_validation svm.libsvm.decision_function svm.libsvm.fit svm.libsvm.predict svm.libsvm.predict_proba
sklearn.tree
User guide: See the tree
section for further details.
sklearn
tree.DecisionTreeClassifier tree.DecisionTreeRegressor tree.ExtraTreeClassifier tree.ExtraTreeRegressor
tree.export_graphviz tree.export_text
sklearn
tree.plot_tree
sklearn.utils
Developer guide: See the developers-utils
page for further details.
sklearn
utils.arrayfuncs.cholesky_delete utils.arrayfuncs.min_pos utils.as_float_array utils.assert_all_finite utils.check_X_y utils.check_array utils.check_scalar utils.check_consistent_length utils.check_random_state utils.class_weight.compute_class_weight utils.class_weight.compute_sample_weight utils.deprecated utils.estimator_checks.check_estimator utils.estimator_checks.parametrize_with_checks utils.extmath.safe_sparse_dot utils.extmath.randomized_range_finder utils.extmath.randomized_svd utils.extmath.fast_logdet utils.extmath.density utils.extmath.weighted_mode utils.gen_even_slices utils.graph.single_source_shortest_path_length utils.graph_shortest_path.graph_shortest_path utils.indexable utils.metaestimators.if_delegate_has_method utils.multiclass.type_of_target utils.multiclass.is_multilabel utils.multiclass.unique_labels utils.murmurhash3_32 utils.resample utils._safe_indexing utils.safe_mask utils.safe_sqr utils.shuffle utils.sparsefuncs.incr_mean_variance_axis utils.sparsefuncs.inplace_column_scale utils.sparsefuncs.inplace_row_scale utils.sparsefuncs.inplace_swap_row utils.sparsefuncs.inplace_swap_column utils.sparsefuncs.mean_variance_axis utils.sparsefuncs.inplace_csr_column_scale utils.sparsefuncs_fast.inplace_csr_row_normalize_l1 utils.sparsefuncs_fast.inplace_csr_row_normalize_l2 utils.random.sample_without_replacement utils.validation.check_is_fitted utils.validation.check_memory utils.validation.check_symmetric utils.validation.column_or_1d utils.validation.has_fit_parameter utils.testing.assert_in utils.testing.assert_not_in utils.testing.assert_raise_message utils.testing.all_estimators
Utilities from joblib:
utils.parallel_backend utils.register_parallel_backend
utils.Memory utils.Parallel
utils.cpu_count utils.delayed metrics.calinski_harabaz_score metrics.jaccard_similarity_score linear_model.logistic_regression_path utils.safe_indexing
ensemble.partial_dependence.partial_dependence ensemble.partial_dependence.plot_partial_dependence