python - Regression with lasagne: error -


i trying run regression lasagne/nolearn. having trouble finding documentation how (new deep learning in general).

starting off simple network (one hidden layer)

from lasagne import layers  lasagne.nonlinearities import softmax lasagne.updates import nesterov_momentum nolearn.lasagne import neuralnet      print(np.shape(x)) # (137, 43) print(np.shape(y)) # (137,)  layers_s = [('input', layers.inputlayer),            ('dense0', layers.denselayer),            ('output', layers.denselayer)]  net_s = neuralnet(layers=layers_s,                   input_shape=(none, num_features),                  dense0_num_units=43,                  output_num_units=1,                  output_nonlinearity=none,                   regression=true,                   update=nesterov_momentum,                  update_learning_rate=0.001,                  update_momentum=0.9,                   eval_size=0.2,                  verbose=1,                  max_epochs=100)  net_s.fit(x, y) 

i following error:

typeerror                                 traceback (most recent call last) <ipython-input-23-23c15ceec104> in <module>() ----> 1 net_s.fit(x, y)  /home/alex/anaconda3/lib/python3.4/site-packages/nolearn/lasagne.py in fit(self, x, y)     148             out, self.loss, self.update,     149             self.x_tensor_type, --> 150             self.y_tensor_type,     151             )     152         self.train_iter_, self.eval_iter_, self.predict_iter_ = iter_funcs  /home/alex/anaconda3/lib/python3.4/site-packages/nolearn/lasagne.py in _create_iter_funcs(self, output_layer, loss_func, update, input_type, output_type)     298         all_params = get_all_params(output_layer)     299         update_params = self._get_params_for('update') --> 300         updates = update(loss_train, all_params, **update_params)     301      302         train_iter = theano.function(  /home/alex/src/lasagne/lasagne/updates.py in nesterov_momentum(loss, all_params, learning_rate, momentum)      38 # such gradient can evaluated @ current parameters.      39 def nesterov_momentum(loss, all_params, learning_rate, momentum=0.9): ---> 40     all_grads = theano.grad(loss, all_params)      41     updates = []      42   /home/alex/anaconda3/lib/python3.4/site-packages/theano/gradient.py in grad(cost, wrt, consider_constant, disconnected_inputs, add_names, known_grads, return_disconnected)     431      432     if cost not none , cost.ndim != 0: --> 433         raise typeerror("cost must scalar.")     434      435     if isinstance(wrt, set):  typeerror: cost must scalar. 

thanks!..

make sure you're using versions of nolearn , lasagne known work together.

say you've been following using convolutional neural nets detect facial keypoints tutorial. right thing install dependencies this requirements.txt file, so:

pip uninstall lasagne pip uninstall nolearn pip install -r https://raw.githubusercontent.com/dnouri/kfkd-tutorial/master/requirements.txt 

if, however, you're using nolearn git master, make sure install lasagne version that's in requirements.txt file found there:

pip uninstall lasagne pip install -r https://raw.githubusercontent.com/dnouri/nolearn/master/requirements.txt 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -