支持 R 中数据实例加权的 SVM 包
SVM packages that support data instances weighting in R
我正在寻找 R 中的 SVM 包,它接受为每个数据实例指定权重。我在 R.
中找到 e1071 package, it provides a class weighting option with class.weights parameter, but it does not provide any option for instance weighting. I also found wsvm package, but neither it provides that functionality. I am looking for something like libsvm-weights-3.17
试试这个包:https://CRAN.R-project.org/package=WeightSVM
它使用 'libsvm' 的修改版本并且能够处理实例加权。
例如。您有模拟数据 (x,y)
x <- seq(0.1, 5, by = 0.05)
y <- log(x) + rnorm(x, sd = 0.2)
这是一个未加权的 SVM:
model1 <- wsvm(x, y, weight = rep(1,99))
Blue dots is the unweighted SVM and do not fit the first instance well. We want to put more weights on the first several instances.
所以我们可以使用加权 SVM:
model2 <- wsvm(x, y, weight = seq(99,1,length.out = 99))
Green dots is the weighted SVM and fit the first instance better.
我正在寻找 R 中的 SVM 包,它接受为每个数据实例指定权重。我在 R.
中找到 e1071 package, it provides a class weighting option with class.weights parameter, but it does not provide any option for instance weighting. I also found wsvm package, but neither it provides that functionality. I am looking for something like libsvm-weights-3.17试试这个包:https://CRAN.R-project.org/package=WeightSVM
它使用 'libsvm' 的修改版本并且能够处理实例加权。
例如。您有模拟数据 (x,y)
x <- seq(0.1, 5, by = 0.05)
y <- log(x) + rnorm(x, sd = 0.2)
这是一个未加权的 SVM:
model1 <- wsvm(x, y, weight = rep(1,99))
Blue dots is the unweighted SVM and do not fit the first instance well. We want to put more weights on the first several instances.
所以我们可以使用加权 SVM:
model2 <- wsvm(x, y, weight = seq(99,1,length.out = 99))
Green dots is the weighted SVM and fit the first instance better.