本文整理了Java中weka.core.Utils.roundDouble()
方法的一些代码示例,展示了Utils.roundDouble()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.roundDouble()
方法的具体详情如下:
包路径:weka.core.Utils
类名称:Utils
方法名:roundDouble
[英]Rounds a double to the given number of decimal places.
[中]将双精度四舍五入到给定的小数位数。
代码示例来源:origin: nz.ac.waikato.cms.weka/multiInstanceLearning
} else if (m_NumIterations == 1) {
text.append("No boosting possible, one classifier used: Weight = "
+ Utils.roundDouble(m_Beta[0], 2) + "\n");
text.append("Base classifiers:\n" + m_Models[0].toString());
} else {
for (int i = 0; i < m_NumIterations; i++) {
text.append("\n\n" + i + ": Weight = "
+ Utils.roundDouble(m_Beta[i], 2) + "\nBase classifier:\n"
+ m_Models[i].toString());
代码示例来源:origin: Waikato/weka-trunk
for (int i = 0; i < m_NumIterationsPerformed; i++) {
text.append(m_Classifiers[i].toString() + "\n\n");
text.append("Weight: " + Utils.roundDouble(m_Betas[i], 2) + "\n\n");
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
for (int i = 0; i < m_NumIterationsPerformed; i++) {
text.append(m_Classifiers[i].toString() + "\n\n");
text.append("Weight: " + Utils.roundDouble(m_Betas[i], 2) + "\n\n");
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Prints label for subset index of instances (eg class).
*
* @exception Exception if something goes wrong
*/
public final String dumpLabel(int index,Instances data) throws Exception {
StringBuffer text;
text = new StringBuffer();
text.append(((Instances)data).classAttribute().
value(m_distribution.maxClass(index)));
text.append(" ("+Utils.roundDouble(m_distribution.perBag(index),2));
if (Utils.gr(m_distribution.numIncorrect(index),0))
text.append("/"+Utils.roundDouble(m_distribution.numIncorrect(index),2));
text.append(")");
return text.toString();
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Prints label for subset index of instances (eg class).
*
* @exception Exception if something goes wrong
*/
public final String dumpLabel(int index,Instances data) throws Exception {
StringBuffer text;
text = new StringBuffer();
text.append(((Instances)data).classAttribute().
value(m_distribution.maxClass(index)));
text.append(" ("+Utils.roundDouble(m_distribution.perBag(index),2));
if (Utils.gr(m_distribution.numIncorrect(index),0))
text.append("/"+Utils.roundDouble(m_distribution.numIncorrect(index),2));
text.append(")");
return text.toString();
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
System.out.println("5.5 rounded: " + Utils.round(5.5));
System.out.println("5.55555 rounded to 2 decimal places: "
+ Utils.roundDouble(5.55555, 2));
代码示例来源:origin: Waikato/weka-trunk
System.out.println("5.5 rounded: " + Utils.round(5.5));
System.out.println("5.55555 rounded to 2 decimal places: "
+ Utils.roundDouble(5.55555, 2));
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
/**
* CVModel - Split D into train/test folds, and then train and evaluate on each one.
* @param h a multi-dim. classifier
* @param D data
* @param numFolds test data
* @param top Threshold OPtion (pertains to multi-label data only)
* @return an array of 'numFolds' Results
*/
public static Result[] cvModel(MultilabelClassifier h, Instances D, int numFolds, String top) throws Exception {
Result r[] = new Result[numFolds];
for(int i = 0; i < numFolds; i++) {
Instances D_train = D.trainCV(numFolds,i);
Instances D_test = D.testCV(numFolds,i);
if (h.getDebug()) System.out.println(":- Fold ["+i+"/"+numFolds+"] -: "+MLUtils.getDatasetName(D)+"\tL="+D.classIndex()+"\tD(t:T)=("+D_train.numInstances()+":"+D_test.numInstances()+")\tLC(t:T)="+Utils.roundDouble(MLUtils.labelCardinality(D_train,D.classIndex()),2)+":"+Utils.roundDouble(MLUtils.labelCardinality(D_test,D.classIndex()),2)+")");
r[i] = evaluateModel(h, D_train, D_test, top);
}
return r;
}
代码示例来源:origin: net.sf.meka/meka
Instances D_train = D.trainCV(numFolds,i);
Instances D_test = D.testCV(numFolds,i);
if (h.getDebug()) System.out.println(":- Fold ["+i+"/"+numFolds+"] -: "+MLUtils.getDatasetName(D)+"\tL="+D.classIndex()+"\tD(t:T)=("+D_train.numInstances()+":"+D_test.numInstances()+")\tLC(t:T)="+Utils.roundDouble(MLUtils.labelCardinality(D_train,D.classIndex()),2)+":"+Utils.roundDouble(MLUtils.labelCardinality(D_test,D.classIndex()),2)+")");
代码示例来源:origin: Waikato/meka
Instances D_train = D.trainCV(numFolds,i);
Instances D_test = D.testCV(numFolds,i);
if (h.getDebug()) System.out.println(":- Fold ["+i+"/"+numFolds+"] -: "+MLUtils.getDatasetName(D)+"\tL="+D.classIndex()+"\tD(t:T)=("+D_train.numInstances()+":"+D_test.numInstances()+")\tLC(t:T)="+Utils.roundDouble(MLUtils.labelCardinality(D_train,D.classIndex()),2)+":"+Utils.roundDouble(MLUtils.labelCardinality(D_test,D.classIndex()),2)+")");
代码示例来源:origin: nz.ac.waikato.cms.weka/meka
if (h.getDebug()) System.out.println(":- Dataset -: "+MLUtils.getDatasetName(allInstances)+"\tL="+allInstances.classIndex()+"\tD(t:T)=("+train.numInstances()+":"+test.numInstances()+")\tLC(t:T)="+Utils.roundDouble(MLUtils.labelCardinality(train,allInstances.classIndex()),2)+":"+Utils.roundDouble(MLUtils.labelCardinality(test,allInstances.classIndex()),2)+")");
代码示例来源:origin: net.sf.meka/meka
if (h.getDebug()) System.out.println(":- Dataset -: "+MLUtils.getDatasetName(D_train)+"\tL="+L+"\tD(t:T)=("+D_train.numInstances()+":"+D_test.numInstances()+")\tLC(t:T)="+Utils.roundDouble(MLUtils.labelCardinality(D_train,L),2)+":"+Utils.roundDouble(MLUtils.labelCardinality(D_test,L),2)+")");
代码示例来源:origin: Waikato/meka
if (h.getDebug()) System.out.println(":- Dataset -: "+MLUtils.getDatasetName(D_train)+"\tL="+L+"\tD(t:T)=("+D_train.numInstances()+":"+D_test.numInstances()+")\tLC(t:T)="+Utils.roundDouble(MLUtils.labelCardinality(D_train,L),2)+":"+Utils.roundDouble(MLUtils.labelCardinality(D_test,L),2)+")");
内容来源于网络,如有侵权,请联系作者删除!