Documentation
Classes
OrthogonalMatchingPursuit

OrthogonalMatchingPursuit

Orthogonal Matching Pursuit model (OMP).

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new OrthogonalMatchingPursuit(opts?: object): OrthogonalMatchingPursuit;

Parameters

NameTypeDescription
opts?object-
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.n_nonzero_coefs?numberDesired number of non-zero entries in the solution. If undefined (by default) this value is set to 10% of n_features.
opts.normalize?booleanThis parameter is ignored when fit\_intercept is set to false. If true, the regressors X will be normalized before regression by subtracting the mean and dividing by the l2-norm. If you wish to standardize, please use StandardScaler before calling fit on an estimator with normalize=False. Default Value false
opts.precompute?boolean | "auto"Whether to use a precomputed Gram and Xy matrix to speed up calculations. Improves performance when n_targets or n_samples is very large. Note that if you already have such matrices, you can pass them directly to the fit method. Default Value 'auto'
opts.tol?numberMaximum norm of the residual. If not undefined, overrides n_nonzero_coefs.

Returns

OrthogonalMatchingPursuit

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

Properties

_isDisposed

boolean = false

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

_isInitialized

boolean = false

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

_py

PythonBridge

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:19 (opens in a new tab)

id

string

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:16 (opens in a new tab)

opts

any

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:17 (opens in a new tab)

Accessors

coef_

Parameter vector (w in the formula).

Signature

coef_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:269 (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/OrthogonalMatchingPursuit.ts:404 (opens in a new tab)

intercept_

Independent term in decision function.

Signature

intercept_(): Promise<number | ArrayLike>;

Returns

Promise<number | ArrayLike>

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:296 (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/OrthogonalMatchingPursuit.ts:377 (opens in a new tab)

n_iter_

Number of active features across every target.

Signature

n_iter_(): Promise<number | ArrayLike>;

Returns

Promise<number | ArrayLike>

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:323 (opens in a new tab)

n_nonzero_coefs_

The number of non-zero coefficients in the solution. If n\_nonzero\_coefs is undefined and tol is undefined this value is either set to 10% of n\_features or 1, whichever is greater.

Signature

n_nonzero_coefs_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:350 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:59 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:63 (opens in a new tab)

Methods

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/OrthogonalMatchingPursuit.ts:120 (opens in a new tab)

fit()

Fit the model using X, y as training data.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Training data.
opts.y?ArrayLikeTarget values. Will be cast to X’s dtype if necessary.

Returns

Promise<any>

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:137 (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/OrthogonalMatchingPursuit.ts:72 (opens in a new tab)

predict()

Predict using the linear model.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?anySamples.

Returns

Promise<any>

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:179 (opens in a new tab)

score()

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.

Signature

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

Parameters

NameTypeDescription
optsobject-
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.sample_weight?ArrayLikeSample weights.
opts.y?ArrayLikeTrue values for X.

Returns

Promise<number>

Defined in: generated/linear_model/OrthogonalMatchingPursuit.ts:218 (opens in a new tab)