DocumentationClassesQuadraticDiscriminantAnalysis

Class: QuadraticDiscriminantAnalysis

Quadratic Discriminant Analysis.

A classifier with a quadratic decision boundary, generated by fitting class conditional densities to the data and using Bayes’ rule.

The model fits a Gaussian density to each class.

Python Reference

Constructors

new QuadraticDiscriminantAnalysis()

new QuadraticDiscriminantAnalysis(opts?): QuadraticDiscriminantAnalysis

Parameters

ParameterTypeDescription
opts?object-
opts.priors?ArrayLikeClass priors. By default, the class proportions are inferred from the training data.
opts.reg_param?numberRegularizes the per-class covariance estimates by transforming S2 as S2 \= (1 \- reg_param) \* S2 + reg_param \* np.eye(n_features), where S2 corresponds to the scaling_ attribute of a given class.
opts.store_covariance?booleanIf true, the class covariance matrices are explicitly computed and stored in the self.covariance_ attribute.
opts.tol?numberAbsolute threshold for a singular value to be considered significant, used to estimate the rank of Xk where Xk is the centered matrix of samples in class k. This parameter does not affect the predictions. It only controls a warning that is raised when features are considered to be colinear.

Returns QuadraticDiscriminantAnalysis

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:25

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:23
_isInitializedbooleanfalsegenerated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:22
_pyPythonBridgeundefinedgenerated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:21
idstringundefinedgenerated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:18
optsanyundefinedgenerated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:19

Accessors

classes_

Get Signature

get classes_(): Promise<ArrayLike>

Unique class labels.

Returns Promise<ArrayLike>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:579


covariance_

Get Signature

get covariance_(): Promise<any[]>

For each class, gives the covariance matrix estimated using the samples of that class. The estimations are unbiased. Only present if store_covariance is true.

Returns Promise<any[]>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:444


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/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:633


means_

Get Signature

get means_(): Promise<ArrayLike[]>

Class-wise means.

Returns Promise<ArrayLike[]>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:471


n_features_in_

Get Signature

get n_features_in_(): Promise<number>

Number of features seen during fit.

Returns Promise<number>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:606


priors_

Get Signature

get priors_(): Promise<ArrayLike>

Class priors (sum to 1).

Returns Promise<ArrayLike>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:498


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:56


rotations_

Get Signature

get rotations_(): Promise<any[]>

For each class k an array of shape (n_features, n_k), where n_k \= min(n_features, number of elements in class k) It is the rotation of the Gaussian distribution, i.e. its principal axis. It corresponds to V, the matrix of eigenvectors coming from the SVD of Xk \= U S Vt where Xk is the centered matrix of samples from class k.

Returns Promise<any[]>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:525


scalings_

Get Signature

get scalings_(): Promise<any[]>

For each class, contains the scaling of the Gaussian distributions along its principal axes, i.e. the variance in the rotated coordinate system. It corresponds to S^2 / (n_samples \- 1), where S is the diagonal matrix of singular values from the SVD of Xk, where Xk is the centered matrix of samples from class k.

Returns Promise<any[]>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:552

Methods

decision_function()

decision_function(opts): Promise<ArrayLike>

Apply decision function to an array of samples.

The decision function is equal (up to a constant factor) to the log-posterior of the model, i.e. log p(y \= k | x). In a binary classification setting this instead corresponds to the difference log p(y \= 1 | x) \- log p(y \= 0 | x). See Mathematical formulation of the LDA and QDA classifiers.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLike[]Array of samples (test vectors).

Returns Promise<ArrayLike>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:131


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/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:112


fit()

fit(opts): Promise<any>

Fit the model according to the given training data and parameters.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLike[]Training vector, where n_samples is the number of samples and n_features is the number of features.
opts.y?ArrayLikeTarget values (integers).

Returns Promise<any>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:167


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/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:210


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/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:69


predict()

predict(opts): Promise<ArrayLike>

Perform classification on an array of test vectors X.

The predicted class C for each sample in X is returned.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLike[]Vector to be scored, where n_samples is the number of samples and n_features is the number of features.

Returns Promise<ArrayLike>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:248


predict_log_proba()

predict_log_proba(opts): Promise<ArrayLike[]>

Return log of posterior probabilities of classification.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLike[]Array of samples/test vectors.

Returns Promise<ArrayLike[]>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:284


predict_proba()

predict_proba(opts): Promise<ArrayLike[]>

Return posterior probabilities of classification.

Parameters

ParameterTypeDescription
optsobject-
opts.X?ArrayLike[]Array of samples/test vectors.

Returns Promise<ArrayLike[]>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:320


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

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

Returns Promise<number>

Defined in generated/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:358


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/discriminant_analysis/QuadraticDiscriminantAnalysis.ts:408