Documentation
Classes
RidgeClassifierCV

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.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new RidgeClassifierCV(opts?: object): RidgeClassifierCV;

Parameters

NameTypeDescription
opts?object-
opts.alphas?ArrayLikeArray 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.
opts.class_weight?anyWeights 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?numberDetermines the cross-validation splitting strategy. Possible inputs for cv are:
opts.fit_intercept?booleanWhether 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). Default Value true
opts.scoring?stringA string (see model evaluation documentation) or a scorer callable object / function with signature scorer(estimator, X, y).
opts.store_cv_values?booleanFlag 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). Default Value false

Returns

RidgeClassifierCV

Defined in: generated/linear_model/RidgeClassifierCV.ts:27 (opens in a new tab)

Methods

decision_function()

Predict confidence scores for samples.

The confidence score for a sample is proportional to the signed distance of that sample to the hyperplane.

Signature

decision_function(opts: object): Promise<ArrayLike>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe data matrix for which we want to get the confidence scores.

Returns

Promise<ArrayLike>

Defined in: generated/linear_model/RidgeClassifierCV.ts:148 (opens in a new tab)

dispose()

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/linear_model/RidgeClassifierCV.ts:129 (opens in a new tab)

fit()

Fit Ridge classifier with cv.

Signature

fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
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.sample_weight?number | ArrayLikeIndividual weights for each sample. If given a float, every sample will have the same weight.
opts.y?ArrayLikeTarget values. Will be cast to X’s dtype if necessary.

Returns

Promise<any>

Defined in: generated/linear_model/RidgeClassifierCV.ts:186 (opens in a new tab)

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Signature

get_metadata_routing(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.routing?anyA MetadataRequest encapsulating routing information.

Returns

Promise<any>

Defined in: generated/linear_model/RidgeClassifierCV.ts:237 (opens in a new tab)

init()

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/linear_model/RidgeClassifierCV.ts:81 (opens in a new tab)

predict()

Predict class labels for samples in X.

Signature

predict(opts: object): Promise<ArrayLike>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]The data matrix for which we want to predict the targets.

Returns

Promise<ArrayLike>

Defined in: generated/linear_model/RidgeClassifierCV.ts:275 (opens in a new tab)

score()

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.

Signature

score(opts: object): Promise<number>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Test samples.
opts.sample_weight?ArrayLikeSample weights.
opts.y?ArrayLikeTrue labels for X.

Returns

Promise<number>

Defined in: generated/linear_model/RidgeClassifierCV.ts:312 (opens in a new tab)

set_fit_request()

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:

Signature

set_fit_request(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample\_weight parameter in fit.

Returns

Promise<any>

Defined in: generated/linear_model/RidgeClassifierCV.ts:365 (opens in a new tab)

set_score_request()

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:

Signature

set_score_request(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample\_weight parameter in score.

Returns

Promise<any>

Defined in: generated/linear_model/RidgeClassifierCV.ts:407 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/linear_model/RidgeClassifierCV.ts:25 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/linear_model/RidgeClassifierCV.ts:24 (opens in a new tab)

_py

PythonBridge

Defined in: generated/linear_model/RidgeClassifierCV.ts:23 (opens in a new tab)

id

string

Defined in: generated/linear_model/RidgeClassifierCV.ts:20 (opens in a new tab)

opts

any

Defined in: generated/linear_model/RidgeClassifierCV.ts:21 (opens in a new tab)

Accessors

alpha_

Estimated regularization parameter.

Signature

alpha_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/RidgeClassifierCV.ts:528 (opens in a new tab)

best_score_

Score of base estimator with best alpha.

Signature

best_score_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/RidgeClassifierCV.ts:555 (opens in a new tab)

coef_

Coefficient of the features in the decision function.

coef\_ is of shape (1, n_features) when the given problem is binary.

Signature

coef_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/linear_model/RidgeClassifierCV.ts:474 (opens in a new tab)

cv_values_

Cross-validation values for each alpha (only if store\_cv\_values=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.

Signature

cv_values_(): Promise<ArrayLike[][]>;

Returns

Promise<ArrayLike[][]>

Defined in: generated/linear_model/RidgeClassifierCV.ts:445 (opens in a new tab)

feature_names_in_

Names of features seen during fit. Defined only when X has feature names that are all strings.

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/linear_model/RidgeClassifierCV.ts:609 (opens in a new tab)

intercept_

Independent term in decision function. Set to 0.0 if fit\_intercept \= False.

Signature

intercept_(): Promise<number | ArrayLike>;

Returns

Promise<number | ArrayLike>

Defined in: generated/linear_model/RidgeClassifierCV.ts:501 (opens in a new tab)

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/RidgeClassifierCV.ts:582 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/linear_model/RidgeClassifierCV.ts:68 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/linear_model/RidgeClassifierCV.ts:72 (opens in a new tab)