<s> """<STR_LIT>""" <EOL> import sklearn <EOL> import numpy as np <EOL> import pylab as plt <EOL> from sklearn import manifold , decomposition <EOL> from windml . datasets . nrel import NREL <EOL> K = <NUM_LIT:30> <EOL> ds = NREL ( ) <EOL> windpark = ds . get_windpark ( NREL . park_id [ '<STR_LIT>' ] , <NUM_LIT:10> , <NUM_LIT> ) <EOL> X = np . array ( windpark . get_powermatrix ( ) ) <EOL> X_train = X [ : <NUM_LIT> ] <EOL> X_test = X [ <NUM_LIT> : <NUM_LIT> + <NUM_LIT:200> * <NUM_LIT:4> ] <EOL> print "<STR_LIT>" <EOL> if ( sklearn . __version__ == "<STR_LIT>" ) : <EOL> X_latent = manifold . Isomap ( K , out_dim = <NUM_LIT:2> ) . fit_transform ( X_train ) <EOL> else : <EOL> X_latent = manifold . Isomap ( K , n_components = <NUM_LIT:2> ) . fit_transform ( X_train ) <EOL> sequence = [ ] <EOL> for x in X_test : <EOL> win = <NUM_LIT:0> <EOL> smallest = <NUM_LIT> <EOL> for b in xrange ( len ( X_train ) ) : <EOL> if np . dot ( x - X_train [ b ] , x - X_train [ b ] ) < smallest : <EOL> smallest = np . dot ( x - X_train [ b ] , x - X_train [ b ] ) <EOL> win = b <EOL> sequence . append ( X_latent [ win ] ) <EOL> sequence = np . array ( sequence ) <EOL> sequence [ : , <NUM_LIT:0> ] = ( sequence [ : , <NUM_LIT:0> ] - sequence [ : , <NUM_LIT:0> ] . min ( ) ) / abs ( sequence [ : , <NUM_LIT:0> ] . max ( ) - sequence [ : , <NUM_LIT:0> ] . min ( ) ) <EOL> sequence [ : , <NUM_LIT:1> ] = ( sequence [ : , <NUM_LIT:1> ] - sequence [ : , <NUM_LIT:1> ] . min ( ) ) / abs ( sequence [ : , <NUM_LIT:1> ] . max ( ) - sequence [ : , <NUM_LIT:1> ] . min ( ) ) <EOL> col = [ [ i , j , <NUM_LIT:0.5> ] for [ i , j ] in sequence ] <EOL> fig = plt . figure ( figsize = ( <NUM_LIT:20> , <NUM_LIT:4> ) ) <EOL> ax = plt . subplot ( <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> for i in range ( <NUM_LIT:0> , <NUM_LIT:200> ) : <EOL> ax . bar ( i , <NUM_LIT:1> , <NUM_LIT:1> , linewidth = <NUM_LIT:0.0> , color = col [ i ] ) <EOL> ax = plt . subplot ( <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:2> ) <EOL> for i in range ( <NUM_LIT:200> , <NUM_LIT> ) : <EOL> ax . bar ( i , <NUM_LIT:1> , <NUM_LIT:1> , linewidth = <NUM_LIT:0.0> , color = col [ i ] ) <EOL> ax = plt . subplot ( <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:3> ) <EOL> for i in range ( <NUM_LIT> , <NUM_LIT> ) : <EOL> ax . bar ( i , <NUM_LIT:1> , <NUM_LIT:1> , linewidth = <NUM_LIT:0.0> , color = col [ i ] ) <EOL> ax = plt . subplot ( <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:4> ) <EOL> for i in range ( <NUM_LIT> , <NUM_LIT> ) : <EOL> ax . bar ( i , <NUM_LIT:1> , <NUM_LIT:1> , linewidth = <NUM_LIT:0.0> , color = col [ i ] ) <EOL> plt . show ( ) </s>
