Exemple #1
0
    elif p < 0.9:
        nHidden = threeLayers()
    else:
        nHidden = fourLayers()
    print 'Layers: ', nHidden
    
    pretrainingEpochs=epochs()
    pretrainingLearningRate=learningrate()
    print 'Pretraining epochs: ', pretrainingEpochs
    print 'Pretraining learning rate: ', pretrainingLearningRate

    learningRate=learningrate()
    numberEpochs=epochs()
    print 'Fine tuning epochs: ', numberEpochs
    print 'Fine tuning learning rate: ', learningRate
    
    return HyperparametersDBN(learningRate=learningRate, 
        numberEpochs=numberEpochs,
        pretrainingEpochs=pretrainingEpochs, 
        pretrainingLearningRate=pretrainingLearningRate,
        nHidden=nHidden)
    
if __name__ == '__main__':
    d = dataset.Mnist()
    for i in range(1, 25):
        print "Experiment %d" % i
        logs = DBNClassifier.test_DBN(d, hyper())
        print logs
        print DBNClassifier.interpretObjectives(logs)
        print ""
Exemple #2
0
def hyper():
    p = random.random()
    nHidden = None
    if p < 0.5:
        nHidden = twoLayers()
    elif p < 0.9:
        nHidden = threeLayers()
    else:
        nHidden = fourLayers()
    print 'Layers: ', nHidden
    
    pretrainingEpochs=epochs()
    pretrainingLearningRate=learningrate()
    print 'Pretraining epochs: ', pretrainingEpochs
    print 'Pretraining learning rate: ', pretrainingLearningRate

    learningRate=learningrate()
    numberEpochs=epochs()
    print 'Fine tuning epochs: ', numberEpochs
    print 'Fine tuning learning rate: ', learningRate
    
    return HyperparametersDBN(learningRate=learningRate, 
        numberEpochs=numberEpochs,
        pretrainingEpochs=pretrainingEpochs, 
        pretrainingLearningRate=pretrainingLearningRate,
        nHidden=nHidden)
    
if __name__ == '__main__':
    DBNClassifier.test_DBN(dataset.Mnist(), hyper())

Exemple #3
0
 def getObjectives(self):
     objectives = DBNClassifier.test_DBN(self.data, self.hyper())
     return DBNClassifier.interpretObjectives(objectives)