<s> __author__ = '<STR_LIT>' <EOL> from pybrain . datasets import SequentialDataSet <EOL> from pybrain . supervised . trainers import RPropMinusTrainer <EOL> from Classifier import * <EOL> from . . utils . UNeuralNet import * <EOL> class Recurrent ( Classifier ) : <EOL> def __init__ ( self , neurons_per_layer = [ <NUM_LIT:9> ] ) : <EOL> Classifier . __init__ ( self ) <EOL> self . neurons_per_layer = neurons_per_layer <EOL> def build_neural_net ( self ) : <EOL> input_number , output_number = self . meta_data <EOL> self . neural_net = UNeuralNet . get_neural_net ( input_number , output_number , <EOL> RecurrentNetwork , LSTMLayer , self . neurons_per_layer ) <EOL> def get_new_data_set ( self ) : <EOL> input_number , output_number = self . meta_data <EOL> return SequentialDataSet ( input_number , output_number ) <EOL> def get_new_trainer ( self , data_set ) : <EOL> if not self . neural_net : <EOL> self . build_neural_net ( ) <EOL> return RPropMinusTrainer ( self . neural_net , dataset = data_set ) <EOL> def get_predictions ( self , input_values ) : <EOL> predictions = np . zeros ( len ( self . LABELS ) ) <EOL> for values in input_values : <EOL> prediction = self . neural_net . activate ( values ) <EOL> predictions = [ sum ( x ) for x in zip ( predictions , prediction ) ] <EOL> return UMath . normalize_array ( predictions ) <EOL> def get_name ( self ) : <EOL> return "<STR_LIT>" </s>
