class sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis(priors=None, reg_param=0.0, store_covariance=False, tol=0.0001, store_covariances=None)
[source]
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.
New in version 0.17: QuadraticDiscriminantAnalysis
Read more in the User Guide.
Parameters: |
|
---|---|
Attributes: |
|
See also
sklearn.discriminant_analysis.LinearDiscriminantAnalysis
>>> from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis >>> import numpy as np >>> X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]) >>> y = np.array([1, 1, 1, 2, 2, 2]) >>> clf = QuadraticDiscriminantAnalysis() >>> clf.fit(X, y) ... QuadraticDiscriminantAnalysis(priors=None, reg_param=0.0, store_covariance=False, store_covariances=None, tol=0.0001) >>> print(clf.predict([[-0.8, -1]])) [1]
decision_function (X) | Apply decision function to an array of samples. |
fit (X, y) | Fit the model according to the given training data and parameters. |
get_params ([deep]) | Get parameters for this estimator. |
predict (X) | Perform classification on an array of test vectors X. |
predict_log_proba (X) | Return posterior probabilities of classification. |
predict_proba (X) | Return posterior probabilities of classification. |
score (X, y[, sample_weight]) | Returns the mean accuracy on the given test data and labels. |
set_params (**params) | Set the parameters of this estimator. |
__init__(priors=None, reg_param=0.0, store_covariance=False, tol=0.0001, store_covariances=None)
[source]
covariances_
DEPRECATED: Attribute covariances_
was deprecated in version 0.19 and will be removed in 0.21. Use covariance_
instead
decision_function(X)
[source]
Apply decision function to an array of samples.
Parameters: |
|
---|---|
Returns: |
|
fit(X, y)
[source]
Fit the model according to the given training data and parameters.
Changed in version 0.19: store_covariances
has been moved to main constructor as store_covariance
Changed in version 0.19: tol
has been moved to main constructor.
Parameters: |
|
---|
get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: |
|
---|---|
Returns: |
|
predict(X)
[source]
Perform classification on an array of test vectors X.
The predicted class C for each sample in X is returned.
Parameters: |
|
---|---|
Returns: |
|
predict_log_proba(X)
[source]
Return posterior probabilities of classification.
Parameters: |
|
---|---|
Returns: |
|
predict_proba(X)
[source]
Return posterior probabilities of classification.
Parameters: |
|
---|---|
Returns: |
|
score(X, y, sample_weight=None)
[source]
Returns 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: |
|
---|---|
Returns: |
|
set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: |
|
---|
sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis.html