Пример #1
0
if False:
    # simple function optimization
    thetask = SphereFunction(3)
    thenet = ParameterContainer(3)
    
elif True:
    # simple pole-balancing task
    thetask = CartPoleTask(1, markov = True)
    thenet = buildNetwork(thetask.outdim, thetask.indim, bias = False)
    
elif False:
    # hard pole-balancing task
    thetask = CartPoleTask(2, markov = False)
    thenet = buildNetwork(thetask.outdim, 3, thetask.indim)
    thenet.addRecurrentConnection(FullConnection(thenet['hidden0'], thenet['hidden0']))
    thenet.sortModules()
    
elif False:
    # maze-navigation 
    # TODO: noisy task, calls should be averaged!
    thetask = CheeseMaze(maxSteps = 50)
    thenet = buildNetwork(thetask.outdim, 1, thetask.indim)
    
print 'Subsequently, we attempt to solve the following task:'
print thetask

if isinstance(thenet, Network):
    print '\nby finding good weights for this (simple) network:'
    print thenet
    print '\nwhich has', thenet.paramdim, 'trainable parameters. (the dimensions of its layers are:',