# Import required libraries from sklearn.datasets import make_swiss_roll from sklearn.decomposition import KernelPCA # Generate synthetic data X_swiss, t = make_swiss_roll(n_samples=1500, noise=0.3, random_state=2) # Instantiate a KernelPCA object, specifying the kernel type # and the output's dimensions pca_swiss = KernelPCA(n_components=2, kernel='sigmoid', gamma=1e-3, coef0=1, fit_inverse_transform=True) # Transform the original data X_pca_swiss = pca_swiss.fit_transform(X_swiss) # Plot the original vs. reduced data