Advertisement
cesarsouza

Specifying regularization options for Gaussian HMM fitting

Jul 15th, 2011
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1.     // Create a degenerate problem
  2.     double[][] sequences = new double[][]
  3.     {
  4.         new double[] { 1,1,1,1,1,0,1,1,1,1 },
  5.         new double[] { 1,1,1,1,0,1,1,1,1,1 },
  6.         new double[] { 1,1,1,1,1,1,1,1,1,1 },
  7.         new double[] { 1,1,1,1,1,1         },
  8.         new double[] { 1,1,1,1,1,1,1       },
  9.         new double[] { 1,1,1,1,1,1,1,1,1,1 },
  10.         new double[] { 1,1,1,1,1,1,1,1,1,1 },
  11.     };
  12.  
  13.     // Creates a continuous hidden Markov Model with two states organized in a ergodic
  14.     //  topology and an underlying multivariate Normal distribution as density.
  15.     var density = new Accord.Statistics.Distributions.Multivariate.NormalDistribution(1);
  16.     ContinuousHiddenMarkovModel model = new ContinuousHiddenMarkovModel(new Ergodic(2), density);
  17.  
  18.     // Configure the learning algorithms to train the sequence classifier
  19.     ContinuousBaumWelchLearning teacher = new ContinuousBaumWelchLearning(model)
  20.     {
  21.         Tolerance = 0.0001,
  22.         Iterations = 0,
  23.  
  24.         // Configure options for fitting the normal distribution
  25.         FittingOptions = new NormalOptions() { Regularization = 0.0001, }
  26.     };
  27.  
  28.     // Fit the model. No exceptions will be thrown
  29.     double likelihood = teacher.Run(sequences);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement