def score(self, X, y=None, **kwargs):
"""
Generates the Scikit-Learn classification_report
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : ndarray or Series of length n
An array or series of target or class values
"""
y_pred = self.predict(X)
keys = ('precision', 'recall', 'f1')
self.scores = precision_recall_fscore_support(y, y_pred)
self.scores = map(lambda s: dict(zip(self.classes_, s)), self.scores[0:3])
self.scores = dict(zip(keys, self.scores))
return self.draw(y, y_pred)
classification_report.py 文件源码
python
阅读 17
收藏 0
点赞 0
评论 0
评论列表
文章目录