Sunday, December 7, 2014

Jaron Lanier on the myth of AI

Jaron Lanier writes about the Myth of AI, and how unquestioning acceptance of it distorts work in the field. He's primarily interested in economic ramifications which I haven't given much thought to, but I'm glad that he also sees that there is an element of P.T. Barnum to the whole enterprise:

"If you ask: is a recommendation engine like Amazon more manipulative, or more of a legitimate measurement device? There's no way to know. At this point there's no way to know, because it's too universal. The same thing can be said for any other big data system that recommends courses of action to people, whether it's the Google ad business, or social networks like Facebook deciding what you see, or any of the myriad of dating apps. All of these things, there's no baseline, so we don't know to what degree they're measurement versus manipulation.
Dating always has an element of manipulation; shopping always has an element of manipulation; in a sense, a lot of the things that people use these things for have always been a little manipulative. There's always been a little bit of nonsense. And that's not necessarily a terrible thing, or the end of the world.
But it's important to understand it if this is becoming the basis of the whole economy and the whole civilization. If people are deciding what books to read based on a momentum within the recommendation engine that isn't going back to a virgin population, that hasn't been manipulated, then the whole thing is spun out of control and doesn't mean anything anymore. It's not so much a rise of evil as a rise of nonsense. It's a mass incompetence, as opposed to Skynet from the Terminator movies. That's what this type of AI turns into..."

Tuesday, November 25, 2014

watercolor bot

The watercolor bot is a plotter that uses watercolor paints. Something like this, using cams instead of electronics, could have been built 150 years ago, but apparently the goal of making it look like a person was more important.

Saturday, November 15, 2014

Harmonic analysis and synthesis by mechanism

Here is a series of clear videos explaining exactly how a mechanical harmonic analyzer works and what it is used for. There is also a free ebook about it.

Wednesday, May 28, 2014

Automated music composition based on classic novels

I like the approach taken here: using trained sentiment analysis, analyze the text of a novel to compose a piece that matches the feeling of the novel. Recognizing the feeling in a text is fairly easy: the frequency of particular words will give you a pretty good estimate. Generating that feeling with an automated composition is more difficult because we don't understand melody generation as well. Another thing you could do is analyze the period and setting of the novel, and use elements of musical style from that setting. This is clearly a first effort and the musical pieces aren't very convincing (they include a disclaimer to that effect.)

Friday, April 4, 2014

intelligent reaping machines

"Artificial intelligence" has always been a moving target: once something is automated, we no longer think of it as requiring intelligence. This goes back longer than you would think. Here's a report from the Kenosha County Fair in September 1852:
"This almost intelligent Machine seemed to attract the most notice of any of the Farming Implements on exhibition at the County Fair. From what examination we had time to make of its capacity and working quality, we have no hesitation in saying that it exceeds in simplicity and capability every machine that was ever carried into the field to assist the farmer. Its exact and regular working betrayed almost intuitive intelligence itself-- To be appreciated, it must be seen in working order. It not only cuts the grain, but it rakes it into a bundle, and then with its long fingers and arms it gathers the grain and deposits it in regular gavels all ready for the binder."
This is describing a mechanical reaper. By automating what had been a labor-intensive task, reapers had a huge effect on the world, contributing to urbanization, the availability of labor for factory work, population growth, impacts on slavery, and so forth. 

Tuesday, March 4, 2014

Excerpt 13 The Literary Engine, Turing's Love Letter, Eliza

The Literary Engine

