<s> """<STR_LIT>""" <EOL> from itertools import cycle <EOL> import pylab as pl <EOL> from sklearn . datasets import load_iris <EOL> from sklearn . decomposition import PCA <EOL> def plot_2D ( data , target , target_names ) : <EOL> colors = cycle ( '<STR_LIT>' ) <EOL> target_ids = range ( len ( target_names ) ) <EOL> pl . figure ( ) <EOL> for i , c , label in zip ( target_ids , colors , target_names ) : <EOL> pl . plot ( data [ target == i , <NUM_LIT:0> ] , <EOL> data [ target == i , <NUM_LIT:1> ] , '<STR_LIT:o>' , <EOL> c = c , label = label ) <EOL> pl . legend ( target_names ) <EOL> iris = load_iris ( ) <EOL> X , y = iris . data , iris . target <EOL> pca = PCA ( n_components = <NUM_LIT:2> , whiten = True ) . fit ( X ) <EOL> X_pca = pca . transform ( X ) <EOL> plot_2D ( X_pca , iris . target , iris . target_names ) <EOL> from sklearn . cluster import KMeans <EOL> from numpy . random import RandomState <EOL> rng = RandomState ( <NUM_LIT> ) <EOL> kmeans = KMeans ( <NUM_LIT:3> , random_state = rng ) . fit ( X_pca ) <EOL> plot_2D ( X_pca , kmeans . labels_ , [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> pl . show ( ) </s>
