DocumentationClassesPassiveAggressiveRegressor

Class: PassiveAggressiveRegressor

Passive Aggressive Regressor.

Read more in the User Guide.

Python Reference

Constructors

new PassiveAggressiveRegressor()

new PassiveAggressiveRegressor(opts?): PassiveAggressiveRegressor

Parameters

ParameterTypeDescription
opts?object-
opts.average?number | booleanWhen set to true, computes the averaged SGD weights and stores the result in the coef_ attribute. If set to an int greater than 1, averaging will begin once the total number of samples seen reaches average. So average=10 will begin averaging after seeing 10 samples.
opts.C?numberMaximum step size (regularization). Defaults to 1.0.
opts.early_stopping?booleanWhether to use early stopping to terminate training when validation. score is not improving. If set to true, it will automatically set aside a fraction of training data as validation and terminate training when validation score is not improving by at least tol for n_iter_no_change consecutive epochs.
opts.epsilon?numberIf the difference between the current prediction and the correct label is below this threshold, the model is not updated.
opts.fit_intercept?booleanWhether the intercept should be estimated or not. If false, the data is assumed to be already centered. Defaults to true.
opts.loss?stringThe loss function to be used: epsilon_insensitive: equivalent to PA-I in the reference paper. squared_epsilon_insensitive: equivalent to PA-II in the reference paper.
opts.max_iter?numberThe maximum number of passes over the training data (aka epochs). It only impacts the behavior in the fit method, and not the partial_fit method.
opts.n_iter_no_change?numberNumber of iterations with no improvement to wait before early stopping.
opts.random_state?numberUsed to shuffle the training data, when shuffle is set to true. Pass an int for reproducible output across multiple function calls. See Glossary.
opts.shuffle?booleanWhether or not the training data should be shuffled after each epoch.
opts.tol?numberThe stopping criterion. If it is not undefined, the iterations will stop when (loss > previous_loss - tol).
opts.validation_fraction?numberThe proportion of training data to set aside as validation set for early stopping. Must be between 0 and 1. Only used if early_stopping is true.
opts.verbose?numberThe verbosity level.
opts.warm_start?booleanWhen set to true, reuse the solution of the previous call to fit as initialization, otherwise, just erase the previous solution. See the Glossary. Repeatedly calling fit or partial_fit when warm_start is true can result in a different solution than when calling fit a single time because of the way the data is shuffled.

Returns PassiveAggressiveRegressor

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:23

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/linear_model/PassiveAggressiveRegressor.ts:21
_isInitializedbooleanfalsegenerated/linear_model/PassiveAggressiveRegressor.ts:20
_pyPythonBridgeundefinedgenerated/linear_model/PassiveAggressiveRegressor.ts:19
idstringundefinedgenerated/linear_model/PassiveAggressiveRegressor.ts:16
optsanyundefinedgenerated/linear_model/PassiveAggressiveRegressor.ts:17

Accessors

coef_

Get Signature

get coef_(): Promise<any>

Weights assigned to the features.

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:604


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/PassiveAggressiveRegressor.ts:685


intercept_

Get Signature

get intercept_(): Promise<any>

Constants in decision function.

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:631


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/PassiveAggressiveRegressor.ts:658


n_iter_

Get Signature

get n_iter_(): Promise<number>

The actual number of iterations to reach the stopping criterion.

Returns Promise<number>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:712


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:126


t_

Get Signature

get t_(): Promise<number>

Number of weight updates performed during training. Same as (n_iter_ \* n_samples + 1).

Returns Promise<number>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:739

Methods

densify()

densify(opts): Promise<any>

Convert coefficient matrix to dense array format.

Converts the coef_ member (back) to a numpy.ndarray. This is the default format of coef_ and is required for fitting, so calling this method is only required on models that have previously been sparsified; otherwise, it is a no-op.

Parameters

ParameterType
optsobject

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:201


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/PassiveAggressiveRegressor.ts:182


fit()

fit(opts): Promise<any>

Fit linear model with Passive Aggressive algorithm.

Parameters

ParameterTypeDescription
optsobject-
opts.coef_init?anyThe initial coefficients to warm-start the optimization.
opts.intercept_init?anyThe initial intercept to warm-start the optimization.
opts.X?ArrayLikeTraining data.
opts.y?anyTarget values.

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:231


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

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

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:284


init()

init(py): Promise<void>

Initializes the underlying Python resources.

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

Parameters

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:139


partial_fit()

partial_fit(opts): Promise<any>

Fit linear model with Passive Aggressive algorithm.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLikeSubset of training data.
opts.y?anySubset of target values.

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:320


predict()

predict(opts): Promise<any>

Predict using the linear model.

Parameters

ParameterTypeDescription
optsobject-
opts.X?anyInput data.

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:361


score()

score(opts): Promise<number>

Return the coefficient of determination of the prediction.

The coefficient of determination \(R^2\) is defined as \((1 - \frac{u}{v})\), where \(u\) is the residual sum of squares ((y_true \- y_pred)\*\* 2).sum() and \(v\) is the total sum of squares ((y_true \- y_true.mean()) \*\* 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a \(R^2\) score of 0.0.

Parameters

ParameterTypeDescription
optsobject-
opts.sample_weight?ArrayLikeSample weights.
opts.X?ArrayLike[]Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.
opts.y?ArrayLikeTrue values for X.

Returns Promise<number>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:399


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

ParameterTypeDescription
optsobject-
opts.coef_init?string | booleanMetadata routing for coef_init parameter in fit.
opts.intercept_init?string | booleanMetadata routing for intercept_init parameter in fit.

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:449


set_partial_fit_request()

set_partial_fit_request(opts): Promise<any>

Request metadata passed to the partial_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

ParameterTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample_weight parameter in partial_fit.

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:494


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

ParameterTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample_weight parameter in score.

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:534


sparsify()

sparsify(opts): Promise<any>

Convert coefficient matrix to sparse format.

Converts the coef_ member to a scipy.sparse matrix, which for L1-regularized models can be much more memory- and storage-efficient than the usual numpy.ndarray representation.

The intercept_ member is not converted.

Parameters

ParameterType
optsobject

Returns Promise<any>

Defined in generated/linear_model/PassiveAggressiveRegressor.ts:574