Class: RidgeClassifierCV
Ridge classifier with built-in cross-validation.
See glossary entry for cross-validation estimator.
By default, it performs Leave-One-Out Cross-Validation. Currently, only the n_features > n_samples case is handled efficiently.
Read more in the User Guide.
Constructors
new RidgeClassifierCV()
new RidgeClassifierCV(
opts
?):RidgeClassifierCV
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.alphas ? | ArrayLike | Array of alpha values to try. Regularization strength; must be a positive float. Regularization improves the conditioning of the problem and reduces the variance of the estimates. Larger values specify stronger regularization. Alpha corresponds to 1 / (2C) in other linear models such as LogisticRegression or LinearSVC . If using Leave-One-Out cross-validation, alphas must be strictly positive. |
opts.class_weight ? | any | Weights associated with classes in the form {class_label: weight} . If not given, all classes are supposed to have weight one. The “balanced” mode uses the values of y to automatically adjust weights inversely proportional to class frequencies in the input data as n_samples / (n_classes \* np.bincount(y)) . |
opts.cv ? | number | Determines the cross-validation splitting strategy. Possible inputs for cv are: |
opts.fit_intercept ? | boolean | Whether to calculate the intercept for this model. If set to false, no intercept will be used in calculations (i.e. data is expected to be centered). |
opts.scoring ? | string | A string (see The scoring parameter: defining model evaluation rules) or a scorer callable object / function with signature scorer(estimator, X, y) . |
opts.store_cv_results ? | boolean | Flag indicating if the cross-validation results corresponding to each alpha should be stored in the cv_results_ attribute (see below). This flag is only compatible with cv=None (i.e. using Leave-One-Out Cross-Validation). |
opts.store_cv_values ? | boolean | Flag indicating if the cross-validation values corresponding to each alpha should be stored in the cv_values_ attribute (see below). This flag is only compatible with cv=None (i.e. using Leave-One-Out Cross-Validation). |
Returns RidgeClassifierCV
Defined in generated/linear_model/RidgeClassifierCV.ts:27
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/linear_model/RidgeClassifierCV.ts:25 |
_isInitialized | boolean | false | generated/linear_model/RidgeClassifierCV.ts:24 |
_py | PythonBridge | undefined | generated/linear_model/RidgeClassifierCV.ts:23 |
id | string | undefined | generated/linear_model/RidgeClassifierCV.ts:20 |
opts | any | undefined | generated/linear_model/RidgeClassifierCV.ts:21 |
Accessors
alpha_
Get Signature
get alpha_():
Promise
<number
>
Estimated regularization parameter.
Returns Promise
<number
>
Defined in generated/linear_model/RidgeClassifierCV.ts:512
best_score_
Get Signature
get best_score_():
Promise
<number
>
Score of base estimator with best alpha.
Returns Promise
<number
>
Defined in generated/linear_model/RidgeClassifierCV.ts:539
coef_
Get Signature
get coef_():
Promise
<ArrayLike
[]>
Coefficient of the features in the decision function.
coef_
is of shape (1, n_features) when the given problem is binary.
Returns Promise
<ArrayLike
[]>
Defined in generated/linear_model/RidgeClassifierCV.ts:458
cv_results_
Get Signature
get cv_results_():
Promise
<ArrayLike
[][]>
Cross-validation results for each alpha (only if store_cv_results=True
and cv=None
). After fit()
has been called, this attribute will contain the mean squared errors if scoring is None
otherwise it will contain standardized per point prediction values.
Returns Promise
<ArrayLike
[][]>
Defined in generated/linear_model/RidgeClassifierCV.ts:429
feature_names_in_
Get Signature
get feature_names_in_():
Promise
<ArrayLike
>
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Returns Promise
<ArrayLike
>
Defined in generated/linear_model/RidgeClassifierCV.ts:593
intercept_
Get Signature
get intercept_():
Promise
<number
|ArrayLike
>
Independent term in decision function. Set to 0.0 if fit_intercept \= False
.
Returns Promise
<number
| ArrayLike
>
Defined in generated/linear_model/RidgeClassifierCV.ts:485
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit.
Returns Promise
<number
>
Defined in generated/linear_model/RidgeClassifierCV.ts:566
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/linear_model/RidgeClassifierCV.ts:73
Methods
decision_function()
decision_function(
opts
):Promise
<ArrayLike
>
Predict confidence scores for samples.
The confidence score for a sample is proportional to the signed distance of that sample to the hyperplane.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike | The data matrix for which we want to get the confidence scores. |
Returns Promise
<ArrayLike
>
Defined in generated/linear_model/RidgeClassifierCV.ts:146
dispose()
dispose():
Promise
<void
>
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Returns Promise
<void
>
Defined in generated/linear_model/RidgeClassifierCV.ts:127
fit()
fit(
opts
):Promise
<any
>
Fit Ridge classifier with cv.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.params ? | any | Parameters to be passed to the underlying scorer. |
opts.sample_weight ? | number | ArrayLike | Individual weights for each sample. If given a float, every sample will have the same weight. |
opts.X ? | ArrayLike [] | Training vectors, where n_samples is the number of samples and n_features is the number of features. When using GCV, will be cast to float64 if necessary. |
opts.y ? | ArrayLike | Target values. Will be cast to X’s dtype if necessary. |
Returns Promise
<any
>
Defined in generated/linear_model/RidgeClassifierCV.ts:182
get_metadata_routing()
get_metadata_routing(
opts
):Promise
<any
>
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.routing ? | any | A MetadataRouter encapsulating routing information. |
Returns Promise
<any
>
Defined in generated/linear_model/RidgeClassifierCV.ts:233
init()
init(
py
):Promise
<void
>
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Parameters
Parameter | Type |
---|---|
py | PythonBridge |
Returns Promise
<void
>
Defined in generated/linear_model/RidgeClassifierCV.ts:86
predict()
predict(
opts
):Promise
<ArrayLike
>
Predict class labels for samples in X
.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike [] | The data matrix for which we want to predict the targets. |
Returns Promise
<ArrayLike
>
Defined in generated/linear_model/RidgeClassifierCV.ts:269
score()
score(
opts
):Promise
<number
>
Return the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | ArrayLike | Sample weights. |
opts.X ? | ArrayLike [] | Test samples. |
opts.y ? | ArrayLike | True labels for X . |
Returns Promise
<number
>
Defined in generated/linear_model/RidgeClassifierCV.ts:305
set_fit_request()
set_fit_request(
opts
):Promise
<any
>
Request metadata passed to the fit
method.
Note that this method is only relevant if enable_metadata_routing=True
(see sklearn.set_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | string | boolean | Metadata routing for sample_weight parameter in fit . |
Returns Promise
<any
>
Defined in generated/linear_model/RidgeClassifierCV.ts:353
set_score_request()
set_score_request(
opts
):Promise
<any
>
Request metadata passed to the score
method.
Note that this method is only relevant if enable_metadata_routing=True
(see sklearn.set_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | string | boolean | Metadata routing for sample_weight parameter in score . |
Returns Promise
<any
>