本文整理了Java中libsvm.svm.svm_predict_probability()
方法的一些代码示例,展示了svm.svm_predict_probability()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。svm.svm_predict_probability()
方法的具体详情如下:
包路径:libsvm.svm
类名称:svm
方法名:svm_predict_probability
暂无
代码示例来源:origin: datumbox/datumbox-framework
svm.svm_predict_probability(model, xSVM, prob_estimates);
代码示例来源:origin: org.apache.ctakes/ctakes-coreference
public double predict(svm_node[] vec, TreebankNode path){
double[] probs = new double[2];
svm.svm_predict_probability(svmCls, vec, probs);
return probs[clsIndex];
}
}
代码示例来源:origin: apache/ctakes
public double predict(svm_node[] vec, TreebankNode path){
double[] probs = new double[2];
svm.svm_predict_probability(svmCls, vec, probs);
return probs[clsIndex];
}
}
代码示例来源: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: ch.epfl.bbp.nlp/bluima_jsre
svm.svm_predict_probability(model, x, probs);
代码示例来源:origin: org.cleartk/cleartk-ml-libsvm
@Override
public Map<OUTCOME_TYPE, Double> score(List<Feature> features) throws CleartkProcessingException {
FeatureVector featureVector = this.featuresEncoder.encodeAll(features);
double[] decisionValues = new double[this.model.nr_class];
libsvm.svm.svm_predict_probability(this.model, convertToLIBSVM(featureVector), decisionValues);
Map<OUTCOME_TYPE, Double> results = Maps.newHashMap();
for (int i = 0; i < this.model.nr_class; ++i) {
int intLabel = this.model.label[i];
OUTCOME_TYPE outcome = this.outcomeEncoder.decode(this.decodePrediction(intLabel));
results.put(outcome, decisionValues[i]);
}
return results;
}
代码示例来源: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: ClearTK/cleartk
@Override
public Map<OUTCOME_TYPE, Double> score(List<Feature> features) throws CleartkProcessingException {
FeatureVector featureVector = this.featuresEncoder.encodeAll(features);
double[] decisionValues = new double[this.model.nr_class];
libsvm.svm.svm_predict_probability(this.model, convertToLIBSVM(featureVector), decisionValues);
Map<OUTCOME_TYPE, Double> results = Maps.newHashMap();
for (int i = 0; i < this.model.nr_class; ++i) {
int intLabel = this.model.label[i];
OUTCOME_TYPE outcome = this.outcomeEncoder.decode(this.decodePrediction(intLabel));
results.put(outcome, decisionValues[i]);
}
return results;
}
代码示例来源:origin: jzy3d/jzy3d-api
if (predict_probability==1 && (svm_type==svm_parameter.C_SVC || svm_type==svm_parameter.NU_SVC))
v = svm.svm_predict_probability(model,x.get(i),prob_estimates);
代码示例来源: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
if (predict_probability==1 && (svm_type==svm_parameter.C_SVC || svm_type==svm_parameter.NU_SVC))
v = svm.svm_predict_probability(model,x,prob_estimates);
output.writeBytes(v+" ");
for(int j=0;j<nr_class;j++)
代码示例来源:origin: dkpro/dkpro-tc
if (predict_probability == 1
&& (svm_type == svm_parameter.C_SVC || svm_type == svm_parameter.NU_SVC)) {
v = svm.svm_predict_probability(model, x, prob_estimates);
output.writeBytes(v + " ");
for (int j = 0; j < nr_class; j++)
代码示例来源:origin: org.dkpro.tc/dkpro-tc-ml-libsvm
if (predict_probability == 1
&& (svm_type == svm_parameter.C_SVC || svm_type == svm_parameter.NU_SVC)) {
v = svm.svm_predict_probability(model, x, prob_estimates);
output.writeBytes(v + " ");
for (int j = 0; j < nr_class; j++)
代码示例来源:origin: com.facebook.thirdparty/libsvm
target[perm[j]] = svm_predict_probability(submodel,prob.x[perm[j]],prob_estimates);
代码示例来源:origin: tw.edu.ntu.csie/libsvm
target[perm[j]] = svm_predict_probability(submodel,prob.x[perm[j]],prob_estimates);
代码示例来源:origin: eu.fbk.utils/utils-svm
@Override
LabelledVector doPredict(final boolean withProbabilities, final Vector vector) {
final svm_node[] nodes = encodeVector(this.dictionary, vector);
if (withProbabilities) {
final int numLabels = getParameters().getNumLabels();
final double[] p = new double[numLabels];
final int label = (int) svm.svm_predict_probability(this.model, nodes, p);
final float[] probabilities = new float[numLabels];
for (int i = 0; i < p.length; ++i) {
final int labelIndex = this.model.label[i];
probabilities[labelIndex] = (float) p[i];
}
return vector.label(label, probabilities);
} else {
final int label = (int) svm.svm_predict(this.model, nodes);
return vector.label(label);
}
}
代码示例来源:origin: DigitalPebble/TextClassification
svm.svm_predict_probability(model, svm_nodes, scores);
return scores;
代码示例来源:origin: jdmp/java-data-mining-package
svm.svm_predict_probability(model, x, prediction);
int[] label = new int[svm.svm_get_nr_class(model)];
svm.svm_get_labels(model, label);
代码示例来源:origin: nz.ac.waikato.cms.weka/LibSVM
if (m_ProbabilityEstimates
&& ((m_SVMType == SVMTYPE_C_SVC) || (m_SVMType == SVMTYPE_NU_SVC))) {
v = svm.svm_predict_probability(m_Model, x, prob_estimates);
内容来源于网络,如有侵权,请联系作者删除!