Friday, October 22, 2010

The varied streams of reasoning

A daily quiz question mail-list sent a question with three pictures, asking us to give a connect between the three. I found that the first two pictures just gave away the connect. The first was a picture of Stephen King, second was a picture of Rita Hayworth. To anybody who has watched The Shawshank redemption, this would be a piece of cake. I guessed the third picture to be Frank Darabont, which was probably inferred from the fact, that I know Stephen King and Rita Hayworth connect only for this movie and the other closest connect I can find is Frank Darabont. It turned out to be right when I verified my thoughts.

What exactly triggered my brain to give the answer as Frank Darabont. At a mathematical level I'd say that the intersection of {King,Hayworth,The Shawshank Redemption} can lead me to certain connects like {Morgan Freeman,Bob Gunton, Frank Darabont,...}. Now I know that the third picture is not Bob Gunton or Morgan Freeman because I know how they look like. So the only possible connect here was Darabont. While we can mathematically eliminate a set of choices, the visual recognition also plays a huge part in the final elimination here. Yesterday's question was similar. I had to look at an epitaph of a young poet to figure out whom the epitaph belonged to. The young poets I knew, who died early in life were {Keats,Wilfred Owen,...}. I decided to look at the date of his death. Now that leads me to only Victorian Era poets. Here the only Victorian Era poet who died and closely resembled the epitaph was Keats. That turned out to be the answer. What amazes me is the fact that so much stimuli are hit upon when our brain is asked to process or deduce an answer. The cognitive processes that follow deal with visual recognition, context understanding, elimination of other choices.

These are minimal observations from somebody who also is a budding practitioner of Artificial Intelligence, but the questions these observations throw are mind boggling. How do I for example build a simple reasoning engine which can also accumulate knowledge. From the previous examples the accumulating knowledge part was how Frank Darabont and Keats get added to the brain. Now they are stored permanently in my brain and probably would serve for future knowledge gathering.

As Steven Pinker put it, The main lesson of thirty-five years of AI research is that the hard problems are easy and the easy problems are hard. The mental abilities of a four-year-old that we take for granted – recognizing a face, lifting a pencil, walking across a room, answering a question – in fact solve some of the hardest engineering problems ever conceived.... As the new generation of intelligent devices appears, it will be the stock analysts and petrochemical engineers and parole board members who are in danger of being replaced by machines. The gardeners, receptionists, and cooks are secure in their jobs for decades to come

Monday, October 4, 2010

The analogy of a Human Brain

No great content ahead folks. So I just did a Brain.rand(MyBrain) to come up with something.What turned out were highly unusual. I thought my brain was just another empty shell but it's seemingly decent storage capacity did return a myriad of content. So here goes a few random thoughts.

I was leafing through A Study in Scarlet by Arthur Conan Doyle where for the first time he introduces Dr.John.H Watson and Sherlock Holmes, the greatest fictional detective ever. Watson is piqued at the fact that Holmes knows nothing about the earth or the sun or even anything about Poetry and Carlyle. Did a google for the exact text and I got it...

"His ignorance was as remarkable as his knowledge. Of contemporary literature, philosophy and politics he appeared to know next to nothing. Upon my quoting Thomas Carlyle, he inquired in the naivest way who he might be and what he had done. My surprise reached a climax, however, when I found incidentally that he was ignorant of the Copernican Theory and of the composition of the Solar System. That any civilized human being in this nineteenth century should not be aware that the earth"


This really set me on the contemplative mood. How can Sherlock Holmes to whom knowledge and perfection is of paramount importance can not be aware of this basic fact? Why was he not too keen to update his knowledge?So many questions just raced through my mind with each one trying to win the race. The next few paragraphs cleared my questions. Surprisingly enough they made me look at learning in a different perspective. Just read the following extracts from the novel and you'll get a wind of it.

Sherlock Holmes : "You appear to be astonished," he said, smiling at my expression of surprise. "Now that I do know it I shall do my best to forget it."

Watson: "To forget it!"

Sherlock Holmes : "You see," he explained, I consider that a man's brain originally is like a little empty attic, and you have to stock it with such furniture as you choose. A fool takes in all the lumber of every sort that he comes across, so that the knowledge which might be useful to him gets crowded out, or at best is jumbled up with a lot of other things, so that he has a difficulty in laying his hands upon it. Now the skillful workman is very careful indeed as to what he takes into his brain-attic. He will have nothing but the tools which may help him in doing his work, but of these he has a large assortment, and all in the most perfect order. It is a mistake to think that that little room has elastic walls and can distend to any extent. Depend upon it there comes a time when for every addition of knowledge you forget something that you knew before. It is of the highest importance, therefore, not to have useless facts elbowing out the useful ones."

