score
method score(X,
y, sample_weights=None, pipeline=None, verbose=None)
[source]
Transform new data through all transformers in the current branch and
return model's score. If called from a trainer, the best model in
the pipeline (under the winner
attribute) is used. If called from a
model, that model is used. The estimator must have a score
method.
Parameters: |
X: dict, list, tuple, np.ndarray or pd.DataFrame
sample_weights: sequence or None, optional (default=None) Transformers to use on the data before predicting.
verbose: int or None, optional (default=None) |
Returns: |
score: np.float64 Mean accuracy or r2 (depending on the task) of predict(X) with respect to y. |
Example
from atom import ATOMClassifier
atom = ATOMClassifier(X, y)
atom.run(["MNB", "KNN", "kSVM"], metric="precision")
# Get the mean accuracy on new data
predictions = atom.mnb.score(X_new, y_new)