/** * 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. * @param weight * The weight for the pair. * @return * A new target-estimate pair with the given weight. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create( final TargetType target, final EstimateType estimate, final double weight) { return new DefaultWeightedTargetEstimatePair<TargetType, EstimateType>( target, estimate, 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. * @return * A new, empty pair with a default weight of 1.0. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create() { return create(null, null); }
/** * Creates a new {@code WeightedTargetEstimatePair} as a shallow copy of * the given other object. * * @param other * The other object to get the target, estimate, and weight from. */ public DefaultWeightedTargetEstimatePair( final DefaultWeightedTargetEstimatePair<? extends TargetType, ? extends EstimateType> other) { this(other.getTarget(), other.getEstimate(), other.getWeight()); }
/** * Creates a new {@code WeightedTargetEstimatePair} with the given target, * estimate, and weight. * * @param target * The target. * @param estimate * The estimate. * @param weight * The eight. */ public DefaultWeightedTargetEstimatePair( final TargetType target, final EstimateType estimate, final double weight) { super(target, estimate); this.setWeight(weight); }
/** * Creates a new {@code WeightedTargetEstimatePair} with the given target, * estimate, and weight. * * @param target * The target. * @param estimate * The estimate. * @param weight * The eight. */ public DefaultWeightedTargetEstimatePair( final TargetType target, final EstimateType estimate, final double weight) { super(target, estimate); this.setWeight(weight); }
/** * Creates a new {@code WeightedTargetEstimatePair} as a shallow copy of * the given other object. * * @param other * The other object to get the target, estimate, and weight from. */ public DefaultWeightedTargetEstimatePair( final DefaultWeightedTargetEstimatePair<? extends TargetType, ? extends EstimateType> other) { this(other.getTarget(), other.getEstimate(), other.getWeight()); }
/** * 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); }
/** * Creates a new {@code WeightedTargetEstimatePair} with the given target, * estimate, and weight. * * @param target * The target. * @param estimate * The estimate. * @param weight * The eight. */ public DefaultWeightedTargetEstimatePair( final TargetType target, final EstimateType estimate, final double weight) { super(target, estimate); this.setWeight(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. * @param weight * The weight for the pair. * @return * A new target-estimate pair with the given weight. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create( final TargetType target, final EstimateType estimate, final double weight) { return new DefaultWeightedTargetEstimatePair<TargetType, EstimateType>( target, estimate, weight); } }
/** * Creates a new {@code WeightedTargetEstimatePair} as a shallow copy of * the given other object. * * @param other * The other object to get the target, estimate, and weight from. */ public DefaultWeightedTargetEstimatePair( final DefaultWeightedTargetEstimatePair<? extends TargetType, ? extends EstimateType> other) { this(other.getTarget(), other.getEstimate(), other.getWeight()); }
/** * 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. * @param weight * The weight for the pair. * @return * A new target-estimate pair with the given weight. */ public static <TargetType, EstimateType> DefaultWeightedTargetEstimatePair<TargetType, EstimateType> create( final TargetType target, final EstimateType estimate, final double weight) { return new DefaultWeightedTargetEstimatePair<TargetType, EstimateType>( target, estimate, 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); }
/** * 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 ); }
/** * 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 ); }
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 ); }