BaumWelch with Poisson?

January 16th, 2012

Home Forums General BaumWelch with Poisson?

This topic contains 3 replies, has 2 voices, and was last updated by  Baz 5 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #183

    osvir
    Member

    Hi,

    I am trying to use a Poisson distribution with the Baum Welch algorithm. However the constructor of BaumWelchAlgorithm requires a BatchLearner over Weighted values; and the Poisson only has a MaximumLikelihoodEstimator (not a WeightedMaximumLikelihoodEstimator like MultivariateGaussian.WeightedMaximumLikelihoodEstimator).

    Here is the code I am trying to use:

    HiddenMarkovModel hmm = new HiddenMarkovModel( DEFAULT_NUM_STATES );

    BaumWelchAlgorithm bwa = new BaumWelchAlgorithm(
    hmm,
    new PoissonDistribution.MaximumLikelihoodEstimator(),
    true );

    Any suggestions on getting BaumWelchAlgorithm to work with PoissonDistribution?

    Thanks

    #184

    Baz
    Member

    Hi,

    Good question. It does look like Poisson is missing a weighted Maximum Likelihood Estimator. I tried to put one together real quick:

    public static class WeightedMaximumLikelihoodEstimator
        extends AbstractCloneableSerializable
        implements DistributionWeightedEstimator<Number, PoissonDistribution%gt;
    {
    
        public WeightedMaximumLikelihoodEstimator()
        {
            super();
        }
    
        @Override
        public PoissonDistribution.PMF learn(
            final Collection< ? extends WeightedValue> data)
        {
            final double mean =
                UnivariateStatisticsUtil.computeWeightedMean(data);
            return new PoissonDistribution.PMF(mean);
        }
    }
    

    Let me know if that works for you.

    • This reply was modified 5 years, 7 months ago by  Baz.
    • This reply was modified 5 years, 7 months ago by  Baz.
    #185

    osvir
    Member

    This works, thanks! Please note that the code you pasted was reformatted by WordPress and it is missing some things when viewed in the browser. You have to view the page’s source to see the missing pieces. Example: the parts that are missing after “DistributionWeightedEstimator”.

    #188

    Baz
    Member

    Thanks for the heads-up. I edited the post to show the previously hidden generics part.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Comments are closed.