Class GMeansStratifier

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

    public class GMeansStratifier
    extends ClusterStratiAssigner
    implements IStratifier
    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
      GMeansStratifier​(int randomSeed)
      Constructor for GMeansStratiAmountSelectorAndAssigner with Manhattan distanceMeasure as a default.
      GMeansStratifier​(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
      int createStrati​(org.api4.java.ai.ml.core.dataset.IDataset<?> dataset)
      Prepares the stratification technique but does not assign instances to strati.
      • 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
      • Methods inherited from interface ai.libs.jaicore.ml.core.filter.sampling.inmemory.stratified.sampling.IStratifier

        getStratum
    • Constructor Detail

      • GMeansStratifier

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

        public GMeansStratifier​(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

      • createStrati

        public int createStrati​(org.api4.java.ai.ml.core.dataset.IDataset<?> dataset)
        Description copied from interface: IStratifier
        Prepares the stratification technique but does not assign instances to strati.
        Specified by:
        createStrati in interface IStratifier
        Returns:
        The number of strati for the given dataset