<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> from pybrain . utilities import abstractMethod <EOL> import logging <EOL> class Learner ( object ) : <EOL> """<STR_LIT>""" <EOL> module = None <EOL> def learn ( self ) : <EOL> """<STR_LIT>""" <EOL> abstractMethod ( ) <EOL> class ExploringLearner ( Learner ) : <EOL> """<STR_LIT>""" <EOL> explorer = None <EOL> def explore ( self , state , action ) : <EOL> if self . explorer is not None : <EOL> return self . explorer . activate ( state , action ) <EOL> else : <EOL> return action <EOL> class EpisodicLearner ( Learner ) : <EOL> """<STR_LIT>""" <EOL> def learnEpisodes ( self , episodes = <NUM_LIT:1> , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> for _ in range ( episodes ) : <EOL> self . learn ( * args , ** kwargs ) <EOL> def newEpisode ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . explorer is not None : <EOL> self . explorer . newEpisode ( ) <EOL> def reset ( self ) : <EOL> pass <EOL> class DataSetLearner ( EpisodicLearner ) : <EOL> """<STR_LIT>""" <EOL> dataset = None <EOL> def learnOnDataset ( self , dataset , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> self . dataset = dataset <EOL> self . learnEpisodes ( * args , ** kwargs ) </s>
