libsvm.svm.svm_get_labels()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中libsvm.svm.svm_get_labels()方法的一些代码示例,展示了svm.svm_get_labels()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。svm.svm_get_labels()方法的具体详情如下:
包路径:libsvm.svm
类名称:svm
方法名:svm_get_labels

svm.svm_get_labels介绍

暂无

代码示例

代码示例来源:origin: datumbox/datumbox-framework

svm.svm_get_labels(model,labels);

代码示例来源:origin: net.sourceforge/javaml

public int[] getLabels() {
  int res[] = new int[model.nr_class];
  svm.svm_get_labels(model, res);
  return res;
}

代码示例来源:origin: org.apache.ctakes/ctakes-coreference

public AbstractClassifier(File fn, int len) {
  try{
    svmCls = svm.svm_load_model(fn.getAbsolutePath());
    int[] labels = new int[2];
    svm.svm_get_labels(svmCls, labels);
    clsIndex = labels[0]==1 ? 0 : 1;
  }catch(IOException e){
    e.printStackTrace();
  }
}

代码示例来源:origin: apache/ctakes

public AbstractClassifier(File fn, int len) {
  try{
    svmCls = svm.svm_load_model(fn.getAbsolutePath());
    int[] labels = new int[2];
    svm.svm_get_labels(svmCls, labels);
    clsIndex = labels[0]==1 ? 0 : 1;
  }catch(IOException e){
    e.printStackTrace();
  }
}

代码示例来源:origin: org.apache.ctakes/ctakes-coreference

private double calcAnaphoricity (JCas aJCas, Markable m) {
  svm_node[] nodes = createAnaphoricityVector(m, aJCas);
  double[] prob = new double[2];
  svm.svm_predict_probability(anaph_model, nodes, prob);
  int[] labels = new int[2];
  svm.svm_get_labels(anaph_model, labels);
  int anaph_idx = labels[0]==1 ? 0 : 1;
  return prob[anaph_idx];
}

代码示例来源:origin: apache/ctakes

private double calcAnaphoricity (JCas aJCas, Markable m) {
  svm_node[] nodes = createAnaphoricityVector(m, aJCas);
  double[] prob = new double[2];
  svm.svm_predict_probability(anaph_model, nodes, prob);
  int[] labels = new int[2];
  svm.svm_get_labels(anaph_model, labels);
  int anaph_idx = labels[0]==1 ? 0 : 1;
  return prob[anaph_idx];
}

代码示例来源:origin: education-service/speech-mfcc

public double classifyInstance(Observation observation, svm_model model) {
    List<Double> features = observation.getFeatures();

    svm_node[] nodes = new svm_node[observation.getFeatures().size()];
    for (int i = 0; i < features.size(); i++) {
      svm_node node = new svm_node();
      node.index = i + 1;
      node.value = features.get(i);
      nodes[i] = node;
    }

    int[] labels = new int[TOTAL_CLASSES];
    svm.svm_get_labels(model, labels);

    double[] prob_estimates = new double[TOTAL_CLASSES];
    return svm.svm_predict_probability(model, nodes, prob_estimates);
  }
}

代码示例来源:origin: jzy3d/jzy3d-api

svm.svm_get_labels(model,labels);
prob_estimates = new double[nr_class];

代码示例来源:origin: org.maochen.nlp/CoreNLP-NLP

@Override
public Map<String, Double> predict(Tuple predict) {
  double[] feats = predict.vector.getVector();
  svm_node[] svmfeats = new svm_node[feats.length];
  for (int i = 0; i < feats.length; i++) {
    svm_node svmfeatI = new svm_node();
    svmfeatI.index = i;
    svmfeatI.value = feats[i];
    svmfeats[i] = svmfeatI;
  }
  int totalSize = labelIndexer.getLabelSize();
  int[] labels = new int[totalSize];
  svm.svm_get_labels(model, labels);
  double[] probs = new double[totalSize];
  svm.svm_predict_probability(model, svmfeats, probs);
  Map<String, Double> result = new HashMap<>();
  for (int i = 0; i < labels.length; i++) {
    result.put(labelIndexer.getLabel(labels[i]), probs[i]);
  }
  return result;
}

代码示例来源:origin: ch.epfl.bbp.nlp/bluima_jsre

svm.svm_get_labels(model,labels);
prob_estimates = new double[nr_class];
output.writeBytes("labels");

代码示例来源:origin: dkpro/dkpro-tc

svm.svm_get_labels(model, labels);
prob_estimates = new double[nr_class];
output.writeBytes("labels");

代码示例来源:origin: org.dkpro.tc/dkpro-tc-ml-libsvm

svm.svm_get_labels(model, labels);
prob_estimates = new double[nr_class];
output.writeBytes("labels");

代码示例来源:origin: org.clulab/processors

svm.svm_get_labels(model, labels);
int k = nr_class-1;
if (kBestList.getK() != -1) {

代码示例来源:origin: org.maltparser/maltparser

svm.svm_get_labels(model, labels);
int k = nr_class-1;
if (kBestList.getK() != -1) {

代码示例来源:origin: DigitalPebble/TextClassification

int nr_class = svm.svm_get_nr_class(model);
int[] labels = new int[nr_class];
svm.svm_get_labels(model, labels);
boolean support_probabilities = svm.svm_check_probability_model(model) == 1;
double[] scores = new double[nr_class];

代码示例来源:origin: jdmp/java-data-mining-package

svm.svm_get_labels(model, label);
Matrix output = Matrix.Factory.zeros(1, MathUtil.max(label) + 1);

代码示例来源:origin: nz.ac.waikato.cms.weka/LibSVM

svm.svm_get_labels(m_Model, labels);

相关文章