public static class ScalarMixtureDensityModel.EMLearner extends AbstractAnytimeBatchLearner<java.util.Collection<? extends java.lang.Double>,ScalarMixtureDensityModel> implements Randomized, DistributionEstimator<java.lang.Double,ScalarMixtureDensityModel>, MeasurablePerformanceAlgorithm
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ITERATIONS
Default max iterations, 100.
|
static double |
DEFAULT_TOLERANCE
Default tolerance, 1.0E-5.
|
static java.lang.String |
PERFORMANCE_NAME
Name of the performance measurement, "Assignment Change".
|
protected java.util.Random |
random
Random number generator.
|
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
EMLearner(int numClusters,
DistributionWeightedEstimator<java.lang.Double,? extends SmoothUnivariateDistribution> learner,
java.util.Random random)
Creates a new instance of EMLearner
|
EMLearner(java.util.Random random)
Default constructor
|
EMLearner(java.util.Random random,
java.util.Collection<? extends DistributionWeightedEstimator<java.lang.Double,? extends SmoothUnivariateDistribution>> learners)
Creates a new instance of EMLearner
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanupAlgorithm()
Called to clean up the learning algorithm's state after learning has
finished.
|
java.util.Collection<? extends DistributionWeightedEstimator<java.lang.Double,? extends SmoothUnivariateDistribution>> |
getLearners()
Getter for learners
|
NamedValue<java.lang.Double> |
getPerformance()
Gets the name-value pair that describes the current performance of the
algorithm.
|
java.util.Random |
getRandom()
Gets the random number generator used by this object.
|
ScalarMixtureDensityModel |
getResult()
Gets the current result of the algorithm.
|
double |
getTolerance()
Getter for tolerance
|
protected boolean |
initializeAlgorithm()
Called to initialize the learning algorithm's state based on the
data that is stored in the data field.
|
void |
setLearners(java.util.Collection<? extends DistributionWeightedEstimator<java.lang.Double,? extends SmoothUnivariateDistribution>> learners)
Setter for learners
|
void |
setRandom(java.util.Random random)
Sets the random number generator used by this object.
|
void |
setTolerance(double tolerance)
Setter for tolerance
|
protected boolean |
step()
Called to take a single step of the learning algorithm.
|
clone, getData, getKeepGoing, learn, setData, setKeepGoing, stop
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
learn
clone
getMaxIterations, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid
public static final java.lang.String PERFORMANCE_NAME
public static final int DEFAULT_MAX_ITERATIONS
public static final double DEFAULT_TOLERANCE
protected java.util.Random random
public EMLearner(java.util.Random random)
random
- Random number generatorpublic EMLearner(int numClusters, DistributionWeightedEstimator<java.lang.Double,? extends SmoothUnivariateDistribution> learner, java.util.Random random)
numClusters
- Number of components to estimatelearner
- Learner used for each componentrandom
- Random number generatorpublic EMLearner(java.util.Random random, java.util.Collection<? extends DistributionWeightedEstimator<java.lang.Double,? extends SmoothUnivariateDistribution>> learners)
learners
- Learner used for each componentrandom
- Random number generatorprotected boolean initializeAlgorithm()
AbstractAnytimeBatchLearner
initializeAlgorithm
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends java.lang.Double>,ScalarMixtureDensityModel>
protected boolean step()
AbstractAnytimeBatchLearner
step
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends java.lang.Double>,ScalarMixtureDensityModel>
protected void cleanupAlgorithm()
AbstractAnytimeBatchLearner
cleanupAlgorithm
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends java.lang.Double>,ScalarMixtureDensityModel>
public ScalarMixtureDensityModel getResult()
AnytimeAlgorithm
getResult
in interface AnytimeAlgorithm<ScalarMixtureDensityModel>
public NamedValue<java.lang.Double> getPerformance()
MeasurablePerformanceAlgorithm
getPerformance
in interface MeasurablePerformanceAlgorithm
public java.util.Random getRandom()
Randomized
getRandom
in interface Randomized
public void setRandom(java.util.Random random)
Randomized
setRandom
in interface Randomized
random
- The random number generator for this object to use.public java.util.Collection<? extends DistributionWeightedEstimator<java.lang.Double,? extends SmoothUnivariateDistribution>> getLearners()
public void setLearners(java.util.Collection<? extends DistributionWeightedEstimator<java.lang.Double,? extends SmoothUnivariateDistribution>> learners)
learners
- Collection of learners used to create each component.public double getTolerance()
public void setTolerance(double tolerance)
tolerance
- Tolerance before stopping, must be greater than or equal to 0