'Constructs a new model with `build_fn` & fit the model to `(x, y)`.
# Arguments
x : array-like, shape `(n_samples, n_features)`
Training samples where n_samples in the number of samples
and n_features is the number of features.
y : array-like, shape `(n_samples,)` or `(n_samples, n_outputs)`
True labels for X.
**kwargs: dictionary arguments
Legal arguments are the arguments of `Sequential.fit`
# Returns
history : object
details about the training history at each epoch.
# Raises
ValueError: In case of invalid shape for `y` argument.'

def fit(self, x, y, **kwargs):

    y = np.array(y)
    if ((len(y.shape) == 2) and (y.shape[1] > 1)):
        self.classes_ = np.arange(y.shape[1])
    elif (((len(y.shape) == 2) and (y.shape[1] == 1)) or (len(y.shape) == 1)):
        self.classes_ = np.unique(y)
        y = np.searchsorted(self.classes_, y)
    else:
        raise ValueError(('Invalid    shape    for    y:    ' + str(y.shape)))
    self.n_classes_ = len(self.classes_)
    return super(KerasClassifier, self).fit(x, y, **kwargs)
