Estimator interface
: It is for building and fitting the models.
Predictor interface
: It is for making predictions.
Transformer interface
: It is for converting data.
The APIs adopt simple conventions and the design choices have been guided in a manner
to avoid the proliferation of framework code.
Purpose of Conventions
The purpose of conventions is to make sure that the API stick to the following broad
principles:
Consistency:
All the objects whether they are basic, or composite must share a consistent
interface which further composed of a limited set of methods.
Inspection:
Constructor parameters and parameters values determined by learning
algorithm should be stored and exposed as public attributes.
Non-proliferation of classes:
Datasets should be represented as NumPy arrays or Scipy
sparse matrix whereas hyper-parameters names and values should be represented as
standard Python strings to avoid the proliferation of framework code.
Composition:
The algorithms whether they are expressible as sequences or combinations
of transformations to the data or naturally viewed as meta-algorithms parameterized on
other algorithms, should be implemented and composed from existing building blocks.
Sensible defaults:
In scikit-learn whenever an operation requires a user-defined
parameter, an appropriate default value is defined. This default value should cause the
operation to be performed in a sensible way, for example, giving a base-line solution for
the task at hand.
Various Conventions
The conventions available in Sklearn are explained below:
Type casting
It states that the input should be cast to
float64
. In the following example, in which
Dostları ilə paylaş: |