Scikit-Learn
16
In this chapter, we will learn about
Estimator API
(application programming interface).
Let us begin by understanding what is an Estimator API.
What is Estimator API?
It is one of the main APIs implemented by Scikit-learn. It provides a consistent interface
for a wide range of ML applications that’s why all machine learning algorithms in Scikit-
Learn are implemented via Estimator API. The object that learns from the data (fitting the
data) is an estimator. It can be used with any of the
algorithms like classification,
regression, clustering or even with a transformer, that extracts useful features from raw
data.
For fitting the data, all estimator objects expose a fit method that takes a dataset shown
as follows:
estimator.fit(data)
Next, all the parameters of an estimator can be set, as follows, when it is instantiated by
the corresponding attribute.
estimator = Estimator (param1=1, param2=2)
estimator.param1
The output of the above would be 1.
Once data is fitted with an estimator, parameters are estimated from the data at hand.
Now, all the estimated parameters will be the attributes of the estimator object
ending by
an underscore as follows:
estimator.estimated_param_
Dostları ilə paylaş: