KordingLab / Neural_Decoding

A python package that includes many methods for decoding neural activity
BSD 3-Clause "New" or "Revised" License
429 stars 119 forks source link

Error when running my_RNN_classifier.fit in central_concepts_in_ML_for_decoding.ipynb #14

Closed esedaghatnejad closed 3 years ago

esedaghatnejad commented 3 years ago

When I tried to run my_RNN_classifier.fit(training_data, training_decisions) from the "Neural decoding.ipynb" I got an error. Running the "Neural decoding solutions.ipynb" gives the same error.


TypeError Traceback (most recent call last)

in () 1 # now we fit to our training data, like before ----> 2 my_RNN_classifier.fit(training_data, training_decisions) 5 frames /usr/local/lib/python3.7/dist-packages/Neural_Decoding/decoders.py in fit(self, X_train, y_train) 1305 1306 #### MAKE RELU ACTIVATION BELOW LIKE IN REGRESSION????? #### -> 1307 model.add(SimpleRNN(self.units,input_shape=(X_train.shape[1],X_train.shape[2]),dropout_W=self.dropout,dropout_U=self.dropout)) #Within recurrent layer, include dropout 1308 if self.dropout!=0: model.add(Dropout(self.dropout)) #Dropout some units (recurrent layer output units) 1309 /usr/local/lib/python3.7/dist-packages/keras/layers/recurrent.py in __init__(self, units, activation, use_bias, kernel_initializer, recurrent_initializer, bias_initializer, kernel_regularizer, recurrent_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, recurrent_constraint, bias_constraint, dropout, recurrent_dropout, return_sequences, return_state, go_backwards, stateful, unroll, **kwargs) 1571 stateful=stateful, 1572 unroll=unroll, -> 1573 **kwargs) 1574 self.activity_regularizer = regularizers.get(activity_regularizer) 1575 self.input_spec = [InputSpec(ndim=3)] /usr/local/lib/python3.7/dist-packages/keras/layers/recurrent.py in __init__(self, cell, return_sequences, return_state, go_backwards, stateful, unroll, time_major, **kwargs) 408 kwargs['input_shape'] = input_shape 409 --> 410 super(RNN, self).__init__(**kwargs) 411 self.cell = cell 412 self.return_sequences = return_sequences /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs) 528 self._self_setattr_tracking = False # pylint: disable=protected-access 529 try: --> 530 result = method(self, *args, **kwargs) 531 finally: 532 self._self_setattr_tracking = previous_value # pylint: disable=protected-access /usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py in __init__(self, trainable, name, dtype, dynamic, **kwargs) 321 } 322 # Validate optional keyword arguments. --> 323 generic_utils.validate_kwargs(kwargs, allowed_kwargs) 324 325 # Mutable properties /usr/local/lib/python3.7/dist-packages/keras/utils/generic_utils.py in validate_kwargs(kwargs, allowed_kwargs, error_message) 1141 for kwarg in kwargs: 1142 if kwarg not in allowed_kwargs: -> 1143 raise TypeError(error_message, kwarg) 1144 1145 **TypeError: ('Keyword argument not understood:', 'dropout_W')**
jglaser2 commented 3 years ago

Sorry for this error. I now realize that the version that is automatically downloaded using pip install is an old version. We will try to fix this shortly. In the meantime, you can download the package manually instead of using pip (see "Installation" section of the ReadMe).

esedaghatnejad commented 3 years ago

Now that we are on the topic, please add axis=0 to the np.roll inputs. For all instances of np.roll inside get_test_train_splits. Thanks. https://github.com/KordingLab/Neural_Decoding/blob/71a3c9ba2161cb1d8642bcefb96e8f29ccab7366/central_concepts_in_ML_for_decoding.ipynb#L494

jglaser2 commented 3 years ago

@aribenjamin has updated the pip version and has added axis=0 to np.roll().