public class BinomialBayesianEstimator extends AbstractConjugatePriorBayesianEstimator<java.lang.Number,java.lang.Double,BinomialDistribution,BetaDistribution> implements ConjugatePriorBayesianEstimatorPredictor<java.lang.Number,java.lang.Double,BinomialDistribution,BetaDistribution>
Modifier and Type | Class and Description |
---|---|
static class |
BinomialBayesianEstimator.Parameter
Parameter of this relationship
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_N
Default n, 1.
|
parameter
Modifier | Constructor and Description |
---|---|
|
BinomialBayesianEstimator()
Creates a new instance of BinomialBayesianEstimator
|
protected |
BinomialBayesianEstimator(BayesianParameter<java.lang.Double,BinomialDistribution,BetaDistribution> parameter)
Creates a new instance of BinomialBayesianEstimator
|
|
BinomialBayesianEstimator(BinomialDistribution conditional,
BetaDistribution prior)
Creates a new instance of BinomialBayesianEstimator
|
|
BinomialBayesianEstimator(int n)
Creates a new instance of BinomialBayesianEstimator
|
|
BinomialBayesianEstimator(int n,
BetaDistribution prior)
Creates a new instance of BinomialBayesianEstimator
|
Modifier and Type | Method and Description |
---|---|
BinomialBayesianEstimator |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
double |
computeEquivalentSampleSize(BetaDistribution belief)
Computes the equivalent sample size of using the given prior.
|
BinomialBayesianEstimator.Parameter |
createParameter(BinomialDistribution conditional,
BetaDistribution prior)
Creates a parameter linking the conditional and prior distributions
|
BetaBinomialDistribution |
createPredictiveDistribution(BetaDistribution posterior)
Creates the predictive distribution of new data given the posterior.
|
int |
getN()
Gets the number of samples in the experiment
|
void |
setN(int n)
Sets the number of samples in the experiment
|
void |
update(BetaDistribution target,
java.lang.Number data)
The
update method updates an object of ResultType using
the given new data of type DataType , using some form of
"learning" algorithm. |
createConditionalDistribution, createInitialLearnedObject, getInitialBelief, getParameter, setParameter
learn, learn, update
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createConditionalDistribution, getParameter
learn
createInitialLearnedObject, update
public static final int DEFAULT_N
public BinomialBayesianEstimator()
public BinomialBayesianEstimator(int n)
n
- Samples in the experiment, must be greater than zeropublic BinomialBayesianEstimator(int n, BetaDistribution prior)
n
- Samples in the experiment, must be greater than zeroprior
- Conjugate prior of the conditional for the parameterpublic BinomialBayesianEstimator(BinomialDistribution conditional, BetaDistribution prior)
conditional
- Distribution that generates the observationsprior
- Conjugate prior of the conditional for the parameterprotected BinomialBayesianEstimator(BayesianParameter<java.lang.Double,BinomialDistribution,BetaDistribution> parameter)
parameter
- Parameter that describes the relationship between the conditional and
the conjugate priorpublic BinomialBayesianEstimator.Parameter createParameter(BinomialDistribution conditional, BetaDistribution prior)
ConjugatePriorBayesianEstimator
createParameter
in interface ConjugatePriorBayesianEstimator<java.lang.Number,java.lang.Double,BinomialDistribution,BetaDistribution>
conditional
- Distribution from which observations are generatedprior
- Distribution that generates parameters for the conditionalpublic BinomialBayesianEstimator clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CloneableSerializable
clone
in class AbstractConjugatePriorBayesianEstimator<java.lang.Number,java.lang.Double,BinomialDistribution,BetaDistribution>
public void update(BetaDistribution target, java.lang.Number data)
IncrementalLearner
update
method updates an object of ResultType
using
the given new data of type DataType
, using some form of
"learning" algorithm.update
in interface IncrementalLearner<java.lang.Number,BetaDistribution>
target
- The object to update.data
- The new data for the learning algorithm to use to update
the object.public double computeEquivalentSampleSize(BetaDistribution belief)
ConjugatePriorBayesianEstimator
computeEquivalentSampleSize
in interface ConjugatePriorBayesianEstimator<java.lang.Number,java.lang.Double,BinomialDistribution,BetaDistribution>
belief
- Prior belief to measure.public BetaBinomialDistribution createPredictiveDistribution(BetaDistribution posterior)
BayesianEstimatorPredictor
createPredictiveDistribution
in interface BayesianEstimatorPredictor<java.lang.Number,java.lang.Double,BetaDistribution>
posterior
- Posterior distribution from which to compute the predictive posterior.public int getN()
public void setN(int n)
n
- Samples in the experiment, must be greater than zero