In Gulliver’s Travels, Jonathan Swift made light of devices that create language automatically and randomly. The engine was meant to parody the Royal Society, who were interested in codes and ciphers as well as the study of nature. Like the infinite shelves of books described in Borges’ story “The Library of Babel,” the device he describes contained all possible sentences, both sensible and nonsensical:
 Six Hours a-day the young Students were employed in this Labour, and the Professor shewed me several Volumes in large Folio already collected, of broken Sentences, which he intended to piece together, and out of those rich Materials to give the World a compleat Body of all Arts and Sciences; which however might be still improved, and much expedited, if the Publick would raise a Fund for making and employing five hundred such Frames in Lagado, and oblige the Managers to contribute in common their several Collections.Every one knew how laborious the usual Method is of attaining to Arts and Sciences; whereas by his Contrivance, the most ignorant Person at a reasonable Charge, and with a little bodily Labour, may write Books in Philosophy, Poetry, Politicks, Law, Mathematicks and Theology, without the least Assistance from Genius or Study. He then led me to the Frame, about the Sides whereof all his Pupils stood in Ranks. It was twenty Foot Square, placed in the middle of the Room. The Superficies was composed of several bits of Wood, about the bigness of a Dye, but some larger than others. They were all linked together by slender Wires. These bits of Wood were covered on every Square with Paper pasted on them, and on these Papers were written all the Words of their Language, in their several Moods, Tenses, and Declensions, but without any Order. The Professor then desired me to observe, for he was going to set his Engine at Work. The Pupils at his Command took each of them hold of an Iron Handle, whereof there were fourty fixed round the Edges of the Frame, and giving them a sudden turn, the whole Disposition of the Words was entirely changed. He then commanded six and thirty of the Lads to read the several Lines softly as they appeared upon the Frame; and where they found three or four Words together that might make part of a Sentence, they dictated to the four remaining Boys who were Scribes. This Work was repeated three or four Times, and at every turn the Engine was so contrived that the Words shifted into new Places, as the Square bits of Wood moved upside down.
 He assured me, that this Invention had employed all his Thoughts from his Youth, that he had emptyed the whole Vocabulary into his Frame, and made the strictest Computation of the general Proportion there is in Books between the Numbers of Particles, Nouns, and Verbs, and other Parts of Speech.[1]

Turing’s Love Letter

Perhaps the first person to use an electronic computer to compose original pieces of writing was Alan Turing. He wrote a love poem generator as a joke in 1947. It used random numbers to choose nouns and adjectives to fill some of the parts of a canned love letter[2]:

Darling Sweetheart,

You are my avid fellow feeling. My affection curiously clings to your passionate wish. My liking yearns to your heart. You are my wistful sympathy: my tender liking.

Yours beautifully


Compared to the love letters of, say, Robert and Elizabeth Browning, it comes up a little short. It is similar in structure to how the utterances of fate were determined in divination rituals. The design is the kaleidoscopic pattern:
  • ·        A system of generating unpredictable output (in this case, a pseudorandom number generator).
  • ·        Elements to be recombined which themselves have some aesthetic appeal. (The words such as sweetheart, wistful, or tender which are randomly chosen.)
  • ·        A structure that imposes certain constraints on the results so that they will be interpreted as a sensible arrangement. (The fixed sentence grammar.)

Artists will protest that by “creative” we mean something more than this. What more could be added to a machine besides a larger number of elements and ways to be rearranged, and a more versatile and subtle structure to put them in? I think that the answer lies in the ability to recognize beauty or quality, in order to reject generated art that doesn’t meet this standard, rather than simply constraining the possible creations. Research into how to accomplish this is still in its infancy.


The first program designed for natural language conversation was a simulation of a psychiatrist, known as Eliza. Eliza’s conversation used the patient’s words in a superficial attempt to keep the conversation going on a topic without contributing much of its own. For example:

Well, my boyfriend made me come here.


He says I'm depressed much of the time.


It's true. I am unhappy


I need some help, that much seems certain.

