'Perform classification on test vectors X.
Parameters
X : {array-like, sparse matrix}, shape = [n_samples, n_features]
Input vectors, where n_samples is the number of samples
and n_features is the number of features.
Returns
y : array, shape = [n_samples] or [n_samples, n_outputs]
Predicted target values for X.'

def predict(self, X):

    check_is_fitted(self, 'classes_')
    X = check_array(X, accept_sparse=['csr', 'csc', 'coo'], force_all_finite=False)
    n_samples = int(X.shape[0])
    rs = check_random_state(self.random_state)
    n_classes_ = self.n_classes_
    classes_ = self.classes_
    class_prior_ = self.class_prior_
    constant = self.constant
    if (self.n_outputs_ == 1):
        n_classes_ = [n_classes_]
        classes_ = [classes_]
        class_prior_ = [class_prior_]
        constant = [constant]
    if (self.strategy == 'stratified'):
        proba = self.predict_proba(X)
        if (self.n_outputs_ == 1):
            proba = [proba]
    if self.sparse_output_:
        class_prob = None
        if (self.strategy in ('most_frequent', 'prior')):
            classes_ = [np.array([cp.argmax()]) for cp in class_prior_]
        elif (self.strategy == 'stratified'):
            class_prob = class_prior_
        elif (self.strategy == 'uniform'):
            raise ValueError('Sparse    target    prediction    is    not    supported    with    the    uniform    strategy')
        elif (self.strategy == 'constant'):
            classes_ = [np.array([c]) for c in constant]
        y = random_choice_csc(n_samples, classes_, class_prob, self.random_state)
    else:
        if (self.strategy in ('most_frequent', 'prior')):
            y = np.tile([classes_[k][class_prior_[k].argmax()] for k in range(self.n_outputs_)], [n_samples, 1])
        elif (self.strategy == 'stratified'):
            y = np.vstack((classes_[k][proba[k].argmax(axis=1)] for k in range(self.n_outputs_))).T
        elif (self.strategy == 'uniform'):
            ret = [classes_[k][rs.randint(n_classes_[k], size=n_samples)] for k in range(self.n_outputs_)]
            y = np.vstack(ret).T
        elif (self.strategy == 'constant'):
            y = np.tile(self.constant, (n_samples, 1))
        if ((self.n_outputs_ == 1) and (not self.output_2d_)):
            y = np.ravel(y)
    return y
