Closed urwithajit9 closed 9 years ago
Sorry I forgot to import Dropout layer. The document was fixed now.
You should run this:
import logging, os
logging.basicConfig(level=logging.INFO)
from deepy.dataset import MnistDataset, MiniBatches
from deepy.networks import NeuralClassifier
from deepy.layers import Dense, Softmax, Dropout
from deepy.trainers import MomentumTrainer, LearningRateAnnealer
if __name__ == '__main__':
model = NeuralClassifier(input_dim=28*28)
model.stack(Dense(256, 'relu'),
Dropout(0.2),
Dense(256, 'relu'),
Dropout(0.2),
Dense(10, 'linear'),
Softmax())
trainer = MomentumTrainer(model)
annealer = LearningRateAnnealer(trainer)
mnist = MiniBatches(MnistDataset(), batch_size=20)
trainer.run(mnist, controllers=[annealer])
Or simply
python experiments/mnist/mlp_dropout.py
See https://github.com/uaca/deepy for a full list of experiments
Is there any command to download Dropout?
Hi, I am trying to execute the sample code given as example and by running the below line
model.stack(Dense(256, 'relu'), Dropout(0.2), Dense(256, 'relu'), Dropout(0.2), Dense(10, 'linear'), Softmax())
I am getting error: Traceback (most recent call last): File "", line 1, in
NameError: name 'Dropout' is not defined
Do i am making any mistake? or there is any problem with the library?