org.debellor.base
Class KMeans
java.lang.Object
org.debellor.core.Cell
org.debellor.base.KMeans
public class KMeans
- extends Cell
Stream implementation of standard k-means clustering algorithm.
Can be trained on large data without risk of memory overflow.
- Author:
- Marcin Wojnarski
| Methods inherited from class org.debellor.core.Cell |
close, erase, getAvailableParams, getParameters, learn, newThread, newThread, next, onErase, open, openInputStream, set, set, set, set, setAvailableParams, setParameters, setRandomSeed, setSource, state, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
KMeans
public KMeans()
onLearn
protected void onLearn()
throws java.lang.Exception
- Description copied from class:
Cell
- Learning procedure of the cell.
For example, may train the internal decision model;
read and buffer input data; calculate an evaluation measure of another cell;
calculate data-driven parameters of a preprocessing algorithm
(e.g. attribute means for normalization algorithm) etc.
Called by
Cell.learn().
Must be overridden in all subclasses that implement trainable cells.
If your cell is not trainable, you must provide this information
to the Cell base class by calling Cell.Cell(boolean)
instead of Cell.Cell() in your constructor.
Overriders may safely assume that the cell is in Cell.State.EMPTY state
when onLearn is called - this is guaranteed by
implementation of learn().
- Overrides:
onLearn in class Cell
- Throws:
java.lang.Exception
onOpen
protected Sample.SampleType onOpen()
throws java.lang.Exception
- Description copied from class:
Cell
- Called by
Cell.open(). Performs the actual opening of
communication session,
while open checks only against access violation and handles exceptions.
Must be overridden in subclasses if open is to be used.
Overriders may assume that the cell is in Cell.State.CLOSED state.
- Overrides:
onOpen in class Cell
- Throws:
java.lang.Exception
onNext
protected Sample onNext()
throws java.lang.Exception
- Description copied from class:
Cell
- Called by
Cell.Stream.next(). Performs the actual generation of the next output sample,
while Stream.next() checks only against access violation and handles exceptions.
Must be overridden in the subclass if next is to be used, i.e.
if the subclass should generate some output data.
Overriders may assume that the cell is in Cell.State.OPEN state.
- Overrides:
onNext in class Cell
- Throws:
java.lang.Exception
onClose
protected void onClose()
throws java.lang.Exception
- Description copied from class:
Cell
- Called by
Cell.Stream.close(). Performs the actual closing of
communication session,
while close checks only against access violation and handles exceptions.
Must be overridden in subclasses if close is to be used.
Usually the overrider will use onClose to release resources,
to let them be garbage-collected.
Overriders may assume that the cell is in Cell.State.OPEN state.
- Overrides:
onClose in class Cell
- Throws:
java.lang.Exception