Missing method NeuralNet.train_split() in lasagne

53 views Asked by At

I am learning to deal with python and lasagne. I have following installed on my pc:

  • python 3.4.3
  • theano 0.9.0
  • lasagne 0.2.dev1

and also six, scipy and numpy. I call net.fit(), and the stacktrace tries to call train_split(X, y, self), which, I guess, should split the samples into training set and validation set (both the inputs X as well as the outputs Y).

But there is no method like train_split(X, y, self) , there is only a float field train_split - I assume, the ratio between training and validation set sizes. Then I get following error:

Traceback (most recent call last):

File "...\workspaces\python\cnn\dl_tutorial\lasagne\Test.py", line 72, in net = net1.fit(X[0:10,:,:,:],y[0:10])

File "...\Python34\lib\site-packages\nolearn\lasagne\base.py", line 544, in fit self.train_loop(X, y, epochs=epochs)

File "...\Python34\lib\site-packages\nolearn\lasagne\base.py", line 554, in train_loop X_train, X_valid, y_train, y_valid = self.train_split(X, y, self)

TypeError: 'float' object is not callable

What could be wrong or missing? Any suggestions? Thank you very much.

1

There are 1 answers

0
fairtrax On

SOLVED

in previous versions, the input parameter train_split has been a number, that was used by the same-named method. In nolearn 0.6.0, it's a callable object, that can implement its own logic to split the data. So instead of providing a float number to the input parameter train_split, I have to provide a callable instance (the default one is TrainSplit), that will be executed in each training epoch.