Class GMeansStratiAmountSelectorAndAssigner

  • All Implemented Interfaces:
    IStratiAmountSelector, IStratiAssigner, org.api4.java.common.control.IParallelizable

    public class GMeansStratiAmountSelectorAndAssigner
    extends ClusterStratiAssigner
    implements IStratiAmountSelector
    Combined strati amount selector and strati assigner via g-means. IT can be used in 3 combinations: 1) Amount Selector and Strati Assigner: A g-means clustering is initially performed to select a strati amount via the amount of found clusters and to assign datapoints with this clusters afterwards. 2) Amount Selector: A g-means clustering is initially performed to select a suitable strati amount with the amount of found clusters. 3) Strati Assigner: Since the amount of strati is selected with another component g-means cannot be used and k-means will be used to be conform with the given strati amount. It is recommended to use combination 1, because only using this component for only one of the two tasks could yield in inconsistent results.
    • Constructor Summary

      Constructors 
      Constructor Description
      GMeansStratiAmountSelectorAndAssigner​(int randomSeed)
      Constructor for GMeansStratiAmountSelectorAndAssigner with Manhattan distanceMeasure as a default.
      GMeansStratiAmountSelectorAndAssigner​(org.apache.commons.math3.ml.distance.DistanceMeasure distanceMeasure, int randomSeed)
      Constructor for GMeansStratiAmountSelectorAndAssigner with custom distanceMeasure.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void init​(org.api4.java.ai.ml.core.dataset.IDataset<?> dataset, int stratiAmount)
      Initialize custom assigner if necessary.
      int selectStratiAmount​(org.api4.java.ai.ml.core.dataset.IDataset<?> dataset)
      Select a suitable amount of strati for a Dataset.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.api4.java.common.control.IParallelizable

        getNumCPUs, setNumCPUs
    • Constructor Detail

      • GMeansStratiAmountSelectorAndAssigner

        public GMeansStratiAmountSelectorAndAssigner​(int randomSeed)
        Constructor for GMeansStratiAmountSelectorAndAssigner with Manhattan distanceMeasure as a default.
        Parameters:
        randomSeed - Seed for random numbers.
      • GMeansStratiAmountSelectorAndAssigner

        public GMeansStratiAmountSelectorAndAssigner​(org.apache.commons.math3.ml.distance.DistanceMeasure distanceMeasure,
                                                     int randomSeed)
        Constructor for GMeansStratiAmountSelectorAndAssigner with custom distanceMeasure.
        Parameters:
        distanceMeasure - Distance measure for datapoints, for example Manhattan or Euclidian.
        randomSeed - Seed for random numbers.
    • Method Detail

      • selectStratiAmount

        public int selectStratiAmount​(org.api4.java.ai.ml.core.dataset.IDataset<?> dataset)
        Description copied from interface: IStratiAmountSelector
        Select a suitable amount of strati for a Dataset.
        Specified by:
        selectStratiAmount in interface IStratiAmountSelector
        Parameters:
        dataset - The dataset that will be stratified.
        Returns:
        The determined amount of strati.
      • init

        public void init​(org.api4.java.ai.ml.core.dataset.IDataset<?> dataset,
                         int stratiAmount)
        Description copied from interface: IStratiAssigner
        Initialize custom assigner if necessary.
        Specified by:
        init in interface IStratiAssigner
        Parameters:
        dataset - The dataset the datapoints will be sampled from.
        stratiAmount - The predetermined amount of strati the dataset will be stratified into.