Eliza is an attempt to automate (or perhaps parody) nondirective Rogerian psychotherapy, a method developed in the 1940’s and 50’s by psychologist Carl Rogers. Rogers recommended a technique he called “reflection,” in which a therapist restates the patient’s concern to show empathy and understanding, and to help the patient to find a way to solve his or her own problem. The key to this method is that the doctor is not providing solutions to the problems; the patient is providing both the problems and the solutions.
This helps us understand how meaning can be created by divination or artistic machines. When a fortune teller sits down with a client, very little actually comes from the system of manipulating signs. Instead, the fortune teller provides a way for the subconscious mind of the client to interpret a signal out of noise.
Similarly, our response to generated art is like finding shapes in the clouds or Rorschach’s inkblots. The beauty and meaning come from our attempt to find something we recognize in randomness. The machine itself does not have actual experiences to draw on. But what it can do is form an effective mirror where the viewer both provides, and is affected by, the meaning.
The author of the Eliza program, Joseph Weizenbaum, stated in an interview:
You can see Eliza using one basic method or, you could even say, trick: Eliza relies on the fact that the human being interprets the signals he perceives. He interprets these signals according to his needs and his interests. He projects his own image of his partner, whether this is a living human, conversing, or whether this is a living human being and a doll interacting or whatever.
He doubted the possibility of a programmed machine ever being able to actually mean the things it was saying:
No, that's impossible. The human being becomes a human, because he is understood and treated as a human by other humans. And that's where the deepest truths come from which nourish the human being - for example trust: to trust another human. There are things, like for example a hand on your shoulder: language is closely related to this and is learnt and developed by being based on such experiences. The computer can't have these experiences.
So we return to the question of meaning.[3] Do the words in a book have meaning, after the writer has written them and before the reader has picked it up? Imagine finding a book in the library, and being moved by what is written there. If the words that one finds meaningful got there by some other process than being written by an author (say, by monkeys pounding on typewriters who got really lucky), can we say that the meaning is somehow false, not meaning at all because it wasn’t meant? That doesn’t seem right. But Weizenbaum’s point too, seems like common sense. Meaning can’t just pop up, like so many crocuses in the spring. For there to be meaning, it seems like there has to be a mind.
It is simple to create a system that contains the fact “PARIS is the CAPITAL of FRANCE.” The same system could also contain the phrase “PARIS is the CAPTAL of THE MOON,” without protest. This is because it doesn’t understand the words PARIS, CAPITAL, FRANCE, or THE MOON. But systems are being developed[4] that will contain the fact that capitals have to be of countries, that all countries are on the earth, that one can’t have a city where no one lives, that Paris is a city, that the moon is uninhabitable, and so on—millions upon millions of facts and the logical means to connect them and derive new facts from them. Such a system would balk at being told that Paris is the capital of the moon, because it is inconsistent with the large body of facts it already contains. In this limited sense, it can be said to “understand” what the sentence means.
However, there is another sense of the word “understand” that will be discussed in Chapter VI, where we “understand” when someone mentions a particular sensory experience they have had, such as listening to music. This kind of understanding cannot be communicated through a network of relationships and definitions. Whenever humans understand something, it is at the lowest level grounded in this kind of direct understanding, direct experiencing, that can’t be broken down further. Part of what I mean by THE MOON is what it feels like to be gazing up at it on a cold October evening. I can only point to that experience, and if you’ve had one similar, you can understand. If not, no amount of explaining is going to communicate it to you.
For practical purposes this doesn’t make much difference, and most AI researchers are mainly concerned about practical purposes. For artists, though, it seems to matter a great deal. For some reason, we do care whether an artist is being authentic. The idea of receiving love letters written by someone who is not actually in love, but is incapable of feeling at all and is only “going through the motions” is distasteful even if we’re sure they’ll keep up the pretence.
In review, then, machines made to generate text all followed a similar pattern: strict rules to guarantee grammatical correctness with a few random elements. To the extent that the text they generated was meaningful, the meaning originated in the creator of the machine or in the reader.
For all their flaws, though, these machines did generate new text every time they were run. The machines in the next chapter, while imitating many fascinating abilities, don’t rise to that standard. However, they do illustrate the growing capability of machines to imitate other human faculties needed for creative expression.

