#NEWLINE# def olivetti_glasses( data_set = 'olivetti_glasses' , num_training = 200 , seed = default_seed ) : #NEWLINE# #INDENT# path = os . path . join ( data_path , data_set ) #NEWLINE# if ( not data_available ( data_set ) ) : #NEWLINE# #INDENT# download_data ( data_set ) #NEWLINE# #UNINDENT# y = np . load ( os . path . join ( path , 'has_glasses.np' ) ) #NEWLINE# y = np . where ( ( y == 'y' ) , 1 , 0 ) . reshape ( ( - 1 ) , 1 ) #NEWLINE# faces = scipy . io . loadmat ( os . path . join ( path , 'olivettifaces.mat' ) ) [ 'faces' ] . T #NEWLINE# np . random . seed ( seed = seed ) #NEWLINE# index = np . random . permutation ( faces . shape [ 0 ] ) #NEWLINE# X = faces [ index [ : num_training ] , : ] #NEWLINE# Xtest = faces [ index [ num_training : ] , : ] #NEWLINE# Y = Y [ index [ : num_training ] , : ] #NEWLINE# Ytest = y [ index [ num_training : ] ] #NEWLINE# return data_details_return ( { #NEWLINE# #INDENT# 'X' : X , #NEWLINE# 'Y' : Y , #NEWLINE# 'Xtest' : Xtest , #NEWLINE# 'Ytest' : Ytest , #NEWLINE# 'seed' : seed , #NEWLINE# 'info' : "ORL Faces with labels identifiying who is wearing glasses and who isn't. Data is randomly partitioned according to given seed. Presence or absence of glasses was labelled by James Hensman." , #NEWLINE# #UNINDENT# } , 'olivetti_faces' )