org.encog.ml.kmeans

## Class BasicCluster

- java.lang.Object
- - org.encog.ml.kmeans.BasicCluster

- All Implemented Interfaces:
    MLCluster

      public class BasicCluster
      extends Object
      implements MLCluster

  Holds a cluster of MLData items that have been clustered by the KMeansClustering class.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicCluster(Cluster<BasicMLDataPair> cluster)` Construct a cluster from another.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(MLData pair)` Add to the cluster.
    `MLDataSet` | `createDataSet()` Create a dataset from the clustered data.
    `MLData` | `get(int pos)` Get the specified data item by index.
    `Centroid<?>` | `getCentroid()`
    `List<MLData>` | `getData()`
    `void` | `remove(MLData pair)` Remove the specified item.
    `void` | `setCentroid(BasicMLDataPairCentroid c)` Set the centroid.
    `int` | `size()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BasicCluster

          public BasicCluster(Cluster<BasicMLDataPair> cluster)

      Construct a cluster from another.
      Parameters:
        `cluster` - The other cluster.

  - ### Method Detail

    - #### add

          public final void add(MLData pair)

      Add to the cluster.
      Specified by:
        `add` in interface `MLCluster`
      Parameters:
        `pair` - The pair to add.

    - #### createDataSet

          public final MLDataSet createDataSet()

      Create a dataset from the clustered data.
      Specified by:
        `createDataSet` in interface `MLCluster`
      Returns:
        The dataset.

    - #### get

          public final MLData get(int pos)

      Get the specified data item by index.
      Specified by:
        `get` in interface `MLCluster`
      Parameters:
        `pos` - The index of the data item to get.
      Returns:
        The data item.

    - #### getCentroid

          public final Centroid<?> getCentroid()

      Returns:
        The centroid.

    - #### getData

          public final List<MLData> getData()

      Specified by:
        `getData` in interface `MLCluster`
      Returns:
        The data in this cluster.

    - #### remove

          public final void remove(MLData pair)

      Remove the specified item.
      Specified by:
        `remove` in interface `MLCluster`
      Parameters:
        `pair` - The item to remove.

    - #### setCentroid

          public final void setCentroid(BasicMLDataPairCentroid c)

      Set the centroid.
      Parameters:
        `c` - The new centroid.

    - #### size

          public final int size()

      Specified by:
        `size` in interface `MLCluster`
      Returns:
        The number of items.

Copyright © 2014. All Rights Reserved.