CategoryType
- The type of categories that the categorizer can output.public class LinearMultiCategorizer<CategoryType> extends AbstractCloneableSerializable implements DiscriminantCategorizer<Vectorizable,CategoryType,java.lang.Double>, VectorInputEvaluator<Vectorizable,CategoryType>
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<CategoryType,LinearBinaryCategorizer> |
prototypes
A map of each category to its prototype categorizer.
|
Constructor and Description |
---|
LinearMultiCategorizer()
Creates a new, empty
LinearMultiCategorizer . |
LinearMultiCategorizer(java.util.Map<CategoryType,LinearBinaryCategorizer> prototypes)
Creates a new
LinearMultiCategorizer with the given prototypes. |
Modifier and Type | Method and Description |
---|---|
LinearMultiCategorizer<CategoryType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
CategoryType |
evaluate(Vectorizable input)
Evaluates the function on the given input and returns the output.
|
double |
evaluateAsDouble(Vector input,
CategoryType category)
Evaluates how much the given input matches the prototype for the given
category.
|
double |
evaluateAsDouble(Vectorizable input,
CategoryType category)
Evaluates how much the given input matches the prototype for the given
category.
|
DefaultWeightedValueDiscriminant<CategoryType> |
evaluateWithDiscriminant(Vectorizable input)
Evaluate the categorizer on the given input to produce the expected
category plus a discriminant for later producing an ordering of how well
items fit into that category.
|
java.util.Set<? extends CategoryType> |
getCategories()
Gets the list of possible categories that the categorizer can produce.
|
int |
getInputDimensionality()
Gets the expected dimensionality of the input vector to the evaluator,
if it is known.
|
java.util.Map<CategoryType,LinearBinaryCategorizer> |
getPrototypes()
Gets the mapping of categories to prototypes.
|
void |
setPrototypes(java.util.Map<CategoryType,LinearBinaryCategorizer> prototypes)
Sets the mapping of categories to prototypes.
|
protected java.util.Map<CategoryType,LinearBinaryCategorizer> prototypes
public LinearMultiCategorizer()
LinearMultiCategorizer
.public LinearMultiCategorizer(java.util.Map<CategoryType,LinearBinaryCategorizer> prototypes)
LinearMultiCategorizer
with the given prototypes.prototypes
- The mapping of categories to prototypes.public LinearMultiCategorizer<CategoryType> clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public CategoryType evaluate(Vectorizable input)
Evaluator
evaluate
in interface Evaluator<Vectorizable,CategoryType>
input
- The input to evaluate.public DefaultWeightedValueDiscriminant<CategoryType> evaluateWithDiscriminant(Vectorizable input)
DiscriminantCategorizer
evaluateWithDiscriminant
in interface DiscriminantCategorizer<Vectorizable,CategoryType,java.lang.Double>
input
- The input value to categorize with a discriminatepublic double evaluateAsDouble(Vectorizable input, CategoryType category)
input
- The input.category
- The category to match the input against.public double evaluateAsDouble(Vector input, CategoryType category)
input
- The input.category
- The category to match the input against.public java.util.Set<? extends CategoryType> getCategories()
Categorizer
getCategories
in interface Categorizer<Vectorizable,CategoryType>
public int getInputDimensionality()
VectorInputEvaluator
getInputDimensionality
in interface VectorInputEvaluator<Vectorizable,CategoryType>
public java.util.Map<CategoryType,LinearBinaryCategorizer> getPrototypes()
public void setPrototypes(java.util.Map<CategoryType,LinearBinaryCategorizer> prototypes)
prototypes
- The mapping of categories to prototypes.