/** * Returns estimated class probabilities for the given instance if the class is nominal and a * one-element array containing the numeric prediction if the class is numeric. * * @param instance the instance to be classified * @return the distribution * @throws Exception if instance could not be classified successfully */ public double[] distributionForInstance(Instance instance) throws Exception { return m_MetaClassifier.distributionForInstance(metaInstance(instance)); }
/** * Returns class probabilities for all given instances if the class is nominal or corresponding predicted * numeric values if the class is numeric. The meta classifier must implement BatchPredictor, otherwise an * exception will be thrown. * * @param instances the instance sto be classified * @return the distributions * @throws Exception if instances could not be classified successfully */ public double[][] distributionsForInstances(Instances instances) throws Exception { Instances data; if (!baseClassifiersImplementMoreEfficientBatchPrediction()) { data = new Instances(m_MetaFormat, 0); for (Instance inst : instances) { data.add(metaInstance(inst)); } } else { data = metaInstances(instances); } return ((BatchPredictor)m_MetaClassifier).distributionsForInstances(data); }
} else { for (int i = 0; i < test.numInstances(); i++) { metaData.add(metaInstance(test.instance(i)));
/** * Returns class probabilities. * * @param instance the instance to be classified * @return the distribution * @throws Exception if instance could not be classified * successfully */ public double[] distributionForInstance(Instance instance) throws Exception { return m_MetaClassifier.distributionForInstance(metaInstance(instance)); }
metaData.add(metaInstance(test.instance(i)));