5

I'm new to Nolearn and Theano in general. When I tried the code in a Nolearn tutorial, I get extremely high error rates of 0.9!

Why am I getting such high errors while the tutorial is getting errors of 0.005? Is anyone else able to reproduce this problem?

Using Theano 0.7.0, Lasagne v0.1, nolearn v0.5 on OS X Yosemite.

Output

[DBN] fitting X.shape=(46900, 784)
[DBN] layers [784, 300, 10]
[DBN] Fine-tune...
100%

Epoch 1:
100%

  loss 2.30829815265
  err  0.901340505464
  (0:00:30)
Epoch 2:
100%

  loss 2.30304712187
  err  0.902813353825
  (0:00:34)
Epoch 3:
100%

  loss 2.30303548692
  err  0.90072148224
  (0:00:34)
Epoch 4:
100%

  loss 2.30297605197
  err  0.902322404372
  (0:00:28)
Epoch 5:
100%

  loss 2.30295462556
  err  0.901191086066
  (0:00:26)
Epoch 6:
100%

  loss 2.30293222366
  err  0.898352117486
  (0:00:33)
Epoch 7:
100%

  loss 2.30283567033
  err  0.901425887978
  (0:00:34)
Epoch 8:
100%

  loss 2.30283342522
  err  0.90059340847
  (0:00:35)
Epoch 9:
100%

  loss 2.30283433199
  err  0.902813353825
  (0:00:33)
Epoch 10:
  loss 2.30279696997
  err  0.897861168033
  (0:00:33)

Code

# import the necessary packages
from sklearn.cross_validation import train_test_split
from sklearn.metrics import classification_report
from sklearn import datasets
from nolearn.dbn import DBN
import numpy as np

# grab the MNIST dataset (if this is the first time you are running
# this script, this make take a minute -- the 55mb MNIST digit dataset
# will be downloaded)
print "[X] downloading data..."
dataset = datasets.fetch_mldata("MNIST Original")

# scale the data to the range [0, 1] and then construct the training
# and testing splits
(trainX, testX, trainY, testY) = train_test_split(
    dataset.data / 255.0, dataset.target.astype("int0"), test_size = 0.33)

# train the Deep Belief Network with 784 input units (the flattened,
# 28x28 grayscale image), 300 hidden units, 10 output units (one for
# each possible output classification, which are the digits 1-10)
dbn = DBN(
    [trainX.shape[1], 300, 10],
    learn_rates = 0.3,
    learn_rate_decays = 0.9,
    epochs = 10,
    verbose = 1)
dbn.fit(trainX, trainY)

Classification report

enter image description here

Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
  • I had the same problem with several different libraries. I resorted to matlab at last. – Saeid Nov 23 '15 at 01:21
  • @sudomakeinstall2 Any idea what the problem was? – Nyxynyx Nov 23 '15 at 01:24
  • Sorry, but no I couldn't find the problem. – Saeid Nov 23 '15 at 01:29
  • I cannot reproduce the problem. I copied and pasted the code provided in the question and ran it without modifications (after installing nolearn via pip). I get good error rate outputs (err = 0.00508025956284 after 10 epochs). Are you sure you've got the latest version of Theano, Lasagne, and nolearn? Maybe try updating to the GitHub versions instead of the pip release versions? – Daniel Renshaw Nov 23 '15 at 08:08
  • 1
    Switched to Keras and life became better :) – Nyxynyx Nov 24 '15 at 03:48

0 Answers0