-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMetrics.py
28 lines (28 loc) · 1.08 KB
/
Metrics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
'''评价标准(基于numpy)
司马懿:“善败能忍,然厚积薄发”
——李叔说的
code is far away from bugs with the god animal protecting
I love animals. They taste delicious.
┏┓ ┏┓
┏┛┻━━━┛┻┓
--┃ ☃ ┃--
┃ ┳┛ ┗┳ ┃
┃ ┻ ┃
┗━┓ ┏━┛
┃ ┗II━II┓
┃ 神兽保佑 ┣┓
┃ 永无BUG! ┏┛
┗┓┓┏━┳┓┏┛
┃┫┫ ┃┫┫
┗┻┛ ┗┻┛
@Belong = 'LogisticRegression' @MadeBy = 'PyCharm'
@Author = 'steven' @DateTime = '2019/4/10 15:47'
'''
import numpy as np
def acc(y_t,y_p):
return np.sum(np.logical_not(np.logical_xor(y_t,y_p)))/np.size(y_t)
def recall(y_t,y_p):
return np.sum(np.logical_and(y_t,y_p))/np.sum(y_t)
def precision(y_t,y_p):
return np.sum(np.logical_and(y_t,y_p)).np.sum(y_p)