AdaCost

AdaCost算法

参考:《AdaCost Misclassification Cost-sensitive Boosting》

代价敏感:错分类的损失很大的样例。比如新冠肺炎本来是阳性但是被检测出阴性。

Cost-sensitive思想是一种符合实际应用的算法思想。在实际算法应用中,每种分类结果的错误分类代价是不一样的。同时,也可以延伸出每种分类结果正确分类的收益也是不一样的,所以基于此,需要对样本权重更新做一些额外的处理。

AdaCost对比AdaBoost

1. 目的

AdaBoost :最后结果偏向于容易错分类的样本

AdaCost :The final voted ensemble will also correctly predict more costly instances.(最后结果偏向于正确分类代价高的样例)

2. 权重更新规则

AdaBoost :At each round, AdaBoost increases the weights of wrongly classifified training instances and decreases those of correctly predicted instances(在每一epoch,AdaBoost增加错误分类的训练样本的权重,同时减少正确预测样本的权重)

AdaCost :In AdaCost, the weight updating rule increases the weights of costly wrong classifications more aggressively, but decreases the weights of costly correct classifications more conservatively(在 AdaCost 中,权重更新规则更激进地增加代价高昂的错误分类的权重,但更保守地降低代价高昂的正确分类的权重。通俗的说,对代价高昂的样本的奖励更少,但是惩罚更多)。

3. 权重初始化规则

AdaCost :代价更高的样本权重初始化一个更大的值

AdaBoost:等权重初始化或者标签数据量少的样本权重更大

AdaCost算法流程

在这里插入图片描述

算法流程中符号的含义:

S:样本空间 D:权重空间 beta:cost更新函数 H(x):生成的假设,预测结果

同时作者给出算法中的权重D更新的一种可替代计算方法:

在这里插入图片描述

详解AdaCost中的beta更新函数

本文章beta更新规则:we require β_(ci) to be non-decreasing with respect to ci, β+(ci) to be non-increasing, and both are non-negative.(预测为+1时,beta不增加;预测为-1时,beta不减小。而且beta是非负的值)。文章具体实验应用提到:We normalized each c_i to [0, 1] for all data sets. The cost adjustment function β is chosen as: β−© = 0.5 · c + 0.5 and β+© = −0.5 · c + 0.5.(其实beta函数的定义是根据实际问题来灵活定义的。但是总的思想一样:给代价高的样本更高的错误分类惩罚和更低的正确分类奖励)

其他两种beta更新规则:

Karakoulas and Shawe-Taylor: 如果y = +1 则 beta = 1; 如果y = -1 则 beta = v(v < 1)。

Ting and Zheng : 使用不同的错误损失,但是重复使用诱导模型。

(note:这两种更新规则在文章只是简单介绍。以后需要看原论文深入理解)

详解AdaCost中的alpha更新规则

For weak hypothesis h with range [-1,+1] and cost adjustment function β(i) in the range [0,+1], the choice of α is

在这里插入图片描述

AdaCost的算法实现

# -*- coding: utf-8 -*-
# @Use     : AdaCost 算法实现(快速实现,未调试)
# @Time    : 2022/5/30 22:30
# @FileName: adacost.py
# @Software: PyCharm

import numpy as np
from sklearn.preprocessing import MinMaxScaler


class AdaCost:
    """
    使用代价敏感的思想改进AdaBoost算法---AdaCost。,目前实现的是二分类
    """
    def __init__(self, T):
        """
        @param T: 训练迭代次数
        """
        self.T = T

    def fit(self, x: np.array, y: np.array, costs:
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

KPer_Yang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值