use of Classifier.supervised.liblinear.FeatureNode in project IR_Base by Linda-sunshine.
the class Utils method createLibLinearFV.
public static Feature[] createLibLinearFV(HashMap<Integer, Double> spVct) {
Feature[] node = new Feature[spVct.size()];
int fid = 0;
for (_SparseFeature fv : createSpVct(spVct)) // svm's feature index starts from 1
node[fid++] = new FeatureNode(1 + fv.getIndex(), fv.getValue());
return node;
}
use of Classifier.supervised.liblinear.FeatureNode in project IR_Base by Linda-sunshine.
the class Utils method createLibLinearFV.
public static Feature[] createLibLinearFV(_SparseFeature[] spVct, int fSize) {
Feature[] node;
if (// include bias term in the end
fSize > 0)
node = new Feature[1 + spVct.length];
else
// ignore bias term
node = new Feature[spVct.length];
int fid = 0;
for (_SparseFeature fv : spVct) // svm's feature index starts from 1
node[fid++] = new FeatureNode(1 + fv.getIndex(), fv.getValue());
if (fSize > 0)
node[fid] = new FeatureNode(1 + fSize, 1.0);
return node;
}
Aggregations