gov.sandia.cognition.learning.function.categorization.AbstractDiscriminantCategorizer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cognitive-foundry Show documentation
Show all versions of cognitive-foundry Show documentation
A single jar with all the Cognitive Foundry components.
/*
* 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();
}
}