April 2020
Intermediate to advanced
438 pages
12h 2m
English
Perform the following steps to implement the filters:
dataset = fetch_olivetti_faces(shuffle=True, random_state=rng)original = img_as_float(dataset.data)faces = original.copy()print(faces.shape)# (400, 4096)
image_shape = (64, 64)rng = RandomState(0)n_samples, n_features = faces.shapefaces = random_noise(faces, var=0.005)
n_components = 50 # 256estimator = decomposition.PCA(n_components=n_components, svd_solver='randomized', whiten=True)print("Extracting the top %d PCs..." % (n_components))t0 = time()faces_recons = estimator.inverse_transform(estimator.fit_transform(faces)) ...Read now
Unlock full access