W3cubDocs

/scikit-learn

is_regressor

sklearn.base.is_regressor(estimator)[source]

Return True if the given estimator is (probably) a regressor.

Parameters:
estimatorestimator instance

Estimator object to test.

Returns:
outbool

True if estimator is a regressor and False otherwise.

Examples

>>> from sklearn.base import is_regressor
>>> from sklearn.cluster import KMeans
>>> from sklearn.svm import SVC, SVR
>>> classifier = SVC()
>>> regressor = SVR()
>>> kmeans = KMeans()
>>> is_regressor(classifier)
False
>>> is_regressor(regressor)
True
>>> is_regressor(kmeans)
False

© 2007–2025 The scikit-learn developers
Licensed under the 3-clause BSD License.
https://scikit-learn.org/1.6/modules/generated/sklearn.base.is_regressor.html