TSCPrincipalComponent#
- class datafold.dynfold.TSCPrincipalComponent(n_components=None, *, copy=True, whiten=False, svd_solver='auto', tol=0.0, iterated_power='auto', n_oversamples=10, power_iteration_normalizer='auto', random_state=None)[source]#
Bases:
PCA
,TSCTransformerMixin
Compute principal components from data.
This is a subclass of scikit-learn’s
PCA
to generalize the input and output ofpandas.DataFrames
andTSCDataFrame
. All input parameters remain the same. For documentation please visit:Methods Summary
fit
(X[, y])Compute the principal components from training data.
fit_transform
(X[, y])Compute principal components from data and reduce dimension on same data.
get_feature_names_out
([input_features])Get output feature names for transformation.
Map data from the reduced space back to the original space.
transform
(X)Apply dimension reduction by projecting the data on principal components.
Methods Documentation
- fit(X, y=None, **fit_params)[source]#
Compute the principal components from training data.
- Parameters:
X (TSCDataFrame, pandas.DataFrame, numpy.ndarray) – Training data of shape (n_samples, n_features).
y (None) – ignored
- Returns:
self
- Return type:
- fit_transform(X, y=None, **fit_params)[source]#
Compute principal components from data and reduce dimension on same data.
- Parameters:
X (TSCDataFrame, pandas.DataFrame, numpy.ndarray) – Training data of shape (n_samples, n_features).
y (None) – ignored
- Returns:
same type as X of shape (n_samples, n_components_)
- Return type:
- get_feature_names_out(input_features=None)[source]#
Get output feature names for transformation.
The feature names out will prefixed by the lowercased class name. For example, if the transformer outputs 3 features, then the feature names out are: [“class_name0”, “class_name1”, “class_name2”].
- inverse_transform(X)[source]#
Map data from the reduced space back to the original space.
- Parameters:
X (
Union
[TSCDataFrame
,ndarray
]) – Out-of-sample points of shape (n_samples, n_components_) to map back to original space.- Returns:
same type as X of shape (n_samples, n_features)
- Return type:
- transform(X)[source]#
Apply dimension reduction by projecting the data on principal components.
- Parameters:
X (TSCDataFrame, pandas.DataFrame, numpy.ndarray) – Out-of-sample points of shape (n_samples, n_features) to perform dimension reduction on.
- Returns:
same type as X of shape (n_samples, n_components_)
- Return type: