public int getCount() { return prediction.getCount(); }
public void update(Example train) { prediction.update(train); }
/** * @param predictions {@link Prediction}s from individuals * @param weights weights that should be applied to * @param <T> type of {@link Prediction} to vote on * @return a single {@link Prediction} represented a weighted combination of the inputs */ public static <T extends Prediction> Prediction voteOnFeature(List<T> predictions, double[] weights) { Preconditions.checkArgument(!predictions.isEmpty(), "No predictions"); Preconditions.checkArgument(predictions.size() == weights.length, "%s predictions but %s weights?", predictions.size(), weights.length); switch (predictions.get(0).getFeatureType()) { case NUMERIC: @SuppressWarnings("unchecked") List<NumericPrediction> numericVotes = (List<NumericPrediction>) predictions; return voteOnNumericFeature(numericVotes, weights); case CATEGORICAL: @SuppressWarnings("unchecked") List<CategoricalPrediction> categoricalVotes = (List<CategoricalPrediction>) predictions; return voteOnCategoricalFeature(categoricalVotes, weights); default: throw new IllegalStateException(); } }
/** * @param predictions {@link Prediction}s from individuals * @param weights weights that should be applied to * @param <T> type of {@link Prediction} to vote on * @return a single {@link Prediction} represented a weighted combination of the inputs */ public static <T extends Prediction> Prediction voteOnFeature(List<T> predictions, double[] weights) { Preconditions.checkArgument(!predictions.isEmpty(), "No predictions"); Preconditions.checkArgument(predictions.size() == weights.length, "%s predictions but %s weights?", predictions.size(), weights.length); switch (predictions.get(0).getFeatureType()) { case NUMERIC: @SuppressWarnings("unchecked") List<NumericPrediction> numericVotes = (List<NumericPrediction>) predictions; return voteOnNumericFeature(numericVotes, weights); case CATEGORICAL: @SuppressWarnings("unchecked") List<CategoricalPrediction> categoricalVotes = (List<CategoricalPrediction>) predictions; return voteOnCategoricalFeature(categoricalVotes, weights); default: throw new IllegalStateException(); } }
public int getCount() { return prediction.getCount(); }
public void update(Example train) { prediction.update(train); }