The Markov Chain

2 Conversations

Disclaimer : work in progress, please address with circumspection1

The Markov Chain was originally developed as a way of predicting the weather by means of statistical probability based on a sequence of weather patterns fed into a computer. In other words, it is a system that can be used to analyse the outcome of events which are random, in a sense, but all the same are related to what has gone before.

As a means of predicting the weather, the Markov Chain turned out to be basically useless - what is similar to the source in the small, often turns out to be nonsensical in the large. There is no necessary likelihood that it will be an accurate predictor of what will happen...

AI researchers give The Markov Chain a second lease of life

This, however, did not prevent a recent, though now largely forgotten, generation of computer programmers from taking up the idea in the 1980s, as a possible way of seeing if computers could be capable of generating 'realistic' (ie, human-like) text, with a minimum of human involvement. This was developed by researchers at A and T Bell laboratories in America. The program worked by way of feeding existing text into the program and then it 'reflects' on this by producing a kind of rambling, semi-coherent 'commentary' on it.

These researchers first launched the idea on an unsuspecting world in the late 1980s, by way of feeding in text from the existing discussions of a chat group, and then posting up their computer program's thoughtful 'responses' to these discussions, signing off their protégé's creations as those of a 'person' called 'Mark V. Shaney'2. The reactions of 'proper' members of this online group - to edifying observations such as 'When I meet someone on a professional basis, I want them to shave their arms', and 'While at a conference a few weeks back I spent an interesting evening with a grain of salt. I wouldn't dare take them seriously!' - was, perhaps understandably, not entirely favourable. Some thought 'he' was a harmless schizophrenic, others perceived satire and were predictably outraged. Only an enlightened few caught on to what it really was - a technologically advanced (for its time) experiment in artificial intelligence3.

Enough guff, let's see if it actually does anything

The basic idea of the Markov Chain, then, is that you paste a chunk of text into the program and it brings up a 'statistically probable' re-rendering of it based on the configurations of the words in the original text. For an online example of a fully functioning Markov Chain, follow this link to Doctor Nerve's Markov Page, and take your chances when you get there4... To illustrate the process, the following text, a well-known passage from Shakespeare's Hamlet :-

To be, or not to be; that is the question:

Whether 'tis nobler in the mind to suffer

The slings and arrows of outrageous fortune,

Or to take arms against a sea of troubles,

And, by opposing, end them. To die, to sleep -

No more, and by a sleep to say we end

The heartache and the thousand natural shocks

That flesh is heir to - 'tis a consummation

Devoutly to be wished. To die, to sleep.

To sleep, perchance to dream...

when run through a Markov Chain engine, might turn out looking like this with roughly equivalent line breaks5 put in by myself :-

To sleep, perchance to say we end them.

To die, to take arms against a sea of troubles,

And, by a sea of outrageous fortune,

Or to take arms against a sea of troubles

And, by a sleep to be; that is the mind to say we end

The heartache and by a sea of outrageous fortune,

Or to take arms against a sea of troubles,

And, by opposing, end them.

To sleep, perchance to - 'tis a sea of troubles,

And, by opposing, end...

Another example, drawn from a great writer of more recent years, Samuel Beckett :-

Where now? Who now? When now? Unquestioning. I, say I. Unbelieving. Questions, hypotheses, call them that. Keep going, going on, call that going, call that on. Can it be that one day, off it goes on, that one day I simply stayed in, in where, instead of going out, in the old way, out to spend day and night as far away as possible, it wasn't far. Perhaps that is how it began. You think you are simply resting, the better to act when the time comes, or for no reason, and you soon find yourself powerless ever to do anything again. No matter how it happened. It, say it, not knowing what6...

runs out looking something like the following :-

Where now? Unquestioning. I, say I. Unbelieving. Questions, hypotheses, call them that. Keep going, call that one day I simply resting, the time comes, or for no
reason, and night as far away as possible, it wasn't far. Perhaps that is how it wasn't far. Perhaps that is how it be that one day and night as far away as possible, it
began. You think you soon find yourself powerless ever to spend day I simply stayed in, in the better to spend day and night as possible, it wasn't far. Perhaps that
one day and night as possible, it happened. It, say I. Unbelieving...

Beckett is an interesting example to use because, as anybody who has tried to get through any of his work will probably agree, he was a writer who tended, in fact, to do a pretty good job himself of 'deconstructing' any possibility of stable meaning in his work. It is worth noting that, at a casual glance, the original version of the text does not necessarily look a great deal less nonsensical than the version that has been run through the Markov Chain. In fact, the more one reads Beckett, the more aware one may become of the potential 'unmeaning' that is always underneath the surface of even the most seemingly innocent and straightforward of pronouncements. Beckett is a writer who can make a reader question their own existence, if read in a particular kind of 'agnostic' spirit...

Of course, the machine version, while superficially similar, lacks the urgency of the incessant, ruthless, often desperate, self-questioning quality of the one produced by the conscious human mind. Or is that just a subjective evaluation on the part of this Researcher?...

All right, but what possible use could it have?

Of course, you could run the same text through again and it would come up with an entirely different response. The program seems to develop a fixation with one or two key passages, and then proceeds to run riot with these at the expense of most of the rest of the text. This can be seen by the fact that the more times you run a piece of text through the engine (ie, run the text through and then run the results through, and so on and so on...) the results become more and more predictable, with an increasingly small proportion of the original text being represented...

Thus, it is probably fair to say that the program really works best of all at the first level - the best way to use it (for creative / craftspersonlike purposes) is probably to run something through, take the results and 'tidy' them up manually, and then run this resulting text through the system. The end result, if one carries on working like this, is a developing sequence of variations on a theme moving steadily away from an original idea - a chain of interrelated threads resembling the principle of the 'many worlds' interpretation of quantum theory - without, however, actually losing sense or indeed all of the original meaning of the text that inspired the thing in the first place.

Or something like that...

1Or preferably just ignore it completely.2This, of course, is a very bad pun on 'Markov Chain'.3For a more detailed version of this entertaining story see A. K. Dewdney's Computer Recreations column in Scientific American, June 1989.4The text on this page was done using the above website, of course. For an explanation of how the thing works - probably clearer than the one I have given above - go to What's a Markov Process? from the same website.5Okay, so it doesn't quite follow Shakespeare's beautiful iambic pentameter blank verse. But what the heck, this is a random nonsense generator we're working with here not a legendary Bardic genius...6These are the opening lines from The Unnameable the third in Beckett's famous trilogy of short novels from the late 1940s and early 1950s.

Bookmark on your Personal Space



Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry

Written and Edited by


External Links

Not Panicking Ltd is not responsible for the content of external internet sites


h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more