gov.sandia.cognition.learning.function.categorization
Class DefaultKernelBinaryCategorizer<InputType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.categorization.AbstractBinaryCategorizer<InputType>
          extended by gov.sandia.cognition.learning.function.categorization.AbstractDiscriminantBinaryCategorizer<InputType>
              extended by gov.sandia.cognition.learning.function.categorization.KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>>
                  extended by gov.sandia.cognition.learning.function.categorization.DefaultKernelBinaryCategorizer<InputType>
Type Parameters:
InputType - The input type for the categorizer.
All Implemented Interfaces:
Evaluator<InputType,Boolean>, BinaryCategorizer<InputType>, Categorizer<InputType,Boolean>, DiscriminantBinaryCategorizer<InputType>, DiscriminantCategorizer<InputType,Boolean,Double>, ThresholdBinaryCategorizer<InputType>, KernelContainer<InputType>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
Forgetron.Result

public class DefaultKernelBinaryCategorizer<InputType>
extends KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>>

A default implementation of the KernelBinaryCategorizer that uses the standard way of representing the examples (supports) using a DefaultWeightedValue.

Since:
3.2.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.sandia.cognition.learning.function.categorization.KernelBinaryCategorizer
bias, DEFAULT_BIAS, examples, kernel
 
Fields inherited from class gov.sandia.cognition.learning.function.categorization.AbstractBinaryCategorizer
BINARY_CATEGORIES
 
Constructor Summary
DefaultKernelBinaryCategorizer()
          Creates a new DefaultKernelBinaryCategorizer with a null kernel, no examples, and a zero bias.
DefaultKernelBinaryCategorizer(Kernel<? super InputType> kernel)
          Creates a new DefaultKernelBinaryCategorizer with the given kernel, no examples, and a zero bias.
DefaultKernelBinaryCategorizer(Kernel<? super InputType> kernel, Collection<DefaultWeightedValue<InputType>> examples, double bias)
          Creates a new DefaultKernelBinaryCategorizer with the given parameters.
 
Method Summary
 void add(InputType value, double weight)
          Adds a new example of the given value with the given weight.
 DefaultWeightedValue<InputType> get(int i)
          Gets the i-th example.
 int getExampleCount()
          Returns the number of examples (supports) in the categorizer.
 DefaultWeightedValue<InputType> remove(int i)
          Removes the i-th example.
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.KernelBinaryCategorizer
evaluateAsDouble, getBias, getExamples, getKernel, getThreshold, setBias, setExamples, setKernel, setThreshold
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.AbstractDiscriminantBinaryCategorizer
evaluate, evaluateWithDiscriminant
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.AbstractBinaryCategorizer
getCategories
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.learning.function.categorization.DiscriminantCategorizer
evaluateWithDiscriminant
 
Methods inherited from interface gov.sandia.cognition.learning.function.categorization.Categorizer
getCategories
 
Methods inherited from interface gov.sandia.cognition.evaluator.Evaluator
evaluate
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Constructor Detail

DefaultKernelBinaryCategorizer

public DefaultKernelBinaryCategorizer()
Creates a new DefaultKernelBinaryCategorizer with a null kernel, no examples, and a zero bias.


DefaultKernelBinaryCategorizer

public DefaultKernelBinaryCategorizer(Kernel<? super InputType> kernel)
Creates a new DefaultKernelBinaryCategorizer with the given kernel, no examples, and a zero bias.

Parameters:
kernel - The kernel to use.

DefaultKernelBinaryCategorizer

public DefaultKernelBinaryCategorizer(Kernel<? super InputType> kernel,
                                      Collection<DefaultWeightedValue<InputType>> examples,
                                      double bias)
Creates a new DefaultKernelBinaryCategorizer with the given parameters.

Parameters:
kernel - The kernel to use.
examples - The collection of examples to use.
bias - The bias term.
Method Detail

add

public void add(InputType value,
                double weight)
Adds a new example of the given value with the given weight.

Parameters:
value - The value to add.
weight - The weight for the value.

get

public DefaultWeightedValue<InputType> get(int i)
Gets the i-th example.

Parameters:
i - The 0-based index of the example to get.
Returns:
The example at the i-th position

remove

public DefaultWeightedValue<InputType> remove(int i)
Removes the i-th example. May not be supported by some collection types.

Parameters:
i - The 0-based index of the example to remove.
Returns:
The item that was removed.

getExampleCount

public int getExampleCount()
Returns the number of examples (supports) in the categorizer.

Returns:
The number of examples (supports) in the categorizer.