Class GMeansStratiAmountSelectorAndAssigner
- java.lang.Object
-
- ai.libs.jaicore.ml.core.filter.sampling.inmemory.stratified.sampling.ClusterStratiAssigner
-
- ai.libs.jaicore.ml.core.filter.sampling.inmemory.stratified.sampling.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.
-
-
Field Summary
-
Fields inherited from class ai.libs.jaicore.ml.core.filter.sampling.inmemory.stratified.sampling.ClusterStratiAssigner
distanceMeasure, randomSeed
-
-
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 voidinit(org.api4.java.ai.ml.core.dataset.IDataset<?> dataset, int stratiAmount)Initialize custom assigner if necessary.intselectStratiAmount(org.api4.java.ai.ml.core.dataset.IDataset<?> dataset)Select a suitable amount of strati for a Dataset.-
Methods inherited from class ai.libs.jaicore.ml.core.filter.sampling.inmemory.stratified.sampling.ClusterStratiAssigner
assignToStrati, getClusters, getNumCPUs, setClusters, setDataset, 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:IStratiAmountSelectorSelect a suitable amount of strati for a Dataset.- Specified by:
selectStratiAmountin interfaceIStratiAmountSelector- 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:IStratiAssignerInitialize custom assigner if necessary.- Specified by:
initin interfaceIStratiAssigner- Parameters:
dataset- The dataset the datapoints will be sampled from.stratiAmount- The predetermined amount of strati the dataset will be stratified into.
-
-