MFA#

class MFA(groups=None, normalize=True, n_components=2, n_iter=2, copy=True, check_input=True, random_state=None, engine='auto')[source]#

Bases: PCA

Multiple Factor Analysis: a PCA of groups of features, each normalized by its first singular value.

Parameters:
  • groups (dict, default=None) – Name -> list of columns of each group.

  • normalize (bool, default=True) – Whether to standardize the numerical groups.

  • n_components – See PCA.

  • n_iter – See PCA.

  • copy – See PCA.

  • check_input – See PCA.

  • random_state – See PCA.

  • engine – See PCA.

fit(X, y=None)[source]#

Fit the MFA.

Parameters:
  • X (array-like of shape (n_samples, n_features))

  • y (None) – Not used.

Returns:

self

Return type:

MFA

transform(X)[source]#

Returns the row principal coordinates of a dataset.

fit_transform(X)[source]#

Fit the MFA and return the row principal coordinates.

Parameters:

X (array-like of shape (n_samples, n_features))

Returns:

coordinates

Return type:

numpy.ndarray of shape (n_samples, n_components)

column_correlation(X, same_input=True)[source]#

Correlation between the original columns and the principal components.

Parameters:
  • X (array-like of shape (n_samples, n_features))

  • same_input (bool, default=True) – Whether X is the training data.

Returns:

correlation

Return type:

pandas.DataFrame