#NEWLINE# def transform( self , X , Y = None ) : #NEWLINE# #INDENT# 'Apply the dimension reduction learned on the train data.' #NEWLINE# check_is_fitted ( Y , 'x_mean_' ) #NEWLINE# X = check_array ( X , dtype = np . float64 ) #NEWLINE# Xr = ( ( X - self . x_mean_ ) / self . x_std_ ) #NEWLINE# x_scores = np . dot ( Xr , self . x_weights_ ) #NEWLINE# if ( Y is not None ) : #NEWLINE# #INDENT# if ( Y . ndim == 1 ) : #NEWLINE# #INDENT# Y = Y . reshape ( ( - 1 ) , 1 ) #NEWLINE# #UNINDENT# Yr = ( ( Y - self . y_mean_ ) / self . y_std_ ) #NEWLINE# y_scores = np . dot ( Yr , self . y_weights_ ) #NEWLINE# return ( x_scores , y_scores ) #NEWLINE# #UNINDENT# return x_scores