All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gov.sandia.cognition.learning.function.categorization.AbstractDiscriminantCategorizer Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
/*
 * File:                AbstractDiscriminantCategorizer.java
 * Authors:             Justin Basilico
 * Company:             Sandia National Laboratories
 * Project:             Cognitive Foundry Learning Core
 * 
 * Copyright February 03, 2011, Sandia Corporation.
 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 
 * license for use of this work by or on behalf of the U.S. Government. Export 
 * of this program may require a license from the United States Government. 
 */

package gov.sandia.cognition.learning.function.categorization;

import gov.sandia.cognition.learning.data.ValueDiscriminantPair;
import java.util.Set;

/**
 * An abstract implementation of the {@code DiscriminantCategorizer} interface.
 * It implements the evaluate method to call the evaluateWithDiscriminant
 * method.
 *
 * @param  
 *      The type of the input the categorizer can use.
 * @param  
 *      The type of category output by the categorizer.
 * @param 
 *      The type of discriminant that can be used to sort the output.
 * @author  Justin Basilico
 * @since   3.1
 */
public abstract class AbstractDiscriminantCategorizer>
    extends AbstractCategorizer
    implements DiscriminantCategorizer
{

    /**
     * Creates a new {@code AbstractDiscriminantCategorizer} with an empty
     * set of categories.
     */
    public AbstractDiscriminantCategorizer()
    {
        super();
    }

    /**
     * Creates a new {@code AbstractCategorizer} with the given category set.
     *
     * @param   categories
     *      The categories.
     */
    public AbstractDiscriminantCategorizer(
        final Set categories)
    {
        super(categories);
    }

    @Override
    public CategoryType evaluate(
        final InputType input)
    {
        // Evaluate as a value-discriminant pair and then get the value.
        final ValueDiscriminantPair discriminant =
            this.evaluateWithDiscriminant(input);
        return discriminant == null ? null : discriminant.getValue();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy