<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> from pybrain import FeedForwardNetwork , RecurrentNetwork , LinearLayer , FullConnection <EOL> from pybrain . tests import runModuleTestSuite <EOL> def buildCyclicNetwork ( recurrent ) : <EOL> """<STR_LIT>""" <EOL> Network = RecurrentNetwork if recurrent else FeedForwardNetwork <EOL> N = Network ( '<STR_LIT>' ) <EOL> a = LinearLayer ( <NUM_LIT:1> , name = '<STR_LIT:a>' ) <EOL> b = LinearLayer ( <NUM_LIT:2> , name = '<STR_LIT:b>' ) <EOL> c = LinearLayer ( <NUM_LIT:3> , name = '<STR_LIT:c>' ) <EOL> d = LinearLayer ( <NUM_LIT:4> , name = '<STR_LIT:d>' ) <EOL> N . addInputModule ( a ) <EOL> N . addModule ( b ) <EOL> N . addModule ( d ) <EOL> N . addOutputModule ( c ) <EOL> N . addConnection ( FullConnection ( a , b ) ) <EOL> N . addConnection ( FullConnection ( b , c ) ) <EOL> N . addConnection ( FullConnection ( c , d ) ) <EOL> if recurrent : <EOL> N . addRecurrentConnection ( FullConnection ( d , a ) ) <EOL> else : <EOL> N . addConnection ( FullConnection ( d , a ) ) <EOL> N . sortModules ( ) <EOL> return N <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> runModuleTestSuite ( __import__ ( '<STR_LIT:__main__>' ) ) </s>