[1] Swift, Gulliver’s Travels III:V
[2]Lavington, 1975 from Boden, Mind as Machine p. 674. It would be interesting to discover who Turing intended these letters for, given what is now common knowledge about his sexual orientation.
[3] The study of meaning in language is called semantics. The phrase “semantick philosophy” was used in the 1600’s and 1700s to refer to the study of divination systems. For example, in The British Apollo (Vol. III, 1708), the anonymous author writes “Bacon proposes this and several other sorts of divination as parts of rational and useful knowledge. Whatever this Semantick Philosophy was in former times…”
A better known reference is from John Spencer, A Discourse Concerning Prodigies, 1665.
[4] Doug Lenat’s CYC or the Commonsense Computing Initiative at MIT are two prominent examples, though they will probably be surpassed by other efforts soon. The Semantic Web is a related effort advocated by Tim Berners-Lee, who invented the web. “Semantic” refers to meaning; the Semantic Web is an effort to develop tools and practices that will allow this kind of automated reasoning to take place across the internet.

Friday, February 21, 2014

Excerpt 12: The Eureka

In 1677, one John Peter published Artificial Versifying, A New Way to Make Latin Verses as a kind of entertainment for schoolboys. This explained a technique for composing Latin poetry automatically. Each verse was of an unvarying form:
Adjective  Noun   Adverb   Verb   Noun   Adjective
The meter of each word was also fixed, forcing the line into metrically correct hexameter:
dactyl   trochee   iamb   molossus   dactyl   trochee
For example, one of the lines the machine produced could be translated as “A gloomy castle sometimes shows a bright light.”
 It is perhaps surprising that a method of generating poetry was invented before one for generating prose, since poetry is supposed to require more of a creative spirit. But as with divination, the most important ingredient is the license that we grant to the poet or the oracle. We have a tendency to interpret strangeness in poetry as deliberate, rather than a mistake. The foreign language, Latin, also may have served to allow an additional step of interpretation to take place in the mind of the reader, making further allowances.

