SGDClassifierWrapper Class
SGD Classifier Wrapper Class.
Wrapper around SGD Classifier to support predict probabilities on loss functions other than log loss and modified huber loss. This breaks partial_fit on loss functions other than log and modified_huber since the calibrated model does not support partial_fit.
Read more at: http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html.
Initialize SGD Classifier Wrapper Model.
Constructor
SGDClassifierWrapper(random_state=None, n_jobs=1, **kwargs)
Parameters
Name | Description |
---|---|
random_state
|
int or
<xref:np.random.RandomState>
RandomState instance or None, optional (default=None) If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random. Default value: None
|
n_jobs
|
Number of parallel threads. Default value: 1
|
kwargs
Required
|
Other parameters. |
Methods
fit |
Fit function for SGD Classifier Wrapper Model. |
get_model |
Return SGD Classifier Wrapper Model. Else returns None |
get_params |
Return parameters for SGD Classifier Wrapper Model. |
partial_fit |
Return partial fit result. |
predict |
Prediction function for SGD Classifier Wrapper Model. |
predict_proba |
Prediction class probabilities for X for SGD Classifier Wrapper model. |
set_score_request |
Request metadata passed to the Note that this method is only relevant if
The options for each parameter are:
The default ( New in version 1.3. Note This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a <xref:sklearn.pipeline.Pipeline>. Otherwise it has no effect. |
fit
get_model
Return SGD Classifier Wrapper Model.
Else returns None
get_model()
Returns
Type | Description |
---|---|
Returns the fitted model if fit method has been called. |
get_params
Return parameters for SGD Classifier Wrapper Model.
get_params(deep=True)
Parameters
Name | Description |
---|---|
deep
|
If True, will return the parameters for this estimator and contained subobjects that are estimators. Default value: True
|
Returns
Type | Description |
---|---|
parameters for SGD Classifier Wrapper Model. |
partial_fit
predict
Prediction function for SGD Classifier Wrapper Model.
predict(X)
Parameters
Name | Description |
---|---|
X
Required
|
Input data. |
Returns
Type | Description |
---|---|
Prediction values from SGD Classifier Wrapper model. |
predict_proba
Prediction class probabilities for X for SGD Classifier Wrapper model.
predict_proba(X)
Parameters
Name | Description |
---|---|
X
Required
|
Input data. |
Returns
Type | Description |
---|---|
Prediction probability values from SGD Classifier Wrapper model. |
set_score_request
Request metadata passed to the score
method.
Note that this method is only relevant if
enable_metadata_routing=True
(see <xref:sklearn.set_config>).
Please see User Guide on how the routing
mechanism works.
The options for each parameter are:
True
: metadata is requested, and passed toscore
if provided. The request is ignored if metadata is not provided.False
: metadata is not requested and the meta-estimator will not pass it toscore
.None
: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str
: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (sklearn.utils.metadata_routing.UNCHANGED
) retains the
existing request. This allows you to change the request for some
parameters and not others.
New in version 1.3.
Note
This method is only relevant if this estimator is used as a
sub-estimator of a meta-estimator, e.g. used inside a
<xref:sklearn.pipeline.Pipeline>. Otherwise it has no effect.
set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') -> SGDClassifierWrapper
Parameters
Name | Description |
---|---|
sample_weight
Required
|
Metadata routing for |
Keyword-Only Parameters
Name | Description |
---|---|
sample_weight
|
Default value: $UNCHANGED$
|
Returns
Type | Description |
---|---|
self – The updated object. |