- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在我的 C++ 源代码中直接使用 LIBLINEAR ( http://www.csie.ntu.edu.tw/~cjlin/liblinear )。虽然在 MATLAB/JAVA 等语言中使用它似乎很简单,但在 C 中似乎很难;例如,阅读 README 文件,似乎我必须将每个数据矩阵转换为特定的链表格式;来自自述文件
`x' is an array
of pointers, each of which points to a sparse representation (array
of feature_node) of one training vector.
For example, if we have the following training data:
LABEL ATTR1 ATTR2 ATTR3 ATTR4 ATTR5
----- ----- ----- ----- ----- -----
1 0 0.1 0.2 0 0
2 0 0.1 0.3 -1.2 0
1 0.4 0 0 0 0
2 0 0.1 0 1.4 0.5
3 -0.1 -0.2 0.1 1.1 0.1
and bias = 1, then the components of problem are:
l = 5
n = 6
y -> 1 2 1 2 3
x -> [ ] -> (2,0.1) (3,0.2) (6,1) (-1,?)
[ ] -> (2,0.1) (3,0.3) (4,-1.2) (6,1) (-1,?)
[ ] -> (1,0.4) (6,1) (-1,?)
[ ] -> (2,0.1) (4,1.4) (5,0.5) (6,1) (-1,?)
[ ] -> (1,-0.1) (2,-0.2) (3,0.1) (4,1.1) (5,0.1) (6,1) (-1,?)
所以,似乎我不能直接使用矩阵,相反,我必须制作这个 feature_node 的大链表;不存在更简单的系统或任何示例 s.t.我可以用更简单的方式做到这一点吗?
最佳答案
我不确定自您发布此文档以来文档是否已更改,但我使用了另一个问题 [ here 中显示的方法] ] 我将问题值加载到这样的矩阵中,而不是重写我的输入文件以匹配格式。 (我逐行解析文件并以逗号分隔,然后存储在名为 myData 的二维数组中):
struct svm_problem prob;
struct svm_node *x_space;
prob.l = problemSize;
svm_node** x = Malloc(svm_node*, prob.l);
for (int row = 0; row < prob.l; row++)
{
svm_node* x_space = Malloc(svm_node,4);
for (int col = 0; col < 4; col++)
{
x_space[col].index = col;
x_space[col].value = myData[row][col];
}
x_space[4].index = -1;
x[row] = x_space;
}
prob.x = x;
它似乎运作良好,至少满足我的需要。我不太清楚这是否能解决您的问题(也许晚了几年)。
希望对其他人也有用。
关于regression - C\C++ 中的 LIBLINEAR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28240062/
我将使用 LIBLINEAR 为基于转换的依赖关系解析做一些工作。但我很困惑如何使用它。如下: 我为基于转换的依赖解析的训练和测试过程设置了 3 个特征模板: 1. the word in the t
我正在尝试 libSVM 包,使用 RBF 和线性分类,并且我遵循(我认为)其自述文件中的所有建议。 我有一个大文件要训练(70K),所以我尝试使用 liblinear 而不是 RBF。 唯一的问题是
在 LIBLINEAR docs ,我们有 matlab> model = train(training_label_vector, training_instance_matrix [,'libli
大多数机器学习分类器在遇到没有以前见过的特征的实例时,会将该示例分类为训练数据中最常见的类。 liblinear-java 的情况似乎并非如此我想知道为什么会这样。下面是一些示例代码,我在其中构造
我是 SVM 的初学者,我已经成功实现了一类分类。现在我想了解多类分类,这是非常困惑的。 我浏览了How to do multi class classification using Support
这些天我正在做一个使用 libLinear 作为内核的分类工作。并将两种类型的特征集训练成两个模型来对查询输入进行预测。希望利用 Late Fusion 来组合模型的两个结果,我更改了 libline
我一直在寻找快速线性SVM库,我遇到了两个最重要的库Liblinear和Pegasos,从liblinear提出的论文来看,它看起来像liblinaer 的性能优于 Pegasos。然而,pegaso
我经常将实例权重与 Libsvm 结合使用来解决分类问题。 http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/#weights_for_data_instan
我想在我的 C++ 源代码中直接使用 LIBLINEAR ( http://www.csie.ntu.edu.tw/~cjlin/liblinear )。虽然在 MATLAB/JAVA 等语言中使用它
libsvm和 liblinear都是实现支持向量机的软件库。有什么不同?这些差异如何使 liblinear 比 libsvm 更快? 最佳答案 在实践中,在 libsvm 中实现的 SMO 算法(适
我正在尝试对一些输入进行分类(文本分类:10,000 多个示例和 100,000 多个特征) 而且我读到使用 LibLinear 对于此类任务要快得多/内存效率更高,因此,我已经将我的 LibSvm
考虑 liblinear ( http://liblinear.bwaldvogel.de/ ) 的以下用法: double C = 1.0; // cost of constraints v
我正在尝试操作 liblinear 库 (java),并且我正在使用一个 super 简单的示例,其中包含找到的模板 here .案例是判断一个形状是正方形还是长方形。 这是我的代码: import
为 Adrian 运行线性二进制模式的代码。该程序运行但给出以下警告: C:\Python27\lib\site-packages\sklearn\svm\base.py:922: Convergen
我需要使用 Liblinear 实现多分类分类器。 Accord.net 机器学习框架提供了所有 Liblinear 属性,除了 Crammer 和 Singer 的多类分类公式。 This is t
我正在使用 LIBLINEAR 训练一个简单的逻辑回归分类器。只有3个特征,标签是二进制0-1。 示例输入文件: 1 1:355.55660999775586 2:-3.401379785
我正在用 Node.js 编写一个机器学习程序,我想使用 LibLinear 和 SvmPerf 等库,这些库在 Node.js 中不可用。因此,对于训练,我只需创建一个包含训练样本的文件,并在该文件
我正在模拟数据并比较 glm.fit 、 bigglm、speedglm、glmnet、LiblineaR 的二进制 logit 模型。 testGLMResults_and_speed testG
我是一名优秀的程序员,十分优秀!