This repository has been archived by the owner on Nov 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-540: Add an Example for BaumWelchLearning(TDistribution, TObservat…
…ion, TOptions) Class
- Loading branch information
1 parent
bfe5e2c
commit 9140baf
Showing
3 changed files
with
81 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
Sources/Accord.Statistics/Models/Markov/Learning/BaumWelchLearning`3.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Accord Statistics Library | ||
// The Accord.NET Framework | ||
// http://accord-framework.net | ||
// | ||
// Copyright © César Souza, 2009-2017 | ||
// cesarsouza at gmail.com | ||
// | ||
// This library is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU Lesser General Public | ||
// License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// | ||
// This library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public | ||
// License along with this library; if not, write to the Free Software | ||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
// | ||
|
||
namespace Accord.Statistics.Models.Markov.Learning | ||
{ | ||
using Accord.Statistics.Models.Markov; | ||
using Accord.Statistics.Distributions; | ||
using Accord.Statistics.Distributions.Fitting; | ||
|
||
/// <summary> | ||
/// Baum-Welch learning algorithms for learning Hidden Markov Models. | ||
/// </summary> | ||
/// | ||
/// <typeparam name="TDistribution">The type of the emission distributions in the model.</typeparam> | ||
/// <typeparam name="TObservation">The type of the observations (i.e. int for a discrete model).</typeparam> | ||
/// <typeparam name="TOptions">The type of fitting options accepted by this distribution.</typeparam> | ||
/// | ||
/// <remarks> | ||
/// Please see the <see cref="BaumWelchLearning{TDistribution, TObservation}"/> documentation page for | ||
/// the actual documentation of this class, including examples. | ||
/// </remarks> | ||
/// | ||
public class BaumWelchLearning<TDistribution, TObservation, TOptions> : | ||
BaseBaumWelchLearningOptions<HiddenMarkovModel<TDistribution, TObservation>, TDistribution, TObservation, TOptions>, | ||
IConvergenceLearning | ||
where TDistribution : IFittableDistribution<TObservation, TOptions> | ||
where TOptions : class, IFittingOptions, new() | ||
{ | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BaumWelchLearning{TDistribution, TObservation, TOptions}"/> class. | ||
/// </summary> | ||
/// | ||
public BaumWelchLearning() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="BaumWelchLearning{TDistribution, TObservation, TOptions}"/> class. | ||
/// </summary> | ||
/// | ||
/// <param name="model">The model to be learned.</param> | ||
/// | ||
public BaumWelchLearning(HiddenMarkovModel<TDistribution, TObservation> model) | ||
: base(model) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Creates an instance of the model to be learned. Inheritors of this abstract | ||
/// class must define this method so new models can be created from the training data. | ||
/// </summary> | ||
/// | ||
protected override HiddenMarkovModel<TDistribution, TObservation> Create() | ||
{ | ||
return new HiddenMarkovModel<TDistribution, TObservation>(Topology, Emissions); | ||
} | ||
|
||
} | ||
} |