/** * 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; }
final CategoryType predicted = member.evaluate(example.getInput()); final boolean correct = ObjectUtil.equalsSafe(predicted, actual);
final CategoryType predicted = member.evaluate(example.getInput()); final boolean correct = ObjectUtil.equalsSafe(predicted, actual);
final CategoryType predicted = member.evaluate(example.getInput()); final boolean correct = ObjectUtil.equalsSafe(predicted, actual);