/** * Convenience method for creating a new * {@code DefaultWeightedValueDiscriminant} with the given value and weight. * * @param <ValueType> * The type of value to discriminate between. * @param value * The value for the pair. * @param weight * The weight that is to be used as the discriminant. * @return * A new discriminant object. */ public static <ValueType> DefaultWeightedValueDiscriminant<ValueType> create( final ValueType value, final double weight) { return new DefaultWeightedValueDiscriminant<ValueType>(value, weight); }
/** * Convenience method for creating a new * {@code DefaultWeightedValueDiscriminant} with the given value and weight. * * @param <ValueType> * The type of value to discriminate between. * @param value * The value for the pair. * @param weight * The weight that is to be used as the discriminant. * @return * A new discriminant object. */ public static <ValueType> DefaultWeightedValueDiscriminant<ValueType> create( final ValueType value, final double weight) { return new DefaultWeightedValueDiscriminant<ValueType>(value, weight); }
/** * Convenience method for creating a new * {@code DefaultWeightedValueDiscriminant} with the given value and weight. * * @param <ValueType> * The type of value to discriminate between. * @param value * The value for the pair. * @param weight * The weight that is to be used as the discriminant. * @return * A new discriminant object. */ public static <ValueType> DefaultWeightedValueDiscriminant<ValueType> create( final ValueType value, final double weight) { return new DefaultWeightedValueDiscriminant<ValueType>(value, weight); }
/** * Convenience method for creating a new * {@code DefaultWeightedValueDiscriminant} with a shallow copy of the given * the given value and weight. * * @param <ValueType> * The type of value to discriminate between. * @param other * The other value to make a shallow copy of. * @return * A new discriminant object. */ public static <ValueType> DefaultWeightedValueDiscriminant<ValueType> create( final WeightedValue<? extends ValueType> other) { return new DefaultWeightedValueDiscriminant<ValueType>( other.getValue(), other.getWeight()); }
/** * Convenience method for creating a new * {@code DefaultWeightedValueDiscriminant} with a shallow copy of the given * the given value and weight. * * @param <ValueType> * The type of value to discriminate between. * @param other * The other value to make a shallow copy of. * @return * A new discriminant object. */ public static <ValueType> DefaultWeightedValueDiscriminant<ValueType> create( final WeightedValue<? extends ValueType> other) { return new DefaultWeightedValueDiscriminant<ValueType>( other.getValue(), other.getWeight()); }
/** * Convenience method for creating a new * {@code DefaultWeightedValueDiscriminant} with a shallow copy of the given * the given value and weight. * * @param <ValueType> * The type of value to discriminate between. * @param other * The other value to make a shallow copy of. * @return * A new discriminant object. */ public static <ValueType> DefaultWeightedValueDiscriminant<ValueType> create( final WeightedValue<? extends ValueType> other) { return new DefaultWeightedValueDiscriminant<ValueType>( other.getValue(), other.getWeight()); }
return new DefaultWeightedValueDiscriminant<CategoryType>(best, bestValue);
return new DefaultWeightedValueDiscriminant<CategoryType>(best, bestValue);
return new DefaultWeightedValueDiscriminant<CategoryType>(best, bestValue);
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final Vectorizable input) { // Convert the input to a vector. final Vector inputVector = input.convertToVector(); // Find the category that has the highest match. double bestScore = 0.0; CategoryType bestCategory = null; for (CategoryType category : this.getCategories()) { final double score = this.evaluateAsDouble(inputVector, category); if (bestCategory == null || score > bestScore) { bestScore = score; bestCategory = category; } } // Return the discriminant for the category. return new DefaultWeightedValueDiscriminant<CategoryType>( bestCategory, bestScore); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final Vectorizable input) { // Convert the input to a vector. final Vector inputVector = input.convertToVector(); // Find the category that has the highest match. double bestScore = 0.0; CategoryType bestCategory = null; for (CategoryType category : this.getCategories()) { final double score = this.evaluateAsDouble(inputVector, category); if (bestCategory == null || score > bestScore) { bestScore = score; bestCategory = category; } } // Return the discriminant for the category. return new DefaultWeightedValueDiscriminant<CategoryType>( bestCategory, bestScore); }
@Override public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant( final Vectorizable input) { // Convert the input to a vector. final Vector inputVector = input.convertToVector(); // Find the category that has the highest match. double bestScore = 0.0; CategoryType bestCategory = null; for (CategoryType category : this.getCategories()) { final double score = this.evaluateAsDouble(inputVector, category); if (bestCategory == null || score > bestScore) { bestScore = score; bestCategory = category; } } // Return the discriminant for the category. return new DefaultWeightedValueDiscriminant<CategoryType>( bestCategory, bestScore); }
new DefaultWeightedValueDiscriminant<CategoryType>();
new DefaultWeightedValueDiscriminant<CategoryType>();
new DefaultWeightedValueDiscriminant<CategoryType>();
new DefaultWeightedValueDiscriminant<CategoryType>();
new DefaultWeightedValueDiscriminant<CategoryType>();
new DefaultWeightedValueDiscriminant<CategoryType>();