R语言DMwR包中的SMOTE函数中perc.over和perc.under的含义。

引文:帮助文档http://www.biostatistic.net/thread-34529-1-1.html
同样可以载入DMwR包之后,输入 ?SMOTE 查看相关帮助文档

perc.over = xx 表示 少样本变成原来的(1+xx/100)倍
perc.under=yy 表示多样本变成少样本的 yy/100 *(xx/100)倍

## data [#数据]
data(iris)
data <- iris[, c(1, 2, 5)]
data$Species <- factor(ifelse(data$Species == "setosa","rare","common")) 
## checking the class distribution of this artificial data set[#检查类的分布,这种人工数据集]
table(data$Species)

## now using SMOTE to create a more "balanced problem"[#现在使用SMOTE的创建一个更加“平衡的问题”]
newData <- SMOTE(Species ~ ., data, perc.over = 600,perc.under=100)
table(newData$Species)
> table(data$Species)

common   rare 
   100     50 
> 
> ## now using SMOTE to create a more "balanced problem"[#现在使用SMOTE的创建一个更加“平衡的问题”]
> newData <- SMOTE(Species ~ ., data, perc.over = 600,perc.under=100)
> table(newData$Species)

common   rare 
   300    350 

本文中,原始数据 多样本:少样本为 100:50
设置perc.over = 600,perc.under=100
即 少样本 变成原来的 1+600/100=7倍,计50*7=350个
多样本变为 少样本的 100/100*(600/100)=6倍,计50*6=300个

自己试试 吧

  • 3
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值