Style fix in sklearn wrapper; improve error message.
@@ -190,6 +190,9 @@ class KerasClassifier(BaseWrapper):
# Returns
history : object
details about the training history at each epoch.
+
+ # Raises
+ ValueError: In case of invalid shape for `y` argument.
"""
y = np.array(y)
if len(y.shape) == 2 and y.shape[1] > 1:
@@ -198,7 +201,7 @@ class KerasClassifier(BaseWrapper):
self.classes_ = np.unique(y)
y = np.searchsorted(self.classes_, y)
else:
- raise ValueError('Invalid shape for y')
+ raise ValueError('Invalid shape for y: ' + str(y.shape))
self.n_classes_ = len(self.classes_)
return super(KerasClassifier, self).fit(x, y, **kwargs)
