Exemplo n.º 1
0
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
trn_error=[]
tst_error=[]
trn_class_accu=[]
tst_class_accu=[]
        
trnErrorPath='44sigmoid/trn_error'
tstErrorPath='44sigmoid/tst_error'
trnClassErrorPath='44sigmoid/trn_ClassAccu'
Exemplo n.º 2
0
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'))

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


# LSTMClassificationNet = buildNetwork(trndata.indim,20,trndata.outdim, hiddenclass=LSTMLayer, 
#                                      outclass=SoftmaxLayer, bias=True, recurrent=True, outputbias=False) 
print "Total Number of weights:",LSTMClassificationNet.paramdim
trainer = RPropMinusTrainer(LSTMClassificationNet, dataset=trndata, verbose=True, weightdecay=0.01)
    
tstErrorCount=0
oldtstError=0
trn_error=[]
tst_error=[]
trn_class_accu=[]
tst_class_accu=[]
Exemplo n.º 3
0
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
trn_error = []
tst_error = []
trn_class_accu = []
tst_class_accu = []

trnErrorPath = "44sigmoid/trn_error"
tstErrorPath = "44sigmoid/tst_error"
trnClassErrorPath = "44sigmoid/trn_ClassAccu"