0

I am trying to run a simple auto encoder using nolearn:

import nolearn
from nolearn.dbn import DBN
from sklearn.cross_validation import train_test_split
data=np.load('doc_user_matrix.npy')
print (data.shape) #outputs: (10000,500)

(x_train, x_test, y_train, y_test)=train_test_split(data,data,test_size = 0.33)

hidden_layer=10

ae = DBN([x_train.shape[0], hidden_layer, x_train.shape[0]],
                learn_rates = 0.3,
                learn_rate_decays = 0.9,
                epochs = 10)

ae.fit(x_train, x_train)

For some reason I encounter this error:

ValueError: bad input shape (10000, 500)

Can anyone explain why this error occur, and how to solve it ?

Uri Goren
  • 13,386
  • 6
  • 58
  • 110

1 Answers1

1

Usually the second dimension corresponds to features, while the first to instances. Try:

[x_train.shape[1], hidden_layer, x_train.shape[1]]
Leo
  • 1,213
  • 2
  • 13
  • 26