예제 #1
0
 def __init__(self, backend, dataset, subj):
     ad = {
         'type': 'adadelta',
         'lr_params': {
             'rho': 0.9,
             'epsilon': 0.000000001
         }
     }
     self.layers = []
     self.add(
         DataLayer(is_local=True,
                   nofm=dataset.nchannels,
                   ofmshape=[1, dataset.nsamples]))
     self.add(
         ConvLayer(nofm=64,
                   fshape=[1, 3],
                   activation=RectLin(),
                   lrule_init=ad))
     self.add(PoolingLayer(op='max', fshape=[1, 2], stride=2))
     if subj != 2:
         self.add(FCLayer(nout=128, activation=RectLin(), lrule_init=ad))
     self.add(
         FCLayer(nout=dataset.nclasses,
                 activation=Logistic(),
                 lrule_init=ad))
     self.add(CostLayer(cost=CrossEntropy()))
     self.model = MLP(num_epochs=1, batch_size=128, layers=self.layers)
     self.dataset = dataset
예제 #2
0
def create_model(nin):
    layers = []
    layers.append(DataLayer(nout=nin))
    layers.append(FCLayer(nout=100, activation=RectLin()))
    layers.append(FCLayer(nout=10, activation=Logistic()))
    layers.append(CostLayer(cost=CrossEntropy()))
    model = MLP(num_epochs=10, batch_size=128, layers=layers)
    return model