Live data from Hacker News

Show HN: Markov chains explained visually

setosa.io

41–50 of 96 posts

Re: Show HN: Markov chains explained visually

#41
Thought I'd point out a little typo. In your table with sliders for adjusting probabilities of state transitions, the P(B|B) probability reads "P(B|A)".

Edit 1: Also, P(A|B) reads "P(A|A)".

Edit 2: Not trying to be too nitpicky, though. It's a really nice visualization. Really excited about the growing use of d3 to visualize algorithms. Is this inspired by Mike Bostock's post by that title?

Re: Show HN: Markov chains explained visually

#42

I created a Markov chain generator: https://gist.github.com/grant/561834963dc526495c45 var numNodes=10;var roundNum=100;var a=[];for(var i=0;i roundNum)/roundNum;connections[j]=randNum;sum+=randNum}connections=connections.map(function(e){var t=e (1/sum);t=Math.round(t roundNum)/roundNum;return t});sum=connections.reduce(function(e,t){return e+t});connections[numNodes-1]+=1-sum;connections[numNodes-1]=Math.round(conne…

Nice!

Re: Show HN: Markov chains explained visually

#43

This is at a tangent, but I'm a fresh CS undergrad and this simple explanation really hooked me. So my question is, where can I find more of this stuff? MOOCs are tough to manage with university, but if I wanted to learn more about these mathematical concepts presented in an interesting way, where should I start looking? I'm a tad bit indecisive about how good I am with CS theory but I know if I took the leap and mas…

Again a bit of a tangent, but I wrote an essay on learning math on your own based on my experiences: https://medium.com/@amathstudent/learning-math-on-your-own-3... - perhaps it will help you.

Re: Show HN: Markov chains explained visually

#46

That's pretty cool. The markov chain diagrams seem very similar (identical?) to deterministic finite automota. Would it be correct or incorrect to say that a Markov Chain can be thought of as a DFA where the changes in state are determined by probability?

Yes, that's exactly what it is. There's nothing more to it.

Re: Show HN: Markov chains explained visually

#47
post #39

I've seen Markov chains applied to language generation - producing sentences that make sense grammatically but not literally. Anyone know what the connection is here? I think I have an idea but would like to see if it gets independently verified by someone else.

There are complicated ways of doing this, but the naïve way is as follows: First you need a corpus of text that's grammatically correct Each node in the chain is a word or piece of punctuation. Each word has a certain probability of being followed by every other word in the corpus, including itself. There are a few different ways to start the sentence. One approach is to start from the node for the punctuation mark "…

Here is cool generator that demonstrates this in action: http://projects.haykranen.nl/markov/demo/

Re: Show HN: Markov chains explained visually

#48
Gian Carlo Rota is always a pleasure to quote, despite he knowing it. One from his reminiscence about Jack Schwartz, in his "Indiscrete Thoughts" Book (TL;DR: Markov Chains seen as random maps):

The first lecture by Jack I listened to was given in the spring of 1954 in a seminar in functional analysis. A brilliant array of lecturers had been expounding throughout the spring term on their pet topics. Jack's lecture dealt with stochastic processes. Probability was still a mysterious subject cultivated by a few scattered mathematicians, and the expression "Markov chain" conveyed more than a hint of mystery. Jack started his lecture with the words, "A Markov chain is a generalization of a function." His perfect motivation of the Markov property put the audience at ease. Graduate students and instructors relaxed and followed his every word to the end.

Beuatiful visualizations.

Re: Show HN: Markov chains explained visually

#49
Back when I was in college (~20 years ago) I was struggling to understand generative models, and I asked my CS professor.

he said, "imagine god is sitting around emitting DNA sequences. She has sevearl 4-sided biased dice, rolls one of the 4-sided die, BAM, emit an A! Again, roll the die, BAM, emit a A! Roll again, BAM, emit a T! Now, imagine god is a fickle person, and between rolls, decides to roll a die to decide which of the biased die to roll.

For some reason, that helped.

Re: Show HN: Markov chains explained visually

#50
post #4

Beautiful. I had seen Markov chains mentioned before, but had not looked them up. Skimming the wikipedia page made sense (it's a state machine with transitions determined by probabilities instead of defined events), but I would not have had an intuitive understanding of why they are useful. The explanation mid-way down about modeling the distribution of sunny and rainy days really made it click for me.

Shannon's paper becomes a lot more fun once you've grokked Markov chains.

http://cm.bell-labs.com/cm/ms/what/shannonday/shannon1948.pd...

There's a bunch of fun stuff that suddenly becomes possible.

It's gently distressing that by far the most use that Markov chains have seen so far is to generate English-like gibberish text to beat spam filters.

Post reply on HN