InputType
- Input type of the InputOutputPairs
@CodeReview(reviewer="Kevin R. Dixon", date="2008-07-23", changesNeeded=false, comments={"Added PublicationReference to the original article.","Minor changes to javadoc.","Looks fine."}) @PublicationReference(author={"Thilo-Thomas Friess","Nello Cristianini","Colin Campbell"}, title="The Kernel-Adatron Algorithm: A Fast and Simple Learning Procedure for Support Vector Machines", type=Conference, publication="Proceedings of the Fifteenth International Conference on Machine Learning", year=1998, pages={188,196}) public class KernelAdatron<InputType> extends AbstractAnytimeSupervisedBatchLearner<InputType,java.lang.Boolean,KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>>> implements MeasurablePerformanceAlgorithm
KernelAdatron
class implements an online version of the Support
Vector Machine learning algorithm. It is based on an extension of the
Perceptron algorithm.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ITERATIONS
The default maximum number of iterations, 100.
|
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
KernelAdatron()
Creates a new instance of KernelAdatron.
|
KernelAdatron(Kernel<? super InputType> kernel)
Creates a new KernelAdatron with the given kernel.
|
KernelAdatron(Kernel<? super InputType> kernel,
int maxIterations)
Creates a new KernelAdatron with the given kernel and maximum number
of iterations.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanupAlgorithm()
Called to clean up the learning algorithm's state after learning has
finished.
|
int |
getErrorCount()
Gets the error count of the most recent iteration.
|
Kernel<? super InputType> |
getKernel()
Gets the kernel to use.
|
NamedValue<java.lang.Integer> |
getPerformance()
Gets the name-value pair that describes the current performance of the
algorithm.
|
KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>> |
getResult()
Gets the current result of the algorithm.
|
protected java.util.LinkedHashMap<InputOutputPair<? extends InputType,java.lang.Boolean>,DefaultWeightedValue<InputType>> |
getSupportsMap()
Gets the mapping of examples to weight objects (support vectors).
|
protected boolean |
initializeAlgorithm()
Called to initialize the learning algorithm's state based on the
data that is stored in the data field.
|
protected void |
setErrorCount(int errorCount)
Sets the error count of the most recent iteration.
|
void |
setKernel(Kernel<? super InputType> kernel)
Sets the kernel to use.
|
protected void |
setLearned(KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>> result)
Sets the object currently being result.
|
protected void |
setSupportsMap(java.util.LinkedHashMap<InputOutputPair<? extends InputType,java.lang.Boolean>,DefaultWeightedValue<InputType>> supportsMap)
Gets the mapping of examples to weight objects (support vectors).
|
protected boolean |
step()
Called to take a single step of the learning algorithm.
|
clone, getData, getKeepGoing, learn, setData, setKeepGoing, stop
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
learn
clone
getMaxIterations, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid
public static final int DEFAULT_MAX_ITERATIONS
public KernelAdatron()
public KernelAdatron(Kernel<? super InputType> kernel)
kernel
- The kernel to use.protected boolean initializeAlgorithm()
AbstractAnytimeBatchLearner
initializeAlgorithm
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>>>
protected boolean step()
AbstractAnytimeBatchLearner
step
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>>>
protected void cleanupAlgorithm()
AbstractAnytimeBatchLearner
cleanupAlgorithm
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends InputOutputPair<? extends InputType,java.lang.Boolean>>,KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>>>
public Kernel<? super InputType> getKernel()
public void setKernel(Kernel<? super InputType> kernel)
kernel
- The kernel to use.public KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>> getResult()
AnytimeAlgorithm
getResult
in interface AnytimeAlgorithm<KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>>>
protected void setLearned(KernelBinaryCategorizer<InputType,DefaultWeightedValue<InputType>> result)
result
- The object currently being result.public int getErrorCount()
protected void setErrorCount(int errorCount)
errorCount
- The current error count.protected java.util.LinkedHashMap<InputOutputPair<? extends InputType,java.lang.Boolean>,DefaultWeightedValue<InputType>> getSupportsMap()
protected void setSupportsMap(java.util.LinkedHashMap<InputOutputPair<? extends InputType,java.lang.Boolean>,DefaultWeightedValue<InputType>> supportsMap)
supportsMap
- The mapping of examples to weight objects.public NamedValue<java.lang.Integer> getPerformance()
MeasurablePerformanceAlgorithm
getPerformance
in interface MeasurablePerformanceAlgorithm