def grade(self, x, bin=5):
#res = np.array([0] * x.shape[-1], dtype=int)
#?????????????????????WOE?????????????<=?WOE??
x_copy = np.copy(x)
#x_copy = x_copy.astype(str)
#x_copy = x_copy.astype(np.str_)
#x_copy = x
x_gt0 = x[x>=0]
for i in range(bin):
point1 = stats.scoreatpercentile(x_gt0, i * (100.0/bin))
point2 = stats.scoreatpercentile(x_gt0, (i + 1) * (100.0/bin))
x1 = x[(x >= point1) & (x <= point2)]
mask = np.in1d(x, x1)
#x_copy[mask] = i + 1
x_copy[mask] = i + 1
#x_copy[mask] = point1
#print x_copy[mask]
#print x
print point1,point2
#print x
return x_copy
information_value.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录