'Predict class or regression value for X.
For a classification model, the predicted class for each sample in X is
returned. For a regression model, the predicted value based on X is
returned.
Parameters
X : array-like or sparse matrix of shape = [n_samples, n_features]
The input samples. Internally, it will be converted to
``dtype=np.float32`` and if a sparse matrix is provided
to a sparse ``csr_matrix``.
check_input : boolean, (default=True)
Allow to bypass several input checking.
Don\'t use this parameter unless you know what you do.
Returns
y : array of shape = [n_samples] or [n_samples, n_outputs]
The predicted classes, or the predict values.'

def predict(self, X, check_input=True):

    check_is_fitted(self, 'tree_')
    X = self._validate_X_predict(X, check_input)
    proba = self.tree_.predict(X)
    n_samples = X.shape[0]
    if is_classifier(self):
        if (self.n_outputs_ == 1):
            return self.classes_.take(np.argmax(proba, axis=1), axis=0)
        else:
            predictions = np.zeros((n_samples, self.n_outputs_))
            for k in range(self.n_outputs_):
                predictions[:, k] = self.classes_[k].take(np.argmax(proba[:, k], axis=1), axis=0)
            return predictions
    elif (self.n_outputs_ == 1):
        return proba[:, 0]
    else:
        return proba[:, :, 0]
