USVM.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:uplift 作者: mustafaseisa 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号