本文整理汇总了Java中weka.classifiers.evaluation.Prediction类的典型用法代码示例。如果您正苦于以下问题:Java Prediction类的具体用法?Java Prediction怎么用?Java Prediction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Prediction类属于weka.classifiers.evaluation包,在下文中一共展示了Prediction类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: evaluateResults
import weka.classifiers.evaluation.Prediction; //导入依赖的package包/类
public static void evaluateResults(Evaluation evaluation) {
for (Prediction p : evaluation.predictions()) {
System.out.println(p.actual() + " " + p.predicted());
}
System.out.println(evaluation.toSummaryString("\nResults\n======\n", true));
// System.out.println(evaluation.toSummaryString(evaluation.correlationCoefficient() + " " + evaluation.errorRate() + " " + evaluation.meanAbsoluteError() + " ");
}
开发者ID:gizemsogancioglu,项目名称:biosses,代码行数:10,代码来源:LinearRegressionMethod.java
示例2: computeAccuracyAndRecordPrediction
import weka.classifiers.evaluation.Prediction; //导入依赖的package包/类
public double computeAccuracyAndRecordPrediction(BayesianNetwork bn, DataOnMemory<DataInstance> data){
double correctPredictions = 0;
Variable classVariable = bn.getVariables().getVariableById(nb_.getClassIndex());
VMP vmp = new VMP();
vmp.setModel(bn);
for (DataInstance instance : data) {
double realValue = instance.getValue(classVariable);
instance.setValue(classVariable, Utils.missingValue());
vmp.setEvidence(instance);
vmp.runInference();
Multinomial posterior = vmp.getPosterior(classVariable);
if (Utils.maxIndex(posterior.getProbabilities())==realValue)
correctPredictions++;
Prediction prediction = new NominalPrediction(realValue, posterior.getProbabilities());
predictions.add(prediction);
instance.setValue(classVariable, realValue);
}
return correctPredictions/data.getNumberOfDataInstances();
}
开发者ID:amidst,项目名称:toolbox-usecases,代码行数:27,代码来源:amidstModels.java
示例3: predictionsToString
import weka.classifiers.evaluation.Prediction; //导入依赖的package包/类
/**
* Returns a string containing all the predictions.
*
* @param predictions a <code>FastVector</code> containing the predictions
* @return a <code>String</code> representing the vector of predictions.
*/
public static String predictionsToString(ArrayList<Prediction> predictions) {
StringBuffer sb = new StringBuffer();
sb.append(predictions.size()).append(" predictions\n");
for (int i = 0; i < predictions.size(); i++) {
sb.append(predictions.get(i)).append('\n');
}
return sb.toString();
}
开发者ID:umple,项目名称:umple,代码行数:15,代码来源:AbstractClassifierTest.java
示例4: predictionsToString
import weka.classifiers.evaluation.Prediction; //导入依赖的package包/类
/**
* Returns a string containing all the predictions.
*
* @param predictions a <code>FastVector</code> containing the predictions
* @return a <code>String</code> representing the vector of predictions.
*/
protected String predictionsToString(ArrayList<Prediction> predictions) {
StringBuffer sb = new StringBuffer();
sb.append(predictions.size()).append(" predictions\n");
for (int i = 0; i < predictions.size(); i++) {
sb.append(predictions.get(i)).append('\n');
}
return sb.toString();
}
开发者ID:umple,项目名称:umple,代码行数:15,代码来源:SerializedClassifierTest.java
示例5: evaluateResults
import weka.classifiers.evaluation.Prediction; //导入依赖的package包/类
public static void evaluateResults(Evaluation evaluation){
for(Prediction p: evaluation.predictions()){
System.out.println(p.actual() + " " + p.predicted() );
}
System.out.println(evaluation.toSummaryString("\nResults\n======\n", true));
// System.out.println(evaluation.toSummaryString(evaluation.correlationCoefficient() + " " + evaluation.errorRate() + " " + evaluation.meanAbsoluteError() + " ");
}
开发者ID:gizemsogancioglu,项目名称:biosses,代码行数:13,代码来源:RandomForestRegression.java
示例6: main
import weka.classifiers.evaluation.Prediction; //导入依赖的package包/类
public static void main(String[] args) {
try {
Instances train = new Instances(new java.io.BufferedReader(
new java.io.FileReader(args[0])));
train.setClassIndex(train.numAttributes() - 1);
weka.classifiers.evaluation.ThresholdCurve tc = new weka.classifiers.evaluation.ThresholdCurve();
weka.classifiers.evaluation.EvaluationUtils eu = new weka.classifiers.evaluation.EvaluationUtils();
// weka.classifiers.Classifier classifier = new
// weka.classifiers.functions.Logistic();
weka.classifiers.Classifier classifier = new weka.classifiers.bayes.NaiveBayes();
ArrayList<Prediction> predictions = new ArrayList<Prediction>();
eu.setSeed(1);
predictions.addAll(eu.getCVPredictions(classifier, train, 10));
Instances result = tc.getCurve(predictions, 0);
PlotData2D pd = new PlotData2D(result);
pd.m_alwaysDisplayPointsOfThisSize = 10;
boolean[] connectPoints = new boolean[result.numInstances()];
for (int i = 1; i < connectPoints.length; i++) {
connectPoints[i] = true;
}
pd.setConnectPoints(connectPoints);
final javax.swing.JFrame jf = new javax.swing.JFrame("CostBenefitTest");
jf.setSize(1000, 600);
// jf.pack();
jf.getContentPane().setLayout(new BorderLayout());
final CostBenefitAnalysis.AnalysisPanel analysisPanel = new CostBenefitAnalysis.AnalysisPanel();
jf.getContentPane().add(analysisPanel, BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
System.exit(0);
}
});
jf.setVisible(true);
analysisPanel.setDataSet(pd, train.classAttribute());
} catch (Exception ex) {
ex.printStackTrace();
}
}
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:47,代码来源:CostBenefitAnalysis.java
示例7: predictions
import weka.classifiers.evaluation.Prediction; //导入依赖的package包/类
/**
* Returns the predictions that have been collected.
*
* @return a reference to the FastVector containing the predictions that have
* been collected. This should be null if no predictions have been
* collected.
*/
public ArrayList<Prediction> predictions() {
return m_delegate.predictions();
}
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:11,代码来源:Evaluation.java
示例8: getVisualizeMenuItem
import weka.classifiers.evaluation.Prediction; //导入依赖的package包/类
/**
* Get a JMenu or JMenuItem which contain action listeners that perform the
* visualization, using some but not necessarily all of the data. Exceptions
* thrown because of changes in Weka since compilation need to be caught by
* the implementer.
*
* @see NoClassDefFoundError
* @see IncompatibleClassChangeError
*
* @param preds predictions
* @param classAtt class attribute
* @return menuitem for opening visualization(s), or null to indicate no
* visualization is applicable for the input
*/
public JMenuItem getVisualizeMenuItem(ArrayList<Prediction> preds,
Attribute classAtt);
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:17,代码来源:VisualizePlugin.java
注:本文中的weka.classifiers.evaluation.Prediction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论