for (DefaultWeightedInputOutputPair<?, ?> example : this.weightedData) weightSum += example.getWeight(); example.setWeight(example.getWeight() / weightSum); weightedErrorRate += example.getWeight(); final double oldWeight = example.getWeight(); double newWeight = oldWeight * Math.pow(beta, 1.0 - (correct ? 0.0 : 1.0));
for (DefaultWeightedInputOutputPair<?, ?> example : this.weightedData) weightSum += example.getWeight(); example.setWeight(example.getWeight() / weightSum); weightedErrorRate += example.getWeight(); final double oldWeight = example.getWeight(); double newWeight = oldWeight * Math.pow(beta, 1.0 - (correct ? 0.0 : 1.0));
for (DefaultWeightedInputOutputPair<?, ?> example : this.weightedData) weightSum += example.getWeight(); example.setWeight(example.getWeight() / weightSum); weightedErrorRate += example.getWeight(); final double oldWeight = example.getWeight(); double newWeight = oldWeight * Math.pow(beta, 1.0 - (correct ? 0.0 : 1.0));
/** * 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; }
/** * 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; }