简体   繁体   English

使用LIBLINEAR或LIBSVM的自定义SVM优化

[英]Custom SVM optimization using LIBLINEAR or LIBSVM

I have a PU learning task, and I found what looks like an exceptional algorithim for solving it in this paper: https://www.cs.uic.edu/~liub/publications/ICDM-03.pdf 我有一个PU学习任务,在本文中发现了解决该问题的特殊算法: https : //www.cs.uic.edu/~liub/publications/ICDM-03.pdf

I wish to implement a non-standard formulation of a 'biased' SVM as described in part 5. 我希望实现第5部分中描述的“有偏” SVM的非标准表示。

which uses two parameters C+ and C- to weight positive errors and negative errors differently. 使用两个参数C +和C-分别加权正误差和负误差。

I thought I would use an existing SVM solver on this problem to not only expedite legwork but also ensure an optimal time complexity since both my feature space and number of samples are extremely large (hence my desire to use LIBLINEAR). 我以为我会在此问题上使用现有的SVM求解器,不仅可以加快操作速度,而且可以确保最佳的时间复杂度,因为我的特征空间和样本数量都非常大(因此,我希望使用LIBLINEAR)。

Is there any way to specify a custom loss function like the one above? 有什么方法可以像上面的方法那样指定自定义损失函数?

Thanks for the help. 谢谢您的帮助。

LIBLINEAR 'train' takes an argument -wi weight: "weights adjust the parameter C of different classes". LIBLINEAR'train'接受-wi weight参数:“权重调整不同类的参数C”。 Its actual use (does it take an array?) is still unclear to me, even after reading the README. 即使阅读了README,它的实际用途(是否需要一个数组?)仍然不清楚。 But Sklearn's LinearSVC uses LIBLINEAR and offers a parameter: 但是 Sklearn的LinearSVC使用LIBLINEAR并提供了一个参数:

class_weight : {dict, 'balanced'}, optional Set the parameter C of class i to class_weight[i]*C for SVC. class_weight :{dict,'balanced'},可选对于SVC,将类i的参数C设置为class_weight [i] * C。 If not given, all classes are supposed to have weight one. 如果未给出,则所有类都应具有权重一。 The “balanced” mode uses the values of y to automatically adjust weights inversely proportional to class frequencies in the input data as n_samples / (n_classes * np.bincount(y)) “平衡”模式使用y值自动将权重与输入数据中的类频率成反比地调整为n_samples /(n_classes * np.bincount(y))

Which is quite useful. 很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM