Taeuber's Paradox and the Life Expectancy Brick Wall by Kas Thomas
Simplicity is Wonderful, But Not a Requirement by James Hague
Yeah. I knew a professor who always want to rewrite speech recognition systems such that is easier for research. Ahh...... modern speech recognition systems are complex any way. Not making mistakes is already very hard. Not to say building a good research system which easy to use for everyone. (Remember, everyone has their different research goal.)
Arthur
Thursday, February 28, 2013
Monday, February 25, 2013
On sh*tty job.
I read "Why Hating Your Shitty Job Only Makes It Worse", there is something positive about the article but I can't completely agree with the authors.
Part of the dilemma at work in a traditional office space is that inevitably some kind of a*holes and bad system will appear in your life. The question is whether you want to ignore it or not. You should be keenly aware of your work condition and make rational decision of staying an leaving.
Arthur
Part of the dilemma at work in a traditional office space is that inevitably some kind of a*holes and bad system will appear in your life. The question is whether you want to ignore it or not. You should be keenly aware of your work condition and make rational decision of staying an leaving.
Arthur
Tuesday, February 19, 2013
Monday, February 18, 2013
A look on Sphinx3's initialization
I worked on Sphinx 3 a lot. In these days, it was generally regarded as an "old-style" recognizer as compared to Sphinx 4 and PocketSphinx. It is also not support officially by the SF's guys.
Coders of speech recognition think a little bit different. They usually stick to a certain codebase which they feel comfortable with. For me, it is not just a personal preference, it also reflects how much I know about a certain recognizer. For example, I know quite a bit of how Sphinx 3 performs. In these days, I tried to learn how Sphinx 4 fare as well. So far, if you ask me to choose an accurate recognizer, I will still probably choose Sphinx 3, not because the search technology is better (Sphinx 4 is way superior), but because it can easily made to support several advanced modeling types. This seems to be how the 2010 developer meeting concluded as well.
But that was just me. In fact, I am bullish on all Sphinx recognizers. One thing I want to note is the power of Sphinx 4 in development. There are many projects are based on Sphinx 4. In these days, if you want to get a job on speech recognizer, knowing Sphinx 4 is probably a good ticket. That's why I am quite keen on learning it more so hopefully I can write on both recognizers more.
In any case, this is a Sphinx 3's article. I will probably write more on each components. Feel free to comments.
Arthur
Coders of speech recognition think a little bit different. They usually stick to a certain codebase which they feel comfortable with. For me, it is not just a personal preference, it also reflects how much I know about a certain recognizer. For example, I know quite a bit of how Sphinx 3 performs. In these days, I tried to learn how Sphinx 4 fare as well. So far, if you ask me to choose an accurate recognizer, I will still probably choose Sphinx 3, not because the search technology is better (Sphinx 4 is way superior), but because it can easily made to support several advanced modeling types. This seems to be how the 2010 developer meeting concluded as well.
But that was just me. In fact, I am bullish on all Sphinx recognizers. One thing I want to note is the power of Sphinx 4 in development. There are many projects are based on Sphinx 4. In these days, if you want to get a job on speech recognizer, knowing Sphinx 4 is probably a good ticket. That's why I am quite keen on learning it more so hopefully I can write on both recognizers more.
In any case, this is a Sphinx 3's article. I will probably write more on each components. Feel free to comments.
How Sphinx3 is initialized:
Here is a listing of function used on how Sphinx 3 is initialized I got from Sphinx 3.0.8. Essentially, there are 3 layers of initialization, kb_init, kbcore_init and s3_am_init. Separating kb_init and kbcore_init probably starts very early in Sphinx 3. Whereas separating s3_am_init from kbcore_init was probably from me. (So all blames on me.) That is to support -hmmdir.
kb_init
-> kbcore_init (*)
-> beam_init
-> pl_init
-> fe_init
-> feat_array
-> stat_init
-> adapt_am_init
-> set operation mode
-> srch_init
kbcore_init
-> Look for feat.params very early on.
-> logmath_init
-> feat_init
-> s3_am_init (*)
-> cmn_init
-> dict_init
-> misc. models init
mgau_init such as
-> subvq_init
-> gs_read
-> lmset_init
-> fillpen_init
-> dict2pid_build <- Should put into search
s3_am_init
-> read_lda
-> read in mdef.
-> depends on -senmgau type
.cont. mgau_init
.s2semi. s2_semi_mgau_init
if (-kdtree)
s2_semi_mgau_load_kdtree
.semi or .s3cont.
ms_mgau_init
-> tmat_init
Note:
- -hmmdir override all other sub-parameters.
Arthur
Toning down on Blogging......
Guess I was too confident again to build up this site. Once again I feel work took me much time and couldn't work on this blog soon.
It also depends on whether my work are something camera-ready. Currently I have couple of articles which are ready to hash out but need some refinement.
Let's see if I can come back for month a month later. For now, you might see a lot of filler materials on this blog.
Arthur
It also depends on whether my work are something camera-ready. Currently I have couple of articles which are ready to hash out but need some refinement.
Let's see if I can come back for month a month later. For now, you might see a lot of filler materials on this blog.
Arthur
Saturday, February 16, 2013
Friday, February 15, 2013
Wednesday, February 13, 2013
Tuesday, February 12, 2013
Readings at Feb 12, 2013
After couple of days of snow shoveling. Finally back to business
Computer program roots out ancestors of modern tongues
Computer program roots out ancestors of modern tongues
Wednesday, February 06, 2013
Readings at Feb 6, 2013
Employees leave Manager Not Companies Well said.
Caffeine Jitters As a programmer, I found drinking any caffeinated drinks anti-productive. In the short-term, coke, coffee or power drinks gave you a kick. In long term, they are debilitating and cause you feel tired.
I think Dave is the guy who taught me to drink tea at CMU, I haven't changed this habit since.
Arthur
Caffeine Jitters As a programmer, I found drinking any caffeinated drinks anti-productive. In the short-term, coke, coffee or power drinks gave you a kick. In long term, they are debilitating and cause you feel tired.
I think Dave is the guy who taught me to drink tea at CMU, I haven't changed this habit since.
Arthur
Tuesday, February 05, 2013
Should we go to College?
Reading James Altucher's "I Was Blind But Now I See", he made a controversial point: don't send kids into college. Before you throw stuffs, his point is sophisticated. You would think you could refute him by saying "What about profession such as lawyer and doctor?" But then Altucher counters that to be a professional, you just need to read the right book and ask the right question to the right people. It is difficult to refute : say if you want to learn programming, taking a university course and getting credits don't really help that much. Working on an open source project or an internship does. On speech recognition, classes may be useful but at the end of the day, reading papers, or generally talking with experts in the field is the real help.
So what is the meaning of University then? Though I have many friends who have graduate degrees and I have a master myself, I do appreciate Altucher's point. Because what he said highlight some of my doubt about the college education system. e.g. Is a person really smarter after 5 years of college education? Do they learn better? Does it worth the $50000 debt? When I look at many of my friends, for most of the time, the answer is no. The truth is for many who want to learn, they will seek out college education after they have some experience. They actively seek for knowledge they lack of. On the other hand, when I look at many of my PhD friends, they either have no motivation to learn nor their duty gives them no time to learn. It is a pity.
I believe learning is a life-long issue and it should be independent to any institutions.
Arthur
Monday, February 04, 2013
Thursday, January 31, 2013
January 2013 Write-up
Miraculously, I still have some momentum for this blog and I have kept on the daily posting schedule.
Here is a write up for this month: Feel free to look at this post on how I plan to write this blog:
Some Vision of the Grand Janitor's Blog
SphinxTrain1.07's bw:
Commentary on SphinxTrain1.07's bw (Part I)
Commentary on SphinxTrain1.07's bw (Part II)
Part I describes the high-level layout, Part II and describe half the state network was built.
Others:
Acoustic Score and Its Sign
Subword Units and their Occasionally Non-Trivial Meanings
Sphinx4:
Sphinx 4 from a C background : Material for Learning
Goldman Sachs not Liable
Aaron Swartz......
Enjoy!
Arthur
Here is a write up for this month: Feel free to look at this post on how I plan to write this blog:
Some Vision of the Grand Janitor's Blog
Sphinx' Tutorials and Commentaries
SphinxTrain1.07's bw:
Commentary on SphinxTrain1.07's bw (Part I)
Commentary on SphinxTrain1.07's bw (Part II)
Part I describes the high-level layout, Part II and describe half the state network was built.
Others:
Acoustic Score and Its Sign
Subword Units and their Occasionally Non-Trivial Meanings
Sphinx4:
Sphinx 4 from a C background : Material for Learning
News
Goldman Sachs not Liable
Aaron Swartz......
Other writings:
On Kurzweil : a perspective of an ASR practitionerEnjoy!
Arthur
Goldman Sachs not Liable
Here is the Bloomberg's piece. Sounds like it's a real case closed.
Of course, we are all still feeling the consequences.
Arthur
Of course, we are all still feeling the consequences.
Arthur
Wednesday, January 30, 2013
Speech-related Readings at Jan 30, 2013
Amazon acquired Ivona:
I am aware of Amazon's involvement in ASR. Though it's a question on the domain.
Goldman-Dragon Trial:
I simply hope Dr. Baker has a closure on the whole thing. In fact, when you think about it, the whole L&H fallout is the reason why the ASR industry has a virtual monopoly now. So if you are interested in ASR, you should be concerned.
Arthur
I am aware of Amazon's involvement in ASR. Though it's a question on the domain.
Goldman-Dragon Trial:
I simply hope Dr. Baker has a closure on the whole thing. In fact, when you think about it, the whole L&H fallout is the reason why the ASR industry has a virtual monopoly now. So if you are interested in ASR, you should be concerned.
Arthur
Tuesday, January 29, 2013
Subword Units and their Occasionally Non-Trivial Meanings
While I was writing the next article on bw, I found myself forget the meaning of different type of subword units (i.e phones, biphones, diphones, triphones and such). So I decide to write a little note.
On this kind of topics, someone would likely to come up and say "X always mean Y bla bla bla etc and so on." My view (and hope) is that the wording of a certain should reflect what it means. So when I hear a term and can come up with multiple definition in your head, I would say the naming convention is a little bit broken.
Phones vs Phonemes
Linguist distinguish between phoneme and phone The former usually means a kind of abstract categorization of a sound, whereas the latter usually mean the actual realization of a sound.
In a decoder though, what you see most is the term phone.
(Ref here) " ..... one important difference between the two units. Biphones are understood tobe just left or right context dependent (mono)phones. On the other hand, diphones represent the transition regions that strech between the two ”centres” of the subsequent phones. "
For most of the time, it means considering both left and right context. Possible combinations N^3.
Quinphones
For most of the time, it means considering both the two left and two right contexts. Possible combinations N^5.
I guess what I don't feel comfortable are terms such as "Quadphones". Even quinphones and heptaphones can potentially means different things from time-to-time.
On this kind of topics, someone would likely to come up and say "X always mean Y bla bla bla etc and so on." My view (and hope) is that the wording of a certain should reflect what it means. So when I hear a term and can come up with multiple definition in your head, I would say the naming convention is a little bit broken.
Phones vs Phonemes
Linguist distinguish between phoneme and phone The former usually means a kind of abstract categorization of a sound, whereas the latter usually mean the actual realization of a sound.
In a decoder though, what you see most is the term phone.
Biphones vs Diphones
(Ref here) " ..... one important difference between the two units. Biphones are understood tobe just left or right context dependent (mono)phones. On the other hand, diphones represent the transition regions that strech between the two ”centres” of the subsequent phones. "
So that's why there can be left-biphone and right-biphone. Diphones is intuitively better in synthesis.
Possible combination of left-biphones/right-biphones/diphones are all N^2. With N equals to the number of phones.
Btw, the link I gave also has a term called "bi-diphone", which I don't think it's a standard term.
Triphones
For most of the time, it means considering both left and right context. Possible combinations N^3.
Quinphones
For most of the time, it means considering both the two left and two right contexts. Possible combinations N^5.
Heptaphones
For most of the time, it means considering both three left and three right contexts. Possible combinations N^7.
"Quadphones" and Other possible confusions in terminology.
I guess what I don't feel comfortable are terms such as "Quadphones". Even quinphones and heptaphones can potentially means different things from time-to-time.
For example, if you look at LID literature, occasionally, you will see the term quadphone. But it seems the term "phone 4-gram" (or more correctly quadgram...... if you think too much,) might be a nicer choice.
Then there is how the context looks like: 2 left 1 right? 1 right 2 left? Come to think of it, this terminology is confusing for even triphones because we can also mean a phone depend on 2 left or 2 right phones. ASR people don't feel that ways probably because of a well-established convention. Of course, the same can be said for quinphone and hetaphones.
Arthur
Monday, January 28, 2013
Readings at Jan 28, 2013
Tools of the Trade : Mainly an iOS article but it has many tools on maintaining contacts, task lists and requests.
C11 : I have no idea C99 tried to implement variable length array. It's certainly not very successful in the past 10 years..... Another great book to check out is Ning's C book.
How to make iPhone App that actually sells : Again, probably not just for iOS but generally for writing free/shareware.
Bayesian vs Non-Bayesian: Nice post. I don't fully grok Bayesian/Non-Bayesian but if you know better, they are essentially two schools of thoughts. (ASR? The whole training process starts from a flat-start, you figure.)
C11 : I have no idea C99 tried to implement variable length array. It's certainly not very successful in the past 10 years..... Another great book to check out is Ning's C book.
How to make iPhone App that actually sells : Again, probably not just for iOS but generally for writing free/shareware.
Bayesian vs Non-Bayesian: Nice post. I don't fully grok Bayesian/Non-Bayesian but if you know better, they are essentially two schools of thoughts. (ASR? The whole training process starts from a flat-start, you figure.)
Saturday, January 26, 2013
On Kurzweil : a perspective of an ASR practitioner
Many people who don't work on the fields of AI, NLP and ASR have heard of Kurzweil. To my surprise, many seem to give little thought on what he said and just follow his theory wholeheartedly.
In this post, I just want to comment on one single little thing, which is whether real-time speech-to-speech translation can be achieved in 2010s. This is a very specific prediction from Kurzweil's book "The Singularity is Near".
My discussion would mainly focus on ASR first. So even though my examples below are not exactly pure ASR systems, I will skip the long winding wording of saying "ASR of System X". And to be frank, MT and Response system probably goes through similar torturous development process anyway. So, please, don't tell me that "System X is actually ASR + Y", that sort of besides the point.
Oh well, you probably ask why bother, don't we have a demo of real-time speech-to-speech translation from Microsoft already?
True, but if you observe the demo carefully, it is based on read speech. I don't want to speculate much but I doubt it is a generic language model which wasn't tuned to the lecture. In a nutshell, I disbelieve it is something you can use it in real-life.
Let's think of a more real-life example: Siri, are we really getting 100% correct response now? (Not to boil down to ASR WER ...... yet) I don't think so. Even with adaptation, I don't think Siri understand what I said every single time. For most of the time, I follow the unofficial command list of Siri, let it improve with adaptation..... but still, it is not perfect.
Why? It is the hard cold reality: ASR is still not perfect, with all the advancement in HMM-based speech recognition. All the key technologies we know in the last 20 years: CMLLR, MMIE, MPE, fMPE, DMT, consensus network, multipass decodings, SAT, SAT with MMIE or all the nicest front-ends, all the engineerings. Nope, we are not yet having a feel-good accuracy. Indeed, human speech recognition is not 0% WER neither but for some reasons, the current state-of-the-art ASR performance is not reaching there.
And Siri, we all know is the state-of-the-art.
Just digress a little bit: Now most of the critics when they write to this point, will then lament that "oh, there is just some invisible barrier out there and human just couldn't make a Tower Babel, blabla....". I believe most of these "critics" have absolutely no ideas what they are talking about. To identify these air-head critics, just try to see if they put "cognitive science" into the articles, then you don't know they never work on real-life ASR system.
I, on the hand, do believe one day we can get there. Why? Because when people work on one of these speech recognition evaluation tasks, many would tell you : given a certain test set and with enough time and gumption, you would be able to create a system without any errors. So to me, it is more of an issue of whether some guys grinding on the problem, but not feasibility issue.
So where are we now in ASR? Recently, In ICASSP 2012, a Google paper, trained 87 thousand hour of data. That is probably the largest scale of training I know. Oh well, where are we now? 10%. Go down from 12%. So the last big experiment I know, it's probably the 3000 hours experiment back in 2006-7. The Google authors are probably using a tougher test set. So the initial recognition rate was yet again lower.
Okay, speculation time. So let's assume, that human can always collect 10 times more labelled data for every 6-7 years AND we can do an AM training on them. When will we go to have say 2% WER on the current Google test set? If we just think of very simple linear interpolation. It will take 4 * 6 years = 24 years to collect 10000 times more data (or 8 billion hour of data). So we are way-way past the 2010s deadline from Kurzweil.
And that's a wild speculation. Computation resources probably will work out itself by that time. What I doubt most is whether the progress would be linear.
Of course, it might be non-linearly better too. But here is another point: it's not just about the training set, it's about the test set. If we truly want a recognizer to work for *everyone* in the planet, then the very right thing to do is test your recognizer on our whole population. If we can't then you want to sample enough human speech to represent the Earth's population, the current test set might not be representative enough. So it is possible that when we increase our test set, we found that the initial recognition rate has go down again. And it seems to me our test set is still in the state of mimicking human population.
My discussion so far are mostly on acoustic model. On the language model side, the problem will mainly on domain specificity. Also bear in mind, human language can evolve. So, say we want to build a system which build a customized language model for each human being in the planet. At a particular moment of time, you might not be able to get enough data to build such a language model.
For me, the point of the whole discussion is that ASR is an engineering system, not some idealistic discussion topic. There will always be tradeoff. You may say: "What if a certain technology Y emerge in the next 50 years?" I heard that a lot Y could be quantum computing or brain simulation or brain-human interface or machine implementation of brain. Guys..... those, I got to admit are very smart idea in our time, and give it another 30-40 years, we might see something useful. For now, ASR really has nothing to do with them. I never heard of machine implementation of the audio cortex, or even an accurate construction of audio pathway. Nor, there is an easy progress of dissecting mammal inner ear and bring understanding on what's going on in human ear. From what I know, we seem to know some, but there are lots of other things we don't know.
That's why I think it's better to buckle down and just to try to work out our stuffs. Meaning, try to come up with more interesting mathematical model, try to come up with more computational efficient method. Those .... I think are meaningful discussion. As for Kurzweil, no doubt he is a very smart guy, but at least on ASR, I don't think he knows what he talks about.
Of course, I am certainly not the only person who complains Kurzweil. Look at how Douglas Hofstadter's criticism:
"It’s as if you took a lot of very good food and some dog excrement and blended it all up so that you can't possibly figure out what's good or bad. It's an intimate mixture of rubbish and good ideas, and it's very hard to disentangle the two, because these are smart people; they're not stupid."
Sounds like very reasonable to me.
Arthur
In this post, I just want to comment on one single little thing, which is whether real-time speech-to-speech translation can be achieved in 2010s. This is a very specific prediction from Kurzweil's book "The Singularity is Near".
My discussion would mainly focus on ASR first. So even though my examples below are not exactly pure ASR systems, I will skip the long winding wording of saying "ASR of System X". And to be frank, MT and Response system probably goes through similar torturous development process anyway. So, please, don't tell me that "System X is actually ASR + Y", that sort of besides the point.
Oh well, you probably ask why bother, don't we have a demo of real-time speech-to-speech translation from Microsoft already?
True, but if you observe the demo carefully, it is based on read speech. I don't want to speculate much but I doubt it is a generic language model which wasn't tuned to the lecture. In a nutshell, I disbelieve it is something you can use it in real-life.
Let's think of a more real-life example: Siri, are we really getting 100% correct response now? (Not to boil down to ASR WER ...... yet) I don't think so. Even with adaptation, I don't think Siri understand what I said every single time. For most of the time, I follow the unofficial command list of Siri, let it improve with adaptation..... but still, it is not perfect.
Why? It is the hard cold reality: ASR is still not perfect, with all the advancement in HMM-based speech recognition. All the key technologies we know in the last 20 years: CMLLR, MMIE, MPE, fMPE, DMT, consensus network, multipass decodings, SAT, SAT with MMIE or all the nicest front-ends, all the engineerings. Nope, we are not yet having a feel-good accuracy. Indeed, human speech recognition is not 0% WER neither but for some reasons, the current state-of-the-art ASR performance is not reaching there.
And Siri, we all know is the state-of-the-art.
Just digress a little bit: Now most of the critics when they write to this point, will then lament that "oh, there is just some invisible barrier out there and human just couldn't make a Tower Babel, blabla....". I believe most of these "critics" have absolutely no ideas what they are talking about. To identify these air-head critics, just try to see if they put "cognitive science" into the articles, then you don't know they never work on real-life ASR system.
I, on the hand, do believe one day we can get there. Why? Because when people work on one of these speech recognition evaluation tasks, many would tell you : given a certain test set and with enough time and gumption, you would be able to create a system without any errors. So to me, it is more of an issue of whether some guys grinding on the problem, but not feasibility issue.
So where are we now in ASR? Recently, In ICASSP 2012, a Google paper, trained 87 thousand hour of data. That is probably the largest scale of training I know. Oh well, where are we now? 10%. Go down from 12%. So the last big experiment I know, it's probably the 3000 hours experiment back in 2006-7. The Google authors are probably using a tougher test set. So the initial recognition rate was yet again lower.
Okay, speculation time. So let's assume, that human can always collect 10 times more labelled data for every 6-7 years AND we can do an AM training on them. When will we go to have say 2% WER on the current Google test set? If we just think of very simple linear interpolation. It will take 4 * 6 years = 24 years to collect 10000 times more data (or 8 billion hour of data). So we are way-way past the 2010s deadline from Kurzweil.
And that's a wild speculation. Computation resources probably will work out itself by that time. What I doubt most is whether the progress would be linear.
Of course, it might be non-linearly better too. But here is another point: it's not just about the training set, it's about the test set. If we truly want a recognizer to work for *everyone* in the planet, then the very right thing to do is test your recognizer on our whole population. If we can't then you want to sample enough human speech to represent the Earth's population, the current test set might not be representative enough. So it is possible that when we increase our test set, we found that the initial recognition rate has go down again. And it seems to me our test set is still in the state of mimicking human population.
My discussion so far are mostly on acoustic model. On the language model side, the problem will mainly on domain specificity. Also bear in mind, human language can evolve. So, say we want to build a system which build a customized language model for each human being in the planet. At a particular moment of time, you might not be able to get enough data to build such a language model.
For me, the point of the whole discussion is that ASR is an engineering system, not some idealistic discussion topic. There will always be tradeoff. You may say: "What if a certain technology Y emerge in the next 50 years?" I heard that a lot Y could be quantum computing or brain simulation or brain-human interface or machine implementation of brain. Guys..... those, I got to admit are very smart idea in our time, and give it another 30-40 years, we might see something useful. For now, ASR really has nothing to do with them. I never heard of machine implementation of the audio cortex, or even an accurate construction of audio pathway. Nor, there is an easy progress of dissecting mammal inner ear and bring understanding on what's going on in human ear. From what I know, we seem to know some, but there are lots of other things we don't know.
That's why I think it's better to buckle down and just to try to work out our stuffs. Meaning, try to come up with more interesting mathematical model, try to come up with more computational efficient method. Those .... I think are meaningful discussion. As for Kurzweil, no doubt he is a very smart guy, but at least on ASR, I don't think he knows what he talks about.
Of course, I am certainly not the only person who complains Kurzweil. Look at how Douglas Hofstadter's criticism:
"It’s as if you took a lot of very good food and some dog excrement and blended it all up so that you can't possibly figure out what's good or bad. It's an intimate mixture of rubbish and good ideas, and it's very hard to disentangle the two, because these are smart people; they're not stupid."
Sounds like very reasonable to me.
Arthur
Friday, January 25, 2013
Acoustic Score and Its Signness
Over the years, I got asked about why acoustic score could be a positive number all the time. That occasionally lead to a kind of big confusion from beginner users. So I write this article as a kind of road sign for people.
Acoustic score per frame is essentially the log value of continuous distribution function (cdf). In Sphinx's case, the cdf is a multi-dimensional Gaussian distribution. So Acoustic score per phone will be the log likelihood of the phone HMM. You can extend this definition to word HMM.
For the sign. If you think of a discrete probability distribution, then this acoustic score thingy should always be negative. (Because log of a decimal number is negative.) In the case of a Gaussian distribution though, when the standard deviation is small, it is possible that the value is larger than 1. (Also see this link). So those are the time you will see a positive value.
One thing you might feel disharmonious is the magnitude of the likelihood you see. Bear in mind, Sphinx2 or Sphinx3 are using a very small logbase. We are also talking about a multi-dimensional Gaussian distribution. It makes numerical values become bigger.
Arthur
Also see:
My answer on the Sphinx Forum
Acoustic score per frame is essentially the log value of continuous distribution function (cdf). In Sphinx's case, the cdf is a multi-dimensional Gaussian distribution. So Acoustic score per phone will be the log likelihood of the phone HMM. You can extend this definition to word HMM.
For the sign. If you think of a discrete probability distribution, then this acoustic score thingy should always be negative. (Because log of a decimal number is negative.) In the case of a Gaussian distribution though, when the standard deviation is small, it is possible that the value is larger than 1. (Also see this link). So those are the time you will see a positive value.
One thing you might feel disharmonious is the magnitude of the likelihood you see. Bear in mind, Sphinx2 or Sphinx3 are using a very small logbase. We are also talking about a multi-dimensional Gaussian distribution. It makes numerical values become bigger.
Arthur
Also see:
My answer on the Sphinx Forum
Thursday, January 24, 2013
Commentary on SphinxTrain1.07's bw (Part II : next_state_utt.c's First Half)
I will go on with the analysis of bw. In my last post, we understand the high-level structure of the bw program. So we now turns to the details of how the state lattice was built. Or how next_state_utt.c works.
As always, here is the standard disclaimer: this is another long and super technical post I only expect a small group of programmer with exoteric interest of Baum-Welch algorithm can read. It's not for faint of heart but if you understand the whole thing, you would have some basic but genuine understanding of Baum-Welch algorithm in real life.
The name of the module, next_state_utt.c, is quite unassuming but it is an important key of understanding the Baum-Welch algorithm. The way how the state lattice is structured affects how parameter estimation works. The same statement says for not only Baum-Welch estimation but also other estimation algorithm in speech.
But what so difficult about the coding the lattice? Here are two points I think it is worthwhile to point out:
Nothing fancy here. We first make a wordlist (mk_wordlist) , then make a phone list (mk_phone_list), then convert the phone list to triphone (cvt2triphones), then create the state sequence (state_seq_make).
Now before we go on, just at this level, you may already discover one issue of Sphinx's bw. It is using a list to represent phone models. So, let's assume if you want to model a certain word with multiple pronunciations, you probably can't do it without changing the code.
Another important thing to note: just like many non-WFST systems, it is not that easy to make a simple phoneme system with Sphinx. (HTK is an exception but you can always turn on a flag to expand context. Just look up the manual.) Say if you want to express your phoneme system to be one phoneme word, then you would want your dictionary look like:
AA AA
AE AE
B B
.
.
.
.
.
But then, if a word is a phone, should you actually want to build a network of cross-word triphones? You probably want to if you want to shoot for performance - all of the most accurate phoneme-based system has some sort of context-dependency there. (The Brno's recognizer probably has some, but I don't really grok why it is so good.)
But if you want to do your own interesting experiments, this fixed behavior may not suit your appetite. Maybe you just want to use a context-independent phone system for some toy experiments. But then, you are probably always building a triphone system. So, it might or might not be what you like.
So if you really want to trigger the CI-model behavior, what can you do? Take a look of my next post, in cvt2triphone.c, if the model definition file only specify CI states, then no triphone conversion will occur. In a way, that is to say the system assume if you just train the CI model, you will get the CI model but there is no explicit way to turn it off.
mk_wordlist
mk_wordlist is rather trivial:
With one line of transcripts, mk_wordlist transform it to an array of C-string. Memory of the string are allocated.
mk_phone_list
mk_phone_list is still trivial but there is a bit more detail.
In line 15-22:, we first look up the pronunciations of the words. (Remember, right now we can only look up one.) It then allocate the an array of phones with ID (in the type of acmod_id_t).
Now here is special part of the code, other the array of phones, it also allocate an array call "between word markers". So what's the mechanism? Let me give an example.
Suppose you have a transcript with word sequence "MY NAME IS CLINTON"
mk_word_list would create
mk_print_list (with my best guess of pronunciations) would create
So essentially it would indicate there is a word end at a certain phone.
I believe such as representation are for convenience purpose: it facilitate determination of whether a word is at the beginning, the middle or the end.
An alternative here is to do an optional silence. This, according to HTK handbook, usually reduce the WER slightly. It seems to be reasonable to figure out where the location of a phone is using silences as a marker.
Now, we used acmod_id_t in mk_phone_list, but what is it really? So let's take a detour of acmod_id_ds.t ("ds" stands for data structure.)
acmod_id_t is essentially a uint32, which is just a the size of unsigned integer or 2^32 -1. Why -1? Notice that MAX_CI_ACMOD was defined as 0xfe?
The more interesting part here: we saw ci_acmod_id_t is only a character type. This is obviously another problem here, in some languages, one may be interested to express it with more than 255 phones. (Why 255?)
We'll meet acmod_set a little bit more. But let us move on first - sometimes code tracing will be more motivated when you see the code before the data structure. Many suggest otherwise: Indeed, once you know the data, code will make more sense. But in practice, you will most likely read the code first and needs to connect things together. Thus IMO: both approach has their merit in code tracing.
As always, here is the standard disclaimer: this is another long and super technical post I only expect a small group of programmer with exoteric interest of Baum-Welch algorithm can read. It's not for faint of heart but if you understand the whole thing, you would have some basic but genuine understanding of Baum-Welch algorithm in real life.
The name of the module, next_state_utt.c, is quite unassuming but it is an important key of understanding the Baum-Welch algorithm. The way how the state lattice is structured affects how parameter estimation works. The same statement says for not only Baum-Welch estimation but also other estimation algorithm in speech.
But what so difficult about the coding the lattice? Here are two points I think it is worthwhile to point out:
- I guess an average programmer can probably work out a correct concatenation of all phone HMMs if all phones are context-independent in 3 days to 1 week. But in many advanced systems, most of them are using context-dependent phones. So you go to make sure at the right time, the right triphone state was used.
- In Sphinx, it got a bit more complicated because there is a distinction between positions of triphones. This is quite specific to Sphinx and you won't find it in systems such as HTK. So it further complicates coding. You will see in the following discussion, Sphinx has back off cases of position-dependent triphone estimation from time-to-time. In my view, it might not be too different from the position-independent triphone system. (It's certainly fun to read. :) )
My goal here is to analyze the next_state_utt.c, how it works and to state some part one can improve.
High-Level Layout of next_utt_state.c:
next_utt_state.c
-> mk_wordlist (mk_wordlist.c)
-> mk_phone_list (mk_phonelist.c)
-> cvt2triphone (cvt2triphone.c)
-> state_seq_make (state_seq_make.c)
Nothing fancy here. We first make a wordlist (mk_wordlist) , then make a phone list (mk_phone_list), then convert the phone list to triphone (cvt2triphones), then create the state sequence (state_seq_make).
Now before we go on, just at this level, you may already discover one issue of Sphinx's bw. It is using a list to represent phone models. So, let's assume if you want to model a certain word with multiple pronunciations, you probably can't do it without changing the code.
Another important thing to note: just like many non-WFST systems, it is not that easy to make a simple phoneme system with Sphinx. (HTK is an exception but you can always turn on a flag to expand context. Just look up the manual.) Say if you want to express your phoneme system to be one phoneme word, then you would want your dictionary look like:
AA AA
AE AE
B B
.
.
.
.
.
But then, if a word is a phone, should you actually want to build a network of cross-word triphones? You probably want to if you want to shoot for performance - all of the most accurate phoneme-based system has some sort of context-dependency there. (The Brno's recognizer probably has some, but I don't really grok why it is so good.)
But if you want to do your own interesting experiments, this fixed behavior may not suit your appetite. Maybe you just want to use a context-independent phone system for some toy experiments. But then, you are probably always building a triphone system. So, it might or might not be what you like.
So if you really want to trigger the CI-model behavior, what can you do? Take a look of my next post, in cvt2triphone.c, if the model definition file only specify CI states, then no triphone conversion will occur. In a way, that is to say the system assume if you just train the CI model, you will get the CI model but there is no explicit way to turn it off.
mk_wordlist
mk_wordlist is rather trivial:
char **mk_wordlist(char *str,
uint32 *n_word)
{
uint32 n_w;
uint32 i;
char **wl;
n_w = n_words(str);
wl = ckd_calloc(n_w, sizeof(char *));
wl[0] = strtok(str, " \t");
for (i = 1; i < n_w; i++) {
wl[i] = strtok(NULL, " \t");
}
assert(strtok(NULL, " \t") == NULL);
*n_word = n_w;
return wl;
}
With one line of transcripts, mk_wordlist transform it to an array of C-string. Memory of the string are allocated.
mk_phone_list
mk_phone_list is still trivial but there is a bit more detail.
1: acmod_id_t *mk_phone_list(char **btw_mark,
2: uint32 *n_phone,
3: char **word,
4: uint32 n_word,
5: lexicon_t *lex)
6: {
7: uint32 n_p;
8: lex_entry_t *e;
9: char *btw;
10: unsigned int i, j, k;
11: acmod_id_t *p;
12: /*
13: * Determine the # of phones in the sequence.
14: */
15: for (i = 0, n_p = 0; i < n_word; i++) {
16: e = lexicon_lookup(lex, word[i]);
17: if (e == NULL) {
18: E_WARN("Unable to lookup word '%s' in the lexicon\n", word[i]);
19: return NULL;
20: }
21: n_p += e->phone_cnt;
22: }
23: /*
24: * Allocate the phone sequence
25: */
26: p = ckd_calloc(n_p, sizeof(acmod_id_t));
27: /*
28: * Allocate the between word markers
29: */
30: btw = ckd_calloc(n_p, sizeof(char));
31: for (i = 0, k = 0; i < n_word; i++) { /* for each word */
32: e = lexicon_lookup(lex, word[i]);
33: if (e->phone_cnt == 0) /* Ignore words with no pronunciation */
34: continue;
35: for (j = 0; j < e->phone_cnt-1; j++, k++) { /* for all but the last phone in the word */
36: p[k] = e->ci_acmod_id[j];
37: }
38: p[k] = e->ci_acmod_id[j]; /* move over the last phone */
39: btw[k] = TRUE; /* mark word boundary following
40: kth phone */
41: ++k;
42: }
43: *btw_mark = btw;
44: *n_phone = n_p;
45: assert(k == n_p);
46: return p;
47: }
In line 15-22:, we first look up the pronunciations of the words. (Remember, right now we can only look up one.) It then allocate the an array of phones with ID (in the type of acmod_id_t).
Now here is special part of the code, other the array of phones, it also allocate an array call "between word markers". So what's the mechanism? Let me give an example.
Suppose you have a transcript with word sequence "MY NAME IS CLINTON"
mk_word_list would create
word[0] -> MY
word[1] -> NAME
word[2] -> IS
word[3] -> CLINTON
mk_print_list (with my best guess of pronunciations) would create
ph[0] -> M btw[0] -> 0
ph[1] -> AY btw[1] -> 1
ph[2] -> N btw[2] -> 0
ph[3] -> EY btw[3] -> 0
ph[4] -> M btw[4] -> 1
ph[5] -> IY btw[5] -> 0
ph[6] -> S btw[6] -> 1
ph[7] -> K btw[7] -> 0
ph[8] -> L btw[8] -> 0
ph[9] -> IY btw[9] -> 0
ph[10] -> N btw[10] -> 0
ph[11] -> T btw[11] -> 0
ph[12] -> AX btw[12] -> 0
pH[13] -> N btw[13] -> 1
So essentially it would indicate there is a word end at a certain phone.
I believe such as representation are for convenience purpose: it facilitate determination of whether a word is at the beginning, the middle or the end.
An alternative here is to do an optional silence. This, according to HTK handbook, usually reduce the WER slightly. It seems to be reasonable to figure out where the location of a phone is using silences as a marker.
A digression: acmod_id_t
1: typedef unsigned char ci_acmod_id_t;
2: #define NO_CI_ACMOD (0xff)
3: #define MAX_CI_ACMOD (0xfe)
4: typedef uint32 acmod_id_t;
5: #define NO_ACMOD (0xffffffff) /* The ID representing no acoustic
6: * model. */
7: #define MAX_ACMOD (0xfffffffe) /* The max ID possible */
Now, we used acmod_id_t in mk_phone_list, but what is it really? So let's take a detour of acmod_id_ds.t ("ds" stands for data structure.)
acmod_id_t is essentially a uint32, which is just a the size of unsigned integer or 2^32 -1. Why -1? Notice that MAX_CI_ACMOD was defined as 0xfe?
The more interesting part here: we saw ci_acmod_id_t is only a character type. This is obviously another problem here, in some languages, one may be interested to express it with more than 255 phones. (Why 255?)
We'll meet acmod_set a little bit more. But let us move on first - sometimes code tracing will be more motivated when you see the code before the data structure. Many suggest otherwise: Indeed, once you know the data, code will make more sense. But in practice, you will most likely read the code first and needs to connect things together. Thus IMO: both approach has their merit in code tracing.
So far ..... and next post
To avoid clutter a single post, I will stop and put the rest of next_utt_states.c (cvt2phones and state_seq_make) on another post. But I want to summarize several things I have observed so far:
- Current bw doesn't create a word network so it has issues to handle multiple pronunciations.
- Current bw automatically expand triphone contexts. There is no explicit way to turn it off.
- bw is not doing optional silence in the network.
- bw doesn't work for more than 255 CI phones.
Btw, SphinxTrain1.08 has several changed which replace mk_word_list with data structure from sphinxbase. Those are encouraging changes. If I have time, I will cover them.
Arthur
Subscribe to:
Posts (Atom)