Ejemplo n.º 1
0
        tstdata.newSequence()
    tstdata.appendLinked(BallRollPlateJoint[i,:], [4])
for i in range(6000,8000):
    if i%100==0:
        tstdata.newSequence()
    tstdata.appendLinked(RopewayJoint[i,:], [5])

trndata._convertToOneOfMany()
tstdata._convertToOneOfMany()    
print 'Loaded Dataset!'

#####################
#####################
     
print 'Building Network'
vanillaRNN = RecurrentNetwork()
vanillaRNN.addInputModule(LinearLayer(trndata.indim, name='in'))
vanillaRNN.addModule(SigmoidLayer(44, name='hidden'))
vanillaRNN.addOutputModule(LinearLayer(trndata.outdim, name='out'))
vanillaRNN.addModule(BiasUnit(name='bias'))
vanillaRNN.addConnection(FullConnection(vanillaRNN['in'], vanillaRNN['hidden'], name='c1'))
vanillaRNN.addConnection(FullConnection(vanillaRNN['hidden'], vanillaRNN['out'], name='c2'))
vanillaRNN.addConnection(FullConnection(vanillaRNN['bias'], vanillaRNN['hidden'], name='biasConn'))
vanillaRNN.addRecurrentConnection(FullConnection(vanillaRNN['hidden'], vanillaRNN['hidden'], name='c3'))
vanillaRNN.sortModules()

print "Total Weights:",vanillaRNN.paramdim
trainer = RPropMinusTrainer(vanillaRNN, dataset=trndata, verbose=True, weightdecay=0.01)
    
tstErrorCount=0
oldtstError=0
Ejemplo n.º 2
0
        tstdata.newSequence()
    tstdata.appendLinked(LRopeway[i,:], [6])
for i in range(12000,16000):
    if i%200==0:
        tstdata.newSequence()
    tstdata.appendLinked(RRopeway[i,:], [7])

trndata._convertToOneOfMany()
tstdata._convertToOneOfMany()    
print 'Loaded Dataset!'

#####################
#####################
     
print 'Building Network'
LSTMClassificationNet = RecurrentNetwork()
LSTMClassificationNet.addInputModule(LinearLayer(trndata.indim, name='in'))
LSTMClassificationNet.addModule(LSTMLayer(11, name='hidden0'))
LSTMClassificationNet.addModule(LSTMLayer(11, name='hidden1'))
LSTMClassificationNet.addOutputModule(LinearLayer(trndata.outdim, name='out'))
LSTMClassificationNet.addModule(BiasUnit(name='bias0'))
LSTMClassificationNet.addModule(BiasUnit(name='bias1'))

LSTMClassificationNet.addConnection(FullConnection(LSTMClassificationNet['in'], LSTMClassificationNet['hidden0'], name='in-to-h0'))
LSTMClassificationNet.addConnection(FullConnection(LSTMClassificationNet['in'], LSTMClassificationNet['hidden1'], name='in-to-h1'))

LSTMClassificationNet.addConnection(FullConnection(LSTMClassificationNet['hidden0'], LSTMClassificationNet['hidden1'], name='h0-to-h1'))
LSTMClassificationNet.addConnection(FullConnection(LSTMClassificationNet['hidden1'], LSTMClassificationNet['out'], name='h1-to-out'))

LSTMClassificationNet.addConnection(FullConnection(LSTMClassificationNet['bias0'], LSTMClassificationNet['hidden0'], name='bias0-to-h0'))
LSTMClassificationNet.addConnection(FullConnection(LSTMClassificationNet['bias1'], LSTMClassificationNet['hidden1'], name='bias1-to-h1'))
Ejemplo n.º 3
0
        tstdata.newSequence()
    tstdata.appendLinked(BallRollPlateJoint[i, :], [4])
for i in range(6000, 8000):
    if i % 200 == 0:
        tstdata.newSequence()
    tstdata.appendLinked(RopewayJoint[i, :], [5])

trndata._convertToOneOfMany()
tstdata._convertToOneOfMany()
print "Loaded Dataset!"

#####################
#####################

print "Building Network"
vanillaRNN = RecurrentNetwork()
vanillaRNN.addInputModule(LinearLayer(trndata.indim, name="in"))
vanillaRNN.addModule(SigmoidLayer(44, name="hidden"))
vanillaRNN.addOutputModule(LinearLayer(trndata.outdim, name="out"))
vanillaRNN.addModule(BiasUnit(name="bias"))
vanillaRNN.addConnection(FullConnection(vanillaRNN["in"], vanillaRNN["hidden"], name="c1"))
vanillaRNN.addConnection(FullConnection(vanillaRNN["hidden"], vanillaRNN["out"], name="c2"))
vanillaRNN.addConnection(FullConnection(vanillaRNN["bias"], vanillaRNN["hidden"], name="biasConn"))
vanillaRNN.addRecurrentConnection(FullConnection(vanillaRNN["hidden"], vanillaRNN["hidden"], name="c3"))
vanillaRNN.sortModules()

print "Total Weights:", vanillaRNN.paramdim
trainer = RPropMinusTrainer(vanillaRNN, dataset=trndata, verbose=True, weightdecay=0.01)

tstErrorCount = 0
oldtstError = 0