Watson : "But the Solar System!" I protested.

Sherlock Holmes : "What the deuce is it to me?" he interrupted impatiently: "you say that we go round the sun. If we went round the moon it would not make a pennyworth of difference to me or to my work."

Looking back, is Sherlock Holmes not right? Should we also limit ourselves to what is useful for our line of work? Or the skeptic in you says the brain has every right to store any kind of information. I reflect on the above paragraph and feel Mr.Holmes was probably right. What do you think?

Sunday, October 3, 2010

The travails of being a Programmer

Wrote this in my company internal blog sometime back. Had nothing to post and just thought that I could post it here.

The last traces of a human company in my floor just vanished now. I just stood up to see that I was the sole occupant of an entire floor. Studying for certifications can be a boring task. Especially if you have a running nose the entire day. I still don't know why I should be studying something called ITIL, when there is a pressing need for me to learn Computational Linguistics. But what I have here is an incident that happened to me yesterday. I'd really like to share it with you folks. The great Larry Wall once wrote about the three qualities of a programmer. So why do I bring this up now?

Yesterday, I had to meet my Big Boss to clarify certain things. Well it was something entirely personal and nothing to do with the official work. He was immersed in his work and asked me to wait for a while. I Hung around** for a while. My eyes scanned the space emptied by the occupant there and so I had to trouble the the other team mates. This is the place where I realized, how important those prophetic words of Mr.Larry Wall were. One of the senior folks was actually working with a XML file. The XML file was generated with some blank spaces between tags. Her task was to remove these blank spaces and generate a clean XML. To illustrate the problem, her XML tags looked like StartTag(loads of blanks)some_string EndTag . Now all she had to do was to remove the loads of blanks. To folks well versed in notepad++ and TextEdit, this would have seemed trivial. A simple find and replace would have worked. TextEdit for some weird reason was not working. I looked at her and asked if she would consider writing a program to do it. She was not interested as ..it would take more time to write a program. So she was manually removing the spaces. I said I'll write a java program.(These days I am familiarizing myself with Cygwin and so I thought I'd as well try the powerful tools in the Unix shell). She was very apprehensive and inspite of her sweet denial I could figure out that she was really not so interested in the task.Well it would have required only two lines in java. Assuming there were only blanks or spaces. All she had to do was this :

String a = //The string from the XML file
String b = a.replaceAll("StartTag\\s+", "StartTag");

Probably that's not the best way to do it either. There might even exist a simpler way. Thankfully today I realize that there might be some traces of the laziness that Larry Wall spoke of. Oh! Btw you should have also thought about the immutability of Java strings if you viewed the above two lines of code.

This might be just me. Some folks would still love doing the manual way. I have no qualms about that. But, I wonder if the creative spark in me would die a slow death. Will I start imitating my seniors and shed the remnants of any creativity that I have? I get reminded of the movie Idiocracy where the protagonist lands in a future where the humans have become totally dependent on machines and cannot think for themselves. Hmm.. I really don't have an answer to the question now.

I just remembered a beautiful poem by P.B.Shelly called Ozymandias. It talks about the crumbling of mighty empires and the ultimate destruction of any civilization, however great it might be. Here is the poem:
I met a traveller from an antique land Who said:
Two vast and trunkless legs of stone Stand in the desert.
Near them, on the sand, Half sunk,a shattered visage lies,
whose frown And wrinkled lip, and sneer of cold command
Tell that its sculptor well those passions read
Which yet survive, stamped on these lifeless things,
The hand that mocked them and the heart that fed.
And on the pedestal these words appear:
"My name is Ozymandias, king of kings:
Look on my works, ye Mighty, and despair!"
Nothing beside remains.
Round the decay Of that colossal wreck, boundless and bare
The lone and level sands stretch far away

Yeah! I just hope the creative thinker in me doesn't have the fate that Shelley has put forth in fine verse. I hope that he lives on for at least 20 years from now.

(**Pardon me,I think the purists would not agree to such a usage. I'd rather use it for the descriptive purposes :D**)

**Goes back to listening songs from the evergreen movie Abhimaan and decides to call it a day**