shnitsel.core.ml¶
Functions¶
|
xarray-oriented wrapper around scikit-learn's PCA |
|
|
|
|
|
Module Contents¶
- pca(da, dim, n_components=2, return_pca_object=False)¶
xarray-oriented wrapper around scikit-learn’s PCA
- Parameters:
da (xarray.DataArray) – A DataArray with at least a dimension with a name matching dim
dim (str) – The name of the dimension to reduce
n_components (int) – The number of principle components to return, by default 2
optional – The number of principle components to return, by default 2
return_pca_object (bool) – Whether to return the scikit-learn PCA object as well as the transformed data, by default False
optional – Whether to return the scikit-learn PCA object as well as the transformed data, by default False
- Returns:
pca_res – A DataArray with the same dimensions as da, except for the dimension indicated by dim, which is replaced by a dimension PC of size n_components
[pca_object] – The trained PCA object produced by scikit-learn, if return_pca_object=True
- Return type:
tuple[xarray.DataArray, sklearn.decomposition.PCA] | xarray.DataArray
- lda(da, dim, cats, n_components=2)¶
- pls(xda, yda, n_components=2, common_dim=None)¶
- pls_ds(ds, xname, yname, n_components=2)¶