Open sameh-habboubi opened 8 years ago
It may be easier if you just leave out the number of output units. Can you paste the full error and tracebak?
Thanks for answering Here is the full error:
AssertionError Traceback (most recent call last)
in () 2 clf=Classifier(([Layer("Sigmoid", units=100), 3 Layer("Sigmoid", units=5)]), learning_rate=0.1,n_iter=100) ----> 4 clf.fit(X_train, y_train) c:\users\sameh\scikit-neuralnetwork\sknn\mlp.py in fit(self, X, y, w) 395 396 # Now train based on a problem transformed into regression. --> 397 return super(Classifier, self)._fit(X, yp, w) 398 399 def partial_fit(self, X, y, classes=None): c:\users\sameh\scikit-neuralnetwork\sknn\mlp.py in _fit(self, X, y, w) 211 212 if not self.is_initialized: --> 213 X, y = self._initialize(X, y, w) 214 215 log.info("Training on dataset of {:,} samples with {} total size.".format(data_shape[0], data_size)) c:\users\sameh\scikit-neuralnetwork\sknn\mlp.py in _initialize(self, X, y, w) 36 assert not self.is_initialized,\ 37 "This neural network has already been initialized." ---> 38 self._create_specs(X, y) 39 40 backend.setup() c:\users\sameh\scikit-neuralnetwork\sknn\mlp.py in _create_specs(self, X, y) 63 else: 64 assert y is None or self.layers[-1].units == y.shape[1],\ ---> 65 "Mismatch between dataset size and units in output layer." 66 67 # Then compute the number of units in each layer for initialization. AssertionError: Mismatch between dataset size and units in output layer.
I want to do a NN classification, I have 5 classes, so in the output layer , I have units=5 ibut I am getting this error: Mismatch between dataset size and units in output layer, I reshaped my y_train and applied "Sigmoid" function to the output layer according to the documentation:
y_train shape is : (2115, 5) X_train shape is : (2115, 343) This is the code: