ClassifierEvaluator
#
ClassifierEvaluator#
- class sklearn_evaluation.ClassifierEvaluator(estimator=None, y_true=None, y_pred=None, y_score=None, feature_names=None, target_names=None, estimator_name=None, X=None)#
Encapsulates results from an estimator on a testing set to provide a simplified API from other modules. All parameters are optional, just fill the ones you need for your analysis.
- Parameters:
estimator (sklearn estimator) ā Must have a
feature_importances_
attribute.y_true (array-like) ā Target predicted classes (estimator predictions).
y_pred (array-like) ā Correct target values (ground truth).
y_score (array-like) ā Target scores (estimator predictions).
feature_names (array-like) ā Feature names.
target_names (list) ā List containing the names of the target classes
estimator_name (str) ā Identifier for the model. This can be later used to identify the estimator when generating reports.
- confusion_matrix()#
Confusion matrix plot
- property estimator_class#
Estimator class (e.g. sklearn.ensemble.RandomForestClassifier)
- property estimator_type#
Estimator name (e.g. RandomForestClassifier)
- feature_importances()#
Feature importances plot
- feature_importances_table()#
Feature importances table
- html_serializable()#
Returns a EvaluatorHTMLSerializer instance, which is an object with the same methods and properties than a ClassifierEvaluator, but it returns HTML serialized versions of each (i.e. evaluator.feature_importances_table() returns a string with the table in HTML format, evaluator.confusion_matrix() returns a HTML image element with the image content encoded in base64), useful for generating reports using some template system
- make_report(template=None)#
Make HTML report
- Parameters:
template (str, or pathlib.Path, optional) ā HTML or Markdown template with jinja2 format. If a pathlib.Path object is passed, the content of the file is read. Within the template, the evaluator is passed as āeā, so you can use things like {{e.confusion_matrix()}} or any other attribute/method. If None, a default template is used
style (str) ā Path to a css file to apply style to the report. If None, no style will be applied
- Returns:
Returns the contents of the report if path is None.
- Return type:
Report
- precision_at_proportions()#
Precision at proportions plot
- precision_recall()#
Precision-recall plot
- roc()#
ROC plot