/** * Convenience method for creating a new {@code DefaultWeightedTargetEstimatePair}. * * @param <TargetType> * The target (ground-truth) type. * @param <EstimateType> * The estimate (prediction) type. Usually the same as TargetType. * @return * A new, empty pair with a default weight of 1.0. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create() { return create(null, null); }
/** * Convenience method for creating a new {@code DefaultWeightedTargetEstimatePair}. * * @param <TargetType> * The target (ground-truth) type. * @param <EstimateType> * The estimate (prediction) type. Usually the same as TargetType. * @return * A new, empty pair with a default weight of 1.0. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create() { return create(null, null); }
/** * Convenience method for creating a new {@code DefaultWeightedTargetEstimatePair}. * * @param <TargetType> * The target (ground-truth) type. * @param <EstimateType> * The estimate (prediction) type. Usually the same as TargetType. * @return * A new, empty pair with a default weight of 1.0. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create() { return create(null, null); }
/** * Convenience method for creating a new {@code DefaultWeightedTargetEstimatePair}. * * @param <TargetType> * The target (ground-truth) type. * @param <EstimateType> * The estimate (prediction) type. Usually the same as TargetType. * @param target * The target (ground-truth) value. * @param estimate * The estimate (prediction) value. * @return * A new target-estimate pair with a default weight of 1.0. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create( final TargetType target, final EstimateType estimate) { return create(target, estimate, DEFAULT_WEIGHT); }
/** * Convenience method for creating a new {@code DefaultWeightedTargetEstimatePair}. * * @param <TargetType> * The target (ground-truth) type. * @param <EstimateType> * The estimate (prediction) type. Usually the same as TargetType. * @param target * The target (ground-truth) value. * @param estimate * The estimate (prediction) value. * @return * A new target-estimate pair with a default weight of 1.0. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create( final TargetType target, final EstimateType estimate) { return create(target, estimate, DEFAULT_WEIGHT); }
/** * Convenience method for creating a new {@code DefaultWeightedTargetEstimatePair}. * * @param <TargetType> * The target (ground-truth) type. * @param <EstimateType> * The estimate (prediction) type. Usually the same as TargetType. * @param target * The target (ground-truth) value. * @param estimate * The estimate (prediction) value. * @return * A new target-estimate pair with a default weight of 1.0. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create( final TargetType target, final EstimateType estimate) { return create(target, estimate, DEFAULT_WEIGHT); }
public Double evaluate( Evaluator<? super InputType, ? extends TargetType> evaluator ) { ArrayList<WeightedTargetEstimatePair<TargetType, TargetType>> targetEstimatePairs = new ArrayList<WeightedTargetEstimatePair<TargetType, TargetType>>( this.getCostParameters().size() ); for (InputOutputPair<? extends InputType, ? extends TargetType> io : this.getCostParameters()) { TargetType target = io.getOutput(); TargetType estimate = evaluator.evaluate(io.getInput()); targetEstimatePairs.add(DefaultWeightedTargetEstimatePair.create( target, estimate, DatasetUtil.getWeight(io))); } return this.evaluatePerformance( targetEstimatePairs ); }
public Double evaluate( Evaluator<? super InputType, ? extends TargetType> evaluator ) { ArrayList<WeightedTargetEstimatePair<TargetType, TargetType>> targetEstimatePairs = new ArrayList<WeightedTargetEstimatePair<TargetType, TargetType>>( this.getCostParameters().size() ); for (InputOutputPair<? extends InputType, ? extends TargetType> io : this.getCostParameters()) { TargetType target = io.getOutput(); TargetType estimate = evaluator.evaluate(io.getInput()); targetEstimatePairs.add(DefaultWeightedTargetEstimatePair.create( target, estimate, DatasetUtil.getWeight(io))); } return this.evaluatePerformance( targetEstimatePairs ); }
public Double evaluate( Evaluator<? super InputType, ? extends TargetType> evaluator ) { ArrayList<WeightedTargetEstimatePair<TargetType, TargetType>> targetEstimatePairs = new ArrayList<WeightedTargetEstimatePair<TargetType, TargetType>>( this.getCostParameters().size() ); for (InputOutputPair<? extends InputType, ? extends TargetType> io : this.getCostParameters()) { TargetType target = io.getOutput(); TargetType estimate = evaluator.evaluate(io.getInput()); targetEstimatePairs.add(DefaultWeightedTargetEstimatePair.create( target, estimate, DatasetUtil.getWeight(io))); } return this.evaluatePerformance( targetEstimatePairs ); }
/** * Evaluates the performance accuracy of the given estimates against the * given targets. * * @param evaluator Evaluator to generate estimates * @param data The target-estimate pairs to use to evaluate performance. * @return The performance evaluation result. */ public ResultType evaluatePerformance( final Evaluator<? super InputType, ? extends EstimateType> evaluator, final Collection<? extends InputOutputPair<? extends InputType, TargetType>> data ) { // Use the given evaluator to compute the Target-Estimate pairs for // the given data. final ArrayList<TargetEstimatePair<TargetType, EstimateType>> pairs = new ArrayList<TargetEstimatePair<TargetType, EstimateType>>( data.size() ); for (InputOutputPair<? extends InputType, TargetType> example : data) { final InputType input = example.getInput(); final TargetType target = example.getOutput(); final EstimateType estimate = evaluator.evaluate( input ); final double weight = DatasetUtil.getWeight(example); pairs.add(DefaultWeightedTargetEstimatePair.create(target, estimate, weight)); } // Evaluate the performance of the pairs. return this.evaluatePerformance( pairs ); }
/** * Evaluates the performance accuracy of the given estimates against the * given targets. * * @param evaluator Evaluator to generate estimates * @param data The target-estimate pairs to use to evaluate performance. * @return The performance evaluation result. */ public ResultType evaluatePerformance( final Evaluator<? super InputType, ? extends EstimateType> evaluator, final Collection<? extends InputOutputPair<? extends InputType, TargetType>> data ) { // Use the given evaluator to compute the Target-Estimate pairs for // the given data. final ArrayList<TargetEstimatePair<TargetType, EstimateType>> pairs = new ArrayList<TargetEstimatePair<TargetType, EstimateType>>( data.size() ); for (InputOutputPair<? extends InputType, TargetType> example : data) { final InputType input = example.getInput(); final TargetType target = example.getOutput(); final EstimateType estimate = evaluator.evaluate( input ); final double weight = DatasetUtil.getWeight(example); pairs.add(DefaultWeightedTargetEstimatePair.create(target, estimate, weight)); } // Evaluate the performance of the pairs. return this.evaluatePerformance( pairs ); }
/** * Evaluates the performance accuracy of the given estimates against the * given targets. * * @param evaluator Evaluator to generate estimates * @param data The target-estimate pairs to use to evaluate performance. * @return The performance evaluation result. */ public ResultType evaluatePerformance( final Evaluator<? super InputType, ? extends EstimateType> evaluator, final Collection<? extends InputOutputPair<? extends InputType, TargetType>> data ) { // Use the given evaluator to compute the Target-Estimate pairs for // the given data. final ArrayList<TargetEstimatePair<TargetType, EstimateType>> pairs = new ArrayList<TargetEstimatePair<TargetType, EstimateType>>( data.size() ); for (InputOutputPair<? extends InputType, TargetType> example : data) { final InputType input = example.getInput(); final TargetType target = example.getOutput(); final EstimateType estimate = evaluator.evaluate( input ); final double weight = DatasetUtil.getWeight(example); pairs.add(DefaultWeightedTargetEstimatePair.create(target, estimate, weight)); } // Evaluate the performance of the pairs. return this.evaluatePerformance( pairs ); }