Showing posts with label introduction. Show all posts
Showing posts with label introduction. Show all posts

Thursday, May 26, 2011

Paper Summary - A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition

Summary:
This summary also functions as a very rough and basic introduction to HMMs for myself. This accounts for the different format and subsequent length of this entry.


Overview
In this paper, Rabiner provides a tutorial on hidden Markov models and how they may be applied to the area of speech recognition. A hidden Markov model (HMM) is a stochastic signal model, meaning that the signals can be well characterized as parametric random processes. Rabiner provides a formal look at discrete Markov processes with the example of predicting the weather for a week. The example is roughly as follows:

Taken from author's paper.
Any day it may be raining, cloudy, or sunny (so 3 possible states). For a given day t, the matrix of state transition probabilities is as shown to the right. Given that it is sunny (state 3) on the first day, we define an observation sequence O as O ={S3, S3, S3, S1, S1, S3, S2, S3}, and wish to determine its probability. As Rabiner states in his paper, the following expression and evaluation shows the probability for this observation sequence:
Taken from author's paper. Determining the probability for the weather.

In this example the states are observable, physical events. Hidden processes, however, often exist in problems that by definition lack observable processes. In such instances the result of a process can be known but not the process itself. Therefore the problem becomes finding an accurate model for the observed sequence of results. This is where building an HMM to explain the observed sequence comes into play. See Rabiner's paper for two initial examples that can be modeled with an HMM.

Three Basic Problems for HMMs
There are three basic problems that must be solved for an HMM to be of use.

Problem 1 - Given a sequence of observations and a model, how do you compute the probability that the model produced the observed sequence? An efficient procedure for solving this problem is known as the forward-backward procedure. This procedure is based on the lattice structure of states. Given N states, each change from one state to another will again result in one of these N states. Therefore, calculating the probability of a partial observation sequence up to a given time can be somewhat reduced to calculating the probabilities along the connections between states for a given time. (Note: You are much better off reading up on the procedure than trusting my summary).

Problem 2 - Given a sequence of observations and a model, how do you get a state sequence which is optimal in a meaningful way? In most instances, you may be interested in finding the single best state sequence. The Viterbi Algorithm uses dynamic programming to do so. Again, a lattice structure effectively illustrates the process. (Note: Read up on the process because I'm not rehashing it here).

Problem 3 - How do you optimize model parameters to best describe a given sequence of observations? Rabiner states that this is the most difficult problem of HMMs. He focuses on the Baum-Welch method for finding a locally maximized probability for an observation sequence with a chosen model. In essence, it can be used to find unknown parameters. (Note: You should read up on that as well).

Types of HMMs
Taken from author's paper. Also, not Figure 7.
The basic problem explanations and walkthroughs that Rabiner provides are based on a fully connected HMM. Also known as ergodic, such HMMs allow for any state to reach any other in finite number of steps. There are, however, different types of HMMs that may be encountered. Rabiner discusses the three HMMs as shown to the right.

With Rabiner's focus on speech recognition, he now brings up the issue of monitoring continuous signals as opposed to discrete symbols that are measured at set intervals or times. With continuous observations, the probability density function must be restricted to insure that parameters can be reestimated consistently. (Note: This process is best left for your own reading).


Discussion:
Rabiner's look at continuous signals in speech recognition is relevant for BCI research. When sensor data is being generated continuously (and from 14 points if you're using the EPOC), something has to be done to make sense of the information in polynomial time. In particular, a researcher may want to know what signal sequence led up to an observed state, or how best to classify a set of signals from various sensors. HMM-based classification has previously been researched and you can find different publications on the subject by performing a simple online search (a few examples being found here and here). As for Rabiner's paper itself, I stopped summarizing around page 12 of 30 because I needed to read it through a couple times before I understood anything beyond that point. A mathematically rigorous paper is the foundation of solid research projects in many fields, but give me an applications paper any day. As is evident from my summary, I identified more with Rabiner's examples than with his equations, and as such I basically avoided their reproduction here in this entry. Also, I found that the Wikipedia entry on HMMs was beneficial for getting more examples and quickly examining the key problems as stated by Rabiner.

Full Reference:
Rabiner, L.R.: A tutorial on Hidden Markov Models and selected applications in speech recognition. Proceedings of the IEEE (1989).

Tuesday, May 17, 2011

The Emotiv EPOC - Introduction

Overview:
I am using the Emotiv EPOC neuroheadset with the Education Edition SDK. The headset and this SDK run at $2500 together. I recommend this version if you are conducting research that is a) non-commercial and (optionally) b) open to multiple collaborators within your department. And you will also need to be at some form of academic or education institute. Emotiv offers 6 different SDKs to choose from, including the FREE SDKLite. Read up and choose the one that is right for you or your organization.

Why the Emotiv EPOC?
I chose to use the EPOC for my research for a few different reasons. First, it has 14 electrodes and can also measure head rotation. The more you can measure, the more you can do with the signals (well hopefully). The EPOC can be trained to detect conscious thoughts, emotions, and facial expressions. The provided Control Panel is great for viewing sensor contacts, doing some basic training, and just getting acquainted with the headset. The first time you put on the headset and hook it up to the computer, you will feel awesome. Or at least I felt awesome.
The white outer box is essentially a layer of paper.
Electroencephalographic (EEG) signals are fluctuations of electrical potential along the scalp created by neurons in the brain. EEG signals can thus be measured outside the brain itself in a non-invasive way via wearable headsets.The EPOC is one such headset. A very brief comparison of current consumer headsets is available on Wikipedia. More information on BCIs and how EEG fits within the field can also be found on Wikipedia.

Contents unpacked.

Out of the box
The EPOC comes in a flimsy box that in no way made me feel comfortable with my choice. Upon opening, however, you will find that everything is securely packed. My box contained a headset, a small bottle of solution, a case containing the 16 sensors, a charger, and the Bluetooth connector. Additional sensor packs and headsets can be purchased from the Emotiv Store.

Obtaining the SDK
The software that is available through the Education Edition DOES NOT come in the box. It is available for download, linked to the purchaser's email address, from the Emotiv website. This can be a slight pain in the ass to obtain, but I can say from experience that the Customer Care personnel are both patient and timely in their responses. In my case it took 5 days of correspondence (and a lot of confusion) before I was given access to the Education Edition SDK. If you have a departmental purchasing officer, please do the following to avoid any issues:
  • Don't Panic.
  • Have the purchaser forward you all emails received from Emotiv about the purchase made. This includes order number (which is actually order ID) and confirmations.
  • When you register on the Emotiv site, use your departmental email address. They will check that the emails between purchaser and researcher match (i.e., department.school.edu). Again, the SDK is licensed to your department and not your entire university.
  • Do not take everything they say literally. For example, if they ask for the order number, it might not be the thing labeled 'order number' Or if they ask for your school's email ID, they really want your department's email ID that will match the purchaser.
The person who helped me was awesome, and I naively assume that everyone in Emotiv's employ is equally awesome.

First Things First!
Make sure that your headset turns on before you do anything. If it is not holding a slight charge, then simply plug it in and give it a few minutes. Red light is charging, green light is charged. If you get a blue light when you flip the switch (located on the bottom rear of the headband), then you are set. Once you know the headset turns on, read the digital manual and begin finding that perfectly frustrating level of solution needed for proper conductivity.