Esempio n. 1
0
    return ret

vecSize =  100
subjects = [2, 5, 6, 7, 8, 12, 16, 35 ,39]
ds = None
for s in subjects:
    for cycleNum in range(1, 13):
        fileName = '../inputs/Vicon from CMU/subjects/'+str(s)+'/'+str(cycleNum)+'.amc'
        try:
            data = getData(fileName, vecSize)
        except IOError:
            continue
        if ds is None:#initialization
            ds = ClassificationDataSet( len(data), 1 )
        ds.appendLinked(data ,  subjects.index(s))
ds.nClasses = len(subjects)

decay= 0.99995
myWeightdecay = 0.8
initialLearningrate= 0.005
hidden_size = 1000
epochs=1000
splitProportion = 0.5

print 'dataset size', len(ds)
print 'input layer size', len(ds.getSample(0)[0])
tstdata, trndata = ds.splitWithProportion( splitProportion )
trndata._convertToOneOfMany( )
tstdata._convertToOneOfMany( )

print "Number of training patterns: ", len(trndata)
Esempio n. 2
0
            try:
                data = ge.getFeatureVec(fileName)
            except IOError:
                continue
            if ds is None:#initialization
                ds = ClassificationDataSet( len(data), 1 )
            excpectedLens[m]+=1
            ds.appendLinked(data ,  moods.index(mood))
splitProportion = 0.2
decay= 0.99993
myWeightdecay = 0.5
initialLearningrate= 0.01
hidden_size = 200
epochs=1000
momentum=0.15
ds.nClasses = len(moods)
tstdata, trndata = ds.splitWithProportion( splitProportion )
trndata._convertToOneOfMany( )
tstdata._convertToOneOfMany( )
inLayer = LinearLayer(len(trndata.getSample(0)[0]))
hiddenLayer = SigmoidLayer(hidden_size)
outLayer = LinearLayer(len(trndata.getSample(0)[1]))
n = FeedForwardNetwork()
n.addInputModule(inLayer)
n.addModule(hiddenLayer)
b = BiasUnit()
n.addModule(b)
n.addOutputModule(outLayer)
in_to_hidden = FullConnection(inLayer, hiddenLayer)
hidden_to_out = FullConnection(hiddenLayer, outLayer)
b_to_hidden = FullConnection(b, hiddenLayer)
             str(typeNum)+'_'+str(take)+'.skl'
             try:
                 data = ge.getFeatureVec(fileName)
             except IOError:
                 continue
             if ds is None:#initialization
                 ds = ClassificationDataSet( len(data), 1 )
             ds.appendLinked(data ,  couple.index(mood))
 splitProportion = 0.2
 decay= 0.9999
 myWeightdecay = 1#0.75
 initialLearningrate= 0.002
 hidden_size = 75
 epochs=1000
 momentum=0.25
 ds.nClasses = len(couple)
 tstdata, trndata = ds.splitWithProportion( splitProportion )
 trndata._convertToOneOfMany( )
 tstdata._convertToOneOfMany( )
 inLayer = LinearLayer(len(trndata.getSample(0)[0]))
 hiddenLayer = SigmoidLayer(hidden_size)
 outLayer = LinearLayer(len(trndata.getSample(0)[1]))
 n = FeedForwardNetwork()
 n.addInputModule(inLayer)
 n.addModule(hiddenLayer)
 b = BiasUnit()
 n.addModule(b)
 n.addOutputModule(outLayer)
 in_to_hidden = FullConnection(inLayer, hiddenLayer)
 hidden_to_out = FullConnection(hiddenLayer, outLayer)
 b_to_hidden = FullConnection(b, hiddenLayer)