In this case, the system was eventually literally automated. John Clark, an inventor and printer from Bridgewater, England, began in 1830 to build a machine to carry out the steps of John Peter’s process. He built a cabinet the size of a small bookcase that composed the poem while simultaneously playing “God Save the Queen.” His device consisted of six turning cylinders, one for each of the six terms in the line of poetry. If it had simply displayed six words, it would have been regarded merely as a clever plaything. But Clark encoded the words using pins in such a way that they would cause individual letters to fall into place, apparently at random. This gave the impression that the machine was somehow composing the poem letter by letter, which was much more impressive. He deliberately fostered this illusion, writing in a letter to the editor of The Athenaeum, a monthly magazine:
Permit me, as the constructor of the Eureka, or Machine for composing Hexameter Latin Verses, to make a few observations on its general principles, in reference to Dr. Nuttall's remarks, in your last week's paper. The machine is neither more nor less than a practical illustration of the law of evolution. The process of composition is not by words already formed, but from separate letters. This fact is perfectly obvious, although some spectators may probably have mistaken the effect for the cause—the result for the principle—which is that of kaleidoscopic evolution; and as an illustration of this principle it is that the machine is interesting—a principle affording a far greater scope of extension than has hitherto been attempted. The machine contains letters in alphabetical arrangement. Out of these, through the medium of numbers, rendered tangible by being expressed by indentures on wheel work, the instrument selects such as are requisite to form the verse conceived; the components of words suited to form hexameters being alone previously calculated, the harmonious combination of which will be found to be practically interminable.—Yours, &c. J. Clark. July 2, 1845.[1]
By the time this machine was built, there was an active press in London. This makes it possible for us to follow the conversation as society responded to the introduction of a machine that could compose. Of particular interest is what verbs were used to describe the actions of the machine:  it was said to be “composing,” “selecting,” and “thinking.” The machine follows the same architecture, the kaleidoscope pattern laid out in the introduction, where individual pieces (the Latin words in this case) are randomly chosen and are combined according to strict rules. All these machines are associated with entertainment and with illusions of mental activity, in this case explicitly encouraged by the inventor.
At the time of its exhibition (for one shilling at the Egyptian Hall in Piccadilly, London) the device attracted a lot of attention. William Thackeray joked in Punch magazine that “several double-barrelled Eurekas were ordered for Eton, Harrow, and Rugby.”[2] One author wrote, “I do not see its immediate utility; but as something curious, it is, perhaps, entitled to take its place with Babbage’s Calculating machine, and inventions of that class.”[3] In fact, Charles Babbage was familiar with the machine and with its inventor. William Hodgson, an economist, wrote, “It is truly a curious machine. Though I cannot say much for the sense of the verses…. The inventor spent fifteen years upon it, five years more than are needed to make a boy into a verse-making machine, and still less perfect. Clarke is a strange, simple-looking old man. Babbage said the other day that he was as great a curiosity as his machine.”[4]
On its front face was inscribed the lines:
Eternal truths of character sublime,Conceived in darkness, here shall be unroll'd;
The mystery of number and of timeIs here displayed in characters of gold.
Transcribe each line composed by this machine,Record the fleeting thoughts as they arise;
A line once lost will ne'er again be seen;A thought once flown perhaps forever flies.
Part of the fascination expressed regarding many of these creative machines was the ephemeral character of their random creations, which if not recorded would be lost forever. Imagine the most beautiful poem ever crafted. Wouldn’t it be an unspeakable tragedy if it was played only once, to an empty room, when not a single soul was listening? Nature is extravagant in this way with beauty. Think how many sunsets passed before there was anyone around to appreciate them, or of the clouds on Jupiter, storms the size of worlds, with no one there to watch them roll in. Or perhaps, a listener does hear the poem, just this single time, and forever afterwards is haunted by a few words, a single phrase. Granted, the Eureka didn’t produce poetry of this caliber; but it wouldn’t be hard to make a similar machine that did produce such poetry occasionally, mixed in with enormous amounts of nonsense (the monkeys and Shakespeare again.) The rules that forced the Eureka to always generate grammatical sentences were perhaps too strict to allow any truly creative sentences; eliminating the possibility of embarrassing failures led to a strategy that was too conservative to allow spectacular successes. (In the last chapter there is some discussion of how some future program may be able to move past such limitations.)
Another point often mentioned in the tabloids was the combinatorial explosion of possible sentences. Over the course of a week, one journalist noted, the machine, if left running, would produce over 10,000 unique verses. It becomes a torrent, poetry enough to make a person choke. It is like a snowy waste, where the unique, delicate snowflakes pile up to form mile after mile of mind-numbing sameness.
The device also included a kaleidoscope (a fad at the time—see chapter I), which produced a unique illustration to accompany each verse. The inventor was aware that both of these machines were performing analogous functions, that what he was building was just one of a class of “creative” machines. The Eureka has been maintained and can still be seen in the Records Office of Clarks’ factory in Somerset.
The idea of a poetry-generating machine was a kind of running joke from this time period until the early twentieth century. For example, “The Poetry Machine” was a short story by Charles Barnard published in 1872. In this story, a young boy happens upon a poetry machine:
“He went up to the table and stood before the wonderful array of cranks, wheels, and levers. The machine was about three feet long and two feet wide and high. There was a clockwork attachment, with a weight that hung on a pulley under the table. It resembled a telegraph machine. There was a long ribbon of paper rolled on two wheels, and it had a marker, just as Morse's instrument has, to print the words. On one side were a number of stops or handles, with ivory heads, having curious words marked upon them. One was marked, “Serious,” another, “Comic,” another, “Serenades,” and so on; one was marked, “Stopped rhymes,” another, “Open rhymes,” and there was one marked “Metre.”
The boy generates poems without meter and with nothing but the rhymes as he learns how to operate the machine. The story serves as a parody of the kind of thoughtless poetry that was churned out for commercial jingles or greeting cards. Besides similar stories, “poetic machine” was used as a humorous metaphor for the poetry-making capacity in the poet’s mind (especially for poets whose primary concern was making sure each pair of lines rhymed). All of these references assume that the reader will agree that simply “turning a crank” to generate poetry is an absurdity.

[1] John Clark, Atheneum, 1845
[2] Punch 9, 1845, p. 20
[3]  Littell’s Living Age, Volume VII, p. 214
[4] Life and Letters of William Ballantyne Hodgeson, 1883, p. 52