Created
April 18, 2017 17:44
-
-
Save Jim-Holmstroem/d3fb39c6a30038cbdeba19c6e1d68699 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.cluster import KMeans | |
from sklearn.datasets import load_digits | |
from sklearn.decomposition import PCA | |
from sklearn.preprocessing import scale | |
digits = load_digits() | |
data = scale(digits.data) | |
n_samples, n_features = data.shape | |
n_digits = len(np.unique(digits.target)) | |
sample_size = 300 | |
pca = PCA(n_components=n_digits).fit(data) | |
output = pca.predict(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment