discrimintools.MDA#
- class discrimintools.MDA(n_components=2, priors=None, classes=False)[source]#
-
Mixed Discriminant Analysis (MDA)
Performs a linear discrimination analysis (LDA) on mixed predictors. It’s a classical linear discriminant analysis carried out on the principal factors of a mixed principal component analysis (MPCA) of explanatory variables. Discriminat analysis on mixed predictors consists in two steps:
Computation of mixed principal component analysis (MPCA) on features.
Performns linear discriminant analysis (LDA) on principal components extract in step 1.
- Parameters:
-
n_components (int or None, default = 2) – Number of components to keep. If
None, keep all the components.-
priors (str, 1-D array or Series of shape (n_classes,), default = None) – The priors statement specifies the class prior probabilities of group membership, possibles values:
‘equal’ to set the prior probabilities equal.
‘prop’ to set the prior probabilities proportional to the sample sizes.
1-D array or Series which specify the prior probability for each level of the classification variable.
classes (None, tuple or list, default = None) – Name of level in order to return. If None, classes are sorted in unique values in y.
- Returns:
-
-
call_ (NamedTuple) – Call informations.
-
- XDataFrame of shape (n_samples, n_features)
-
Training data
-
- ySeries of shape (n_samples,)
-
Target values. True values for X.
-
- targetstr
-
Name of target.
-
- featureslist
-
Names of features seen during
fit.
-
- classeslist
-
Names of classes.
-
- priorsSeries of shape (n_classes,)
-
Priors probabilities.
-
- n_samplesint
-
Number of samples.
-
- n_featuresint
-
Number of features.
-
- n_classesint
-
Number of target values.
-
- max_componentsint
-
Maximum number of components.
-
- n_componentsint
-
Number of components kept.
-
-
cancoef_ (NamedTuple) – Canonical coefficients:
-
- standardizedDataFrame of shape (n_variables, n_components)
-
The standardized canonical coefficients
-
- rawDataFrame of shape (n_variables+1, n_componets)
-
The raw canonical coefficients
-
- projectionDataFrame of shape (n_variables+1, n_components)
-
The projection canonical coefficients.
-
-
coef_ (NamedTuple) – Linear discriminant coefficients:
-
- standardizedDataFrame of shape (n_variables, n_classes)
-
The standardized coefficients.
-
- rawDataFrame of shape (n_variables+1, n_classes)
-
The raw coefficients.
-
- projectionDataFrame of shape (n_variables+1, n_classes)
-
The projection coefficients.
-
-
ind_ (NamedTuple) – Individuals informations:
-
- scoresDataFrame of shape (n_samples, n_classes)
-
The scores of individuals.
-
- projectionDataFrame of shape (n_samples, n_classes)
-
The projection of individuals.
-
model_ (str, default = ‘mda’) – The model fitted.
-
pipe_ (a sequence of data transformers with two named_steps :) –
mpca : mixed principal components analysis (MPCA)
lda : linear discriminant analysis (LDA)
-
See also
GFA-
General Factor Analysis (GFA)
GFALDA-
General Factor Analysis Linear Discriminant Analysis (GFALDA)
MPCA-
Mixed Principal Component Analysis (MPCA)
summaryGFA-
Printing summaries of General Factor Analysis model.
summaryGFALDA-
Printing summaries of General Factor Analysis Linear Discriminant Analysis model.
summaryMDA-
Printing summaries of Mixed Discriminant Analysis model.
summaryMPCA-
Printing summaries of Mixed Principal Component Analysis model.
References
[1] Abdesselam, R. (2006), « Mixed principal component analysis ». In M. Nadif & F. X. Jollis (Eds), Actes des XIIIémes Rencontres SFC-2006 (pp. 27-31). Metz, France.
[2] Abdesselam, R. (2010), « Discriminant Analysis on Mixed Predictors ».
Examples
>>> from discrimintools.datasets import load_dataset >>> from discrimintools import MDA >>> D = load_dataset("heart") # load training data >>> y, X = D["disease"], D.drop(columns=["disease"]) # split into X and y >>> clf = MDA(n_components=5) >>> clf.fit(X,y) MDA(n_components=5) ```
Methods
__init__([n_components, priors, classes])decision_function(X)Apply decision function to an input data
eval_predict(X, y[, verbose])Evaluation of the prediction' quality
fit(X, y)Fit the Mixed Discriminant Analysis model
fit_transform(X, y)Fit to data, then transform it
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
pred_table(X, y)Prediction table
predict(X)Predict class labels for samples in X
predict_log_proba(X)Return log of posterior probabilities
predict_proba(X)Estimate probability
score(X, y)Return accuracy on the given input data
set_output(*[, transform])Set output container.
set_params(**params)Set the parameters of this estimator.
transform(X)Project data to maximize class separation