@Override public ValueDiscriminantPair<Boolean, Double> evaluateWithDiscriminant( final InputType input) { // Evaluate the input as a double whose sign is the category. final double value = this.evaluateAsDouble(input); final boolean category = value >= 0.0; // The discriminant needs to be larger for a better match, even in // the case of the false category, which requires doing an absolute // value to the sign. final double discriminant = category ? value : -value; return DefaultWeightedValueDiscriminant.create(category, discriminant); }
@Override public ValueDiscriminantPair<Boolean, Double> evaluateWithDiscriminant( final InputType input) { // Evaluate the input as a double whose sign is the category. final double value = this.evaluateAsDouble(input); final boolean category = value >= 0.0; // The discriminant needs to be larger for a better match, even in // the case of the false category, which requires doing an absolute // value to the sign. final double discriminant = category ? value : -value; return DefaultWeightedValueDiscriminant.create(category, discriminant); }
@Override public ValueDiscriminantPair<Boolean, Double> evaluateWithDiscriminant( final InputType input) { // Evaluate the input as a double whose sign is the category. final double value = this.evaluateAsDouble(input); final boolean category = value >= 0.0; // The discriminant needs to be larger for a better match, even in // the case of the false category, which requires doing an absolute // value to the sign. final double discriminant = category ? value : -value; return DefaultWeightedValueDiscriminant.create(category, discriminant); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final ObservationType input) { CategoryType maxCategory = null; double maxPosterior = Double.NEGATIVE_INFINITY; for( CategoryType category : this.getCategories() ) { double posterior = this.computePosterior(input, category); if( maxPosterior < posterior ) { maxPosterior = posterior; maxCategory = category; } } return DefaultWeightedValueDiscriminant.create(maxCategory, maxPosterior); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final ObservationType input) { CategoryType maxCategory = null; double maxPosterior = Double.NEGATIVE_INFINITY; for( CategoryType category : this.getCategories() ) { double posterior = this.computePosterior(input, category); if( maxPosterior < posterior ) { maxPosterior = posterior; maxCategory = category; } } return DefaultWeightedValueDiscriminant.create(maxCategory, maxPosterior); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final ObservationType input) { CategoryType maxCategory = null; double maxPosterior = Double.NEGATIVE_INFINITY; for( CategoryType category : this.getCategories() ) { double posterior = this.computePosterior(input, category); if( maxPosterior < posterior ) { maxPosterior = posterior; maxCategory = category; } } return DefaultWeightedValueDiscriminant.create(maxCategory, maxPosterior); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final Collection<InputType> input) { // compute the product of the class conditionals double maxPosterior = -1.0; CategoryType maxCategory = null; for (CategoryType category : this.getCategories()) { // Actually, this is only proportionate to the posterior // We would need to divide by the unconditional probability // of the inputs to compute the accordinng-to-Hoyle posterior. double posterior = this.computeConjuctiveProbability(input, category); if (maxPosterior < posterior) { maxPosterior = posterior; maxCategory = category; } } return DefaultWeightedValueDiscriminant.create(maxCategory, maxPosterior); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final Collection<InputType> input) { // compute the product of the class conditionals double maxPosterior = -1.0; CategoryType maxCategory = null; for (CategoryType category : this.getCategories()) { // Actually, this is only proportionate to the posterior // We would need to divide by the unconditional probability // of the inputs to compute the accordinng-to-Hoyle posterior. double posterior = this.computeConjuctiveProbability(input, category); if (maxPosterior < posterior) { maxPosterior = posterior; maxCategory = category; } } return DefaultWeightedValueDiscriminant.create(maxCategory, maxPosterior); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final Collection<InputType> input) { // compute the product of the class conditionals double maxPosterior = -1.0; CategoryType maxCategory = null; for (CategoryType category : this.getCategories()) { // Actually, this is only proportionate to the posterior // We would need to divide by the unconditional probability // of the inputs to compute the accordinng-to-Hoyle posterior. double posterior = this.computeConjuctiveProbability(input, category); if (maxPosterior < posterior) { maxPosterior = posterior; maxCategory = category; } } return DefaultWeightedValueDiscriminant.create(maxCategory, maxPosterior); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final InputType input) { // Get the vote distribution. final DefaultDataDistribution<CategoryType> votes = this.evaluateAsVotes(input); // Get the maximum value of the votes. final CategoryType bestCategory = votes.getMaxValueKey(); final double bestFraction = votes.getFraction(bestCategory); return DefaultWeightedValueDiscriminant.create( bestCategory, bestFraction); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final InputType input) { // Get the vote distribution. final DefaultDataDistribution<CategoryType> votes = this.evaluateAsVotes(input); // Get the maximum value of the votes. final CategoryType bestCategory = votes.getMaxValueKey(); final double bestFraction = votes.getFraction(bestCategory); return DefaultWeightedValueDiscriminant.create( bestCategory, bestFraction); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final InputType input) { // Get the vote distribution. final DefaultDataDistribution<CategoryType> votes = this.evaluateAsVotes(input); // Get the maximum value of the votes. final CategoryType bestCategory = votes.getMaxValueKey(); final double bestFraction = votes.getFraction(bestCategory); return DefaultWeightedValueDiscriminant.create( bestCategory, bestFraction); }
return DefaultWeightedValueDiscriminant.create( bestCategory, bestVotePercentage);
return DefaultWeightedValueDiscriminant.create( bestCategory, bestVotePercentage);
return DefaultWeightedValueDiscriminant.create( bestCategory, bestVotePercentage);
return DefaultWeightedValueDiscriminant.create( maxCategory, logMaximumLikelihood);
return DefaultWeightedValueDiscriminant.create( maxCategory, logMaximumLikelihood);
return DefaultWeightedValueDiscriminant.create( maxCategory, logMaximumLikelihood);