Click here to Skip to main content
15,891,316 members
Articles / Programming Languages / C#

Sequence Classifiers in C# - Part I: Hidden Markov Models

Rate me:
Please Sign up or sign in to vote.
4.95/5 (86 votes)
3 Dec 2014CPOL22 min read 328.2K   11.1K   155  
Let's understand hidden Markov models before taking a step into hidden conditional random fields.
This article aims to present the reader to the current workings of the Accord.NET Machine Learning Framework; show where the sequences classifiers are located within the framework, describe their source code, how the Markov namespace is organized and the general ideas behind this organization. This will also provide the base to talk about Hidden Conditional Random Fields, which is my main goal in this series.
using System;
using System.CodeDom.Compiler;
using System.Runtime.InteropServices;

namespace Gestures.Native
{

    /// <summary>
    ///   Native Win32 methods.
    /// </summary>
    /// 
    internal static partial class NativeMethods
    {

        [DllImport("dwmapi.dll", PreserveSig = false)]
        [return: MarshalAs(UnmanagedType.Bool)]
        internal static extern void DwmExtendFrameIntoClientArea(IntPtr hwnd, ref ThemeMargins margins);

        [DllImport("dwmapi.dll", PreserveSig = false)]
        [return: MarshalAs(UnmanagedType.Bool)]
        internal static extern bool DwmIsCompositionEnabled();

    }

    /// <summary>
    ///   MARGINS structure (Windows).
    /// </summary>
    /// 
    /// <remarks>
    ///   Returned by the GetThemeMargins function to define the 
    ///   margins of windows that have visual styles applied.
    ///   
    ///   http://msdn.microsoft.com/en-us/library/windows/desktop/bb773244(v=vs.85).aspx
    /// </remarks>
    /// 
    [StructLayout(LayoutKind.Sequential)]
    [GeneratedCode("PInvoke", "1.0.0.0")]
    public struct ThemeMargins
    {
        /// <summary>
        ///   Width of the left border that retains its size.
        /// </summary>
        /// 
        public int LeftWidth;

        /// <summary>
        ///   Width of the right border that retains its size.
        /// </summary>
        /// 
        public int RightWidth;

        /// <summary>
        ///   Height of the top border that retains its size.
        /// </summary>
        /// 
        public int TopHeight;

        /// <summary>
        ///   Height of the bottom border that retains its size.
        /// </summary>
        /// 
        public int BottomHeight;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer NAVER LABS Europe
France France
Computer and technology enthusiast, interested in artificial intelligence and image processing. Has a Master's degree on Computer Science specialized on Image and Signal Processing, with expertise on Machine Learning, Computer Vision, Pattern Recognition and Data Mining systems. Author of the Accord.NET Framework for developing scientific computing applications.

If you would like to hire good developers to build your dream application, please check out DaitanGroup, one of the top outsourcing companies in Brazil. This company, located in Brazil's Sillicon Valley but with US-based offices, has huge experience developing telecommunications software for large and small companies worldwide.

Comments and Discussions