## Train and use PCA [sklearn.decomposition.PCA](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html#sklearn.decomposition.PCA)
> Linear dimensionality reduction using Singular Value Decomposition of the data to project it to a lower dimensional space. The input data is centered but not scaled for each feature before applying the SVD.
>
> It uses the LAPACK implementation of the full SVD or a randomized truncated SVD by the method of Halko et al. 2009, depending on the shape of the input data and the number of components to extract.
>
> It can also use the scipy.sparse.linalg ARPACK implementation of the truncated SVD.
>
> Notice that this class does not support sparse input. See TruncatedSVD for an alternative with sparse data.
Attributes
> **explained_variance_** : ndarray of shape (n_components,)
> The amount of variance explained by each of the selected components. The variance estimation uses n_samples - 1 degrees of freedom.
>
> Equal to n_components largest eigenvalues of the covariance matrix of X.
> **singular_values_** : ndarray of shape (n_components,)
> The singular values corresponding to each of the selected components. The singular values are equal to the 2-norms of the n_components variables in the lower-dimensional space.
Methods:
```python
fit(X, y=None)
```
> **X** : array-like of shape (n_samples, n_features)
>
> Training data, where n_samples is the number of samples and n_features is the number of features.
```python
transform(X)
```
> Apply dimensionality reduction to X.
>
> X is projected on the first principal components previously extracted from a training set.
> **X** : array-like of shape (n_samples, n_features)
>
> New data, where n_samples is the number of samples and n_features is the number of features.
We rotate the red cloud back. This creates the black cloud. This fits nicely with the original data (blue cloud).
**Be aware that the sign of an individual axis can switch!!!**
## Use PCA to transform the un-rotated data ([inverse_transform(X)](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html#sklearn.decomposition.PCA.inverse_transform))
```python
inverse_transform(X)
```
> Transform data back to its original space.
>
> In other words, return an input X_original whose transform would be X.
> **X** : array-like of shape (n_samples, n_components)
>
> New data, where n_samples is the number of samples and n_components is the number of components.