def __recall(self, data, gridSize = 10):
assert self.__optimized == True
assert type(data) == ndarray
assert min(data.shape) > 2
y, X = hsplit(data, [1])
ny = len(y)
assert gridSize < ny
assert unique(y).all() in [-1,0,1]
assert X.shape[1] == self._m
from math import ceil
grid = linspace(0, ny - 1, gridSize, True)
orderedLabels = y[argsort(X.dot(self.w), axis=0).flatten()[::-1]] == 1
proportions = cumsum(orderedLabels)/sum(orderedLabels)
recall = list(map(lambda tick: proportions[ceil(tick)], grid))
recall.insert(0, 0.)
grid = list((grid+1)/ny)
grid.insert(0, 0.)
return (grid, recall)
评论列表
文章目录