from sklearn.decomposition import PCA from sklearn.datasets import make_swiss_roll # Create synthetic data X, t = make_swiss_roll(n_samples=1000, noise=0.2, random_state=42) # Instantiate a PCA object pca = PCA(n_components=1) # Fit the PCA object on the data pca.fit(X) # Calculate the EVA of each PC eva = pca.explained_variance_ratio_ print(eva)