/** * Gets the target value of the given training example index, as a double. * * @param i * The training example index. Must be between 0 and dataSize - 1. * @return * The target value for that index represented as a double, which is * either +1.0 or -1.0. */ private double getTarget( final int i) { return this.dataList.get(i).getOutput() ? +1.0 : -1.0; }
/** * Gets the target value of the given training example index, as a double. * * @param i * The training example index. Must be between 0 and dataSize - 1. * @return * The target value for that index represented as a double, which is * either +1.0 or -1.0. */ private double getTarget( final int i) { return this.dataList.get(i).getOutput() ? +1.0 : -1.0; }
public NamedValue<Double> getPerformance() { return new DefaultNamedValue<Double>( "Function Value", this.getResult().getOutput() ); }
@Override public void update( final ResultType target, final InputOutputPair<? extends InputType, OutputType> data) { // Unpack the pair. this.update(target, data.getInput(), data.getOutput()); }
@Override public void update( final ResultType target, final InputOutputPair<? extends InputType, OutputType> data) { // Unpack the pair. this.update(target, data.getInput(), data.getOutput()); }
@Override public void update( final ResultType target, final InputOutputPair<? extends InputType, OutputType> data) { // Unpack the pair. this.update(target, data.getInput(), data.getOutput()); }
public NamedValue<Double> getPerformance() { return new DefaultNamedValue<Double>( "Function Value", this.getResult().getOutput() ); }
public NamedValue<Double> getPerformance() { return new DefaultNamedValue<Double>( "Function Value", this.getResult().getOutput() ); }
@Override public <InputType> void update( final DefaultKernelBinaryCategorizer<InputType> target, final InputType input, final Boolean output) { this.update(target, input, (boolean) output); }
@Override public DiscreteNaiveBayesCategorizer<InputType, CategoryType> learn( final Collection<? extends InputOutputPair<? extends Collection<InputType>, CategoryType>> data) { DiscreteNaiveBayesCategorizer<InputType,CategoryType> nbc = new DiscreteNaiveBayesCategorizer<InputType, CategoryType>(); for( InputOutputPair<? extends Collection<InputType>,CategoryType> sample : data ) { nbc.update(sample.getInput(), sample.getOutput()); } return nbc; }
@Override public DiscreteNaiveBayesCategorizer<InputType, CategoryType> learn( final Collection<? extends InputOutputPair<? extends Collection<InputType>, CategoryType>> data) { DiscreteNaiveBayesCategorizer<InputType,CategoryType> nbc = new DiscreteNaiveBayesCategorizer<InputType, CategoryType>(); for( InputOutputPair<? extends Collection<InputType>,CategoryType> sample : data ) { nbc.update(sample.getInput(), sample.getOutput()); } return nbc; }
@Override public DiscreteNaiveBayesCategorizer<InputType, CategoryType> learn( final Collection<? extends InputOutputPair<? extends Collection<InputType>, CategoryType>> data) { DiscreteNaiveBayesCategorizer<InputType,CategoryType> nbc = new DiscreteNaiveBayesCategorizer<InputType, CategoryType>(); for( InputOutputPair<? extends Collection<InputType>,CategoryType> sample : data ) { nbc.update(sample.getInput(), sample.getOutput()); } return nbc; }
@Override public <InputType> void update( final DefaultKernelBinaryCategorizer<InputType> target, final InputType input, final Boolean output) { this.update(target, input, (boolean) output); }
@Override public <InputType> void update( final DefaultKernelBinaryCategorizer<InputType> target, final InputType input, final Boolean output) { this.update(target, input, (boolean) output); }
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 OutputType evaluate( InputType input) { Collection<InputOutputPair<? extends InputType, OutputType>> neighbors = this.getData().findNearest(input, 1, this.getDivergenceFunction()); InputOutputPair<?,OutputType> pair = CollectionUtil.getFirst(neighbors); if( pair != null ) { return pair.getOutput(); } else { return null; } }
public OutputType evaluate( InputType input) { Collection<InputOutputPair<? extends InputType, OutputType>> neighbors = this.getData().findNearest(input, 1, this.getDivergenceFunction()); InputOutputPair<?,OutputType> pair = CollectionUtil.getFirst(neighbors); if( pair != null ) { return pair.getOutput(); } else { return null; } }
public NamedValue<? extends Number> getPerformance() { double cost = (this.getAlgorithm().getResult() == null) ? 0.0 : this.getAlgorithm().getResult().getOutput(); return new DefaultNamedValue<Double>( "Cost", cost ); }
public NamedValue<? extends Number> getPerformance() { double cost = (this.getAlgorithm().getResult() == null) ? 0.0 : this.getAlgorithm().getResult().getOutput(); return new DefaultNamedValue<Double>( "Cost", cost ); }
public NamedValue<? extends Number> getPerformance() { double cost = (this.getAlgorithm().getResult() == null) ? 0.0 : this.getAlgorithm().getResult().getOutput(); return new DefaultNamedValue<Double>( "Cost", cost ); }