Class GmeansSamplingFactory<I extends INumericLabeledAttributeArrayInstance<? extends java.lang.Number>,D extends IDataset<I>>
- java.lang.Object
-
- ai.libs.jaicore.ml.core.dataset.sampling.inmemory.factories.GmeansSamplingFactory<I,D>
-
- All Implemented Interfaces:
IRerunnableSamplingAlgorithmFactory<I,D,GmeansSampling<I,D>>,ISamplingAlgorithmFactory<I,D,GmeansSampling<I,D>>
public class GmeansSamplingFactory<I extends INumericLabeledAttributeArrayInstance<? extends java.lang.Number>,D extends IDataset<I>> extends java.lang.Object implements IRerunnableSamplingAlgorithmFactory<I,D,GmeansSampling<I,D>>
-
-
Constructor Summary
Constructors Constructor Description GmeansSamplingFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GmeansSampling<I,D>getAlgorithm(int sampleSize, D inputDataset, java.util.Random random)After the necessary config is done, this method returns a fully configured instance of a sampling algorithm.voidsetClusterSeed(long clusterSeed)Set the seed the clustering will use for initialization.voidsetDistanceMeassure(org.apache.commons.math3.ml.distance.DistanceMeasure distanceMeassure)Set the distance measure for the clustering.voidsetPreviousRun(GmeansSampling<I,D> previousRun)Set the previous run of the sampling algorithm, if one occurred, can be set here to get data from it.
-
-
-
Method Detail
-
setPreviousRun
public void setPreviousRun(GmeansSampling<I,D> previousRun)
Description copied from interface:IRerunnableSamplingAlgorithmFactorySet the previous run of the sampling algorithm, if one occurred, can be set here to get data from it.- Specified by:
setPreviousRunin interfaceIRerunnableSamplingAlgorithmFactory<I extends INumericLabeledAttributeArrayInstance<? extends java.lang.Number>,D extends IDataset<I>,GmeansSampling<I extends INumericLabeledAttributeArrayInstance<? extends java.lang.Number>,D extends IDataset<I>>>- Parameters:
previousRun- Algorithm object of the previous of the sampling algorithm.
-
setClusterSeed
public void setClusterSeed(long clusterSeed)
Set the seed the clustering will use for initialization. Default is without a fix seed and the system time instead.- Parameters:
clusterSeed-
-
setDistanceMeassure
public void setDistanceMeassure(org.apache.commons.math3.ml.distance.DistanceMeasure distanceMeassure)
Set the distance measure for the clustering. Default is the Manhattan distance.- Parameters:
distanceMeassure-
-
getAlgorithm
public GmeansSampling<I,D> getAlgorithm(int sampleSize, D inputDataset, java.util.Random random)
Description copied from interface:ISamplingAlgorithmFactoryAfter the necessary config is done, this method returns a fully configured instance of a sampling algorithm.- Specified by:
getAlgorithmin interfaceISamplingAlgorithmFactory<I extends INumericLabeledAttributeArrayInstance<? extends java.lang.Number>,D extends IDataset<I>,GmeansSampling<I extends INumericLabeledAttributeArrayInstance<? extends java.lang.Number>,D extends IDataset<I>>>- Parameters:
sampleSize- Desired size of the sample that will be created.inputDataset- Dataset where the sample will be drawn from.random- Random object to make samples reproducible.- Returns:
- Configured sampling algorithm object.
-
-