score
Transform new data through all transformers in the current branch and
return a metric 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.
Parameters: |
X: dict, list, tuple, np.ndarray or pd.DataFrame
metric: str, func, scorer or None, optional (default=None)
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 Metric score of X with respect to y. |
Note
If the metric
parameter is left to its default value, the method
outputs the same value as sklearn's score method for an estimator.
Info
This method is intended to calculate metric scores on new data. To get the metric results on the train or test set, use the scoring method.
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)