watex.utils.evalModel#
- watex.utils.evalModel(model, X, y, Xt, yt=None, scorer='accuracy', eval=False, **kws)[source]#
Evaluate model and quick test the score with metric scorers.
- Parameters:
model (Callable, {'preprocessor + estimator } | estimator,) – the preprocessor is list of step for data handling all encapsulated on the pipeline. model can also be a simple estimator with fit,
X (N-d array, shape (N, M)) –
- the training set composed of N-columns and the M-samples. The
feature set excludes the target y.
y (arraylike , shape (M)) – the target is composed of M-examples in supervised learning.
Xt (N-d array, shape (N, M)) – test set array composed of N-columns and the M-samples. The feature set excludes the target y.
yt (arraylike , shape (M)) – test label (or test target) composed of M-examples in supervised learning.
scorer (str, Callable,) –
a scorer is a metric function for model evaluation. If given as string it should be the prefix of the following metrics:
”classification_report” -> for classification_report,
’precision_recall’ -> for precision_recall_curve,
”confusion_matrix” -> for a confusion_matrix,
’precision’ -> for precision_score,
”accuracy” -> for accuracy_score
”mse” -> for mean_squared_error,
”recall” -> for recall_score,
’auc’ -> for roc_auc_score,
’roc’ -> for roc_curve
’f1’ -> for f1_score,
Other string prefix values should raises an errors
kws (dict,) – Additionnal keywords arguments from scklearn metric function.
- Returns:
Tuple – the model score or the predicted y if predict is set to
True.- Return type:
(score, ypred)