/** * Creates a new {@code DefaultWeightedInputOutputPair} with the given * input, output, and weight. * * @param input * The input. * @param output * The output. * @param weight * The weight. */ public DefaultWeightedInputOutputPair( final InputType input, final OutputType output, final double weight) { super(input, output); this.setWeight(weight); }
/** * Creates a new {@code DefaultWeightedInputOutputPair} with the given * input, output, and weight. * * @param input * The input. * @param output * The output. * @param weight * The weight. */ public DefaultWeightedInputOutputPair( final InputType input, final OutputType output, final double weight) { super(input, output); this.setWeight(weight); }
/** * Creates a new {@code DefaultWeightedInputOutputPair} with the given * input, output, and weight. * * @param input * The input. * @param output * The output. * @param weight * The weight. */ public DefaultWeightedInputOutputPair( final InputType input, final OutputType output, final double weight) { super(input, output); this.setWeight(weight); }
double localWeight = kernelWeight * originalWeight; locallyWeightedPair.setWeight( localWeight );
/** * Updates the weightedData from the given prediction function and * the internal Kernel * @param f * Prediction function to use to update the weights of the weightedData * using the Kernel * @return Mean L1 norm of the weight change */ private double updateWeights( Evaluator<? super InputType, ? extends OutputType> f ) { double change = 0.0; for (DefaultWeightedInputOutputPair<InputType, OutputType> pair : this.weightedData) { // Use the kernel to determine the new weight of the sample // Generally, the kernel should weight accurate samples more // than inaccurate samples OutputType yhat = f.evaluate( pair.getInput() ); double weightNew = this.kernelWeightingFunction.evaluate( pair.getOutput(), yhat ); double weightOld = pair.getWeight(); change += Math.abs( weightNew - weightOld ); pair.setWeight( weightNew ); } change /= this.weightedData.size(); return change; }
double localWeight = kernelWeight * originalWeight; locallyWeightedPair.setWeight( localWeight );
double localWeight = kernelWeight * originalWeight; locallyWeightedPair.setWeight( localWeight );
/** * Updates the weightedData from the given prediction function and * the internal Kernel * @param f * Prediction function to use to update the weights of the weightedData * using the Kernel * @return Mean L1 norm of the weight change */ private double updateWeights( Evaluator<? super InputType, ? extends OutputType> f ) { double change = 0.0; for (DefaultWeightedInputOutputPair<InputType, OutputType> pair : this.weightedData) { // Use the kernel to determine the new weight of the sample // Generally, the kernel should weight accurate samples more // than inaccurate samples OutputType yhat = f.evaluate( pair.getInput() ); double weightNew = this.kernelWeightingFunction.evaluate( pair.getOutput(), yhat ); double weightOld = pair.getWeight(); change += Math.abs( weightNew - weightOld ); pair.setWeight( weightNew ); } change /= this.weightedData.size(); return change; }
/** * Updates the weightedData from the given prediction function and * the internal Kernel * @param f * Prediction function to use to update the weights of the weightedData * using the Kernel * @return Mean L1 norm of the weight change */ private double updateWeights( Evaluator<? super InputType, ? extends OutputType> f ) { double change = 0.0; for (DefaultWeightedInputOutputPair<InputType, OutputType> pair : this.weightedData) { // Use the kernel to determine the new weight of the sample // Generally, the kernel should weight accurate samples more // than inaccurate samples OutputType yhat = f.evaluate( pair.getInput() ); double weightNew = this.kernelWeightingFunction.evaluate( pair.getOutput(), yhat ); double weightOld = pair.getWeight(); change += Math.abs( weightNew - weightOld ); pair.setWeight( weightNew ); } change /= this.weightedData.size(); return change; }
: this.weightedData) example.setWeight(initialWeight);
: this.weightedData) example.setWeight(initialWeight);
: this.weightedData) example.setWeight(initialWeight);