February 4, 2016

Alan Turing on Artificial Intelligence

0 comments

Alan Turing (1912-1954) was a brilliant man who is most famous for his work with cryptography during the Second World War. According to the movie The Imitation Game, he and the other cryptographers shortened the war with two years, saving more than 14 million lives. But the movie is a very simplified version of Alan Turing's life, and if you want to learn more about him you should read the biography Alan Turing - The Enigma by Andrew Hodges. 

I believe Alan Turing - The Enigma is the most famous biography about Alan Turing. Among other things, you will learn that during the war Alan Turing decided to buy silver bars and hide them beneath the ground in case the Germans invaded Britain. After the war, Alan Turing and a friend tried to find the silver bars. He sort of knew where they were hidden and they also brought a metal detector, so the dug some holes, but they couldn't find them. So if you by chance find some hidden silver bars near Shenley in England, they might be Alan Turing's lost silver bars.

While not hiding silver bars or solving German codes, Alan Turing was thinking about artificial intelligence, and he is widely considered to be the father of artificial intelligence. Within the field, Alan Turing is most famous for developing the so-called Turing test

The basic idea behind the Turing test is to figure out if an artificial intelligence is really intelligent. If you have seen the movie Ex Machina, you have seen that the creator of the robot Ava wants the main character in the movie to administer a Turing test to see if the robot really is intelligent. The movie is fiction, but there are reports that a computer program called Eugene Goostman, which simulates a 13-year-old boy, has passed the Turing test. So the test is limited because the chatbot is not intelligent. But Alan Turing developed the test at least 60 years ago, so we can't blame him. What we need is an updated Turing test. Some have suggested that a better idea is to test the ability of an AI to predict which is really what our brain is doing (according to some theories). 

Speaking of brains, as the Second World War ended Alan Turing told a friend that he wanted "to build a brain." That was not an easy task in 1945 - even in 2016 we are not really sure how the brain really works. For example, we have no clue why we have to sleep. There are theories, but no facts why we actually have to spend one third of our lives in bed. 

It's unclear how much Alan Turing knew about the physiology of the human brain. The brain cell itself, which is called a neuron, was discovered in the 19th century. But it wasn't until 1952 that Alan Lloyd Hodgkin and Andrew Huxley presented the now famous Hodgkin–Huxley model, which is a mathematical model for transmission of electrical signals in neurons. 

Alan Turing, who was a mathematician, would have liked the Hodgkin–Huxley model as it consists of several differential equations, but is is unclear if he ever saw it (he was working with something called morphogenesis, which is how spots appear on animals, when the report came out). He died two years after the model was finished. But the same scientists who developed the Hodgkin–Huxley model had in 1939 published a paper how they had recorded action potentials from inside a nerve fibre. So even though neuroscience wasn't as popular as it is today, there were pieces and theories Alan Turing could have used.

But according to his biography:
"He would have seen pictures of nerve cells, but at the level at which he was approaching the description of mind, the details were not important. In speaking of building a brain he did not mean the components of a brain, or that their connections should imitate the manner in which the regions of the brain were connected. That the brain stored words, pictures, skills in some definite way, connected with input signals from the senses and output signals to the muscles, was almost all he needed."

Alan Turing's idea to build a brain was to write "instruction notes" and see whether a machine could behave like a brain in developing "thinking spots" for itself. He wanted to show that a machine could learn. The problem was that he didn't have a machine to experiment with - the computers we have today would have helped him but they didn't exist back then.

The brain he wanted to build was a universal machine that would be all machines. In 1944, Alan Turing said that he had plans for "the construction of a universal machine and of the service such a machine might render to psychology in the study of the human brain." 

Once, Alan Turing held a speech about his plans for building a brain. He said: "No, I'm not interested in developing a powerful brain. All I'm after is just a mediocre brain, something like the President of the American Telephone and Telegraph Company." This was while he was in US and had consulted the American Telephone and Telegraph Company and was apparently not satisfied with the situation. He then continued to explain how he wanted to feed the brain with facts on prices of commodities and stock, and then ask the machine the question: "Do I buy or sell?" 

To develop an artificial brain, Alan Turing argued that it would be possible to start with an unorganized machine. It could be made up in a random way, like the neurons in a child's brain are, and then teach it how to behave:
"...by applying appropriate interference, mimicking education, we should hope to modify the machine until it could be relied on to produce definite reactions to certain commands." 
    
But he also argued that it will not be possible to apply the exact same teaching process to the machine as to a human child. It will not be possible to send the machine to school. And neither had he plans to make an exact replica of a human:
"I certainly hope and believe that no great efforts will be put into making machines with the most distinctively human, but non-intellectual characteristics, such as the shape of the human body. ...their results would have something like the unpleasant quality of artificial flowers. Attempts to produce a thinking machine seem to me to be in a different category."

So to sum up, Alan Turing was aiming for something similar to the smart operating system from the movie Her:


...and not the smart robots from the movie Ex Machina:


December 28, 2015

Nikola Tesla on Artificial Intelligence

2 comments

Nikola Tesla (1856 - 1943) was an inventor born in Croatia, and is best known for his contributions to the design of the modern alternating current (AC) electricity supply system. He was also very bright, which was a problem because he could design his machines in his head so he didn't always build the final product. And if you don't build the final product and sell it, then you will not make much money. So Tesla came up with these brilliant machines, but he still had to borrow money to survive. 

Tesla has also given his name to the electric car company Tesla Motors. One of the founders of that company, JB Straubel, was a fan of Nikola Tesla (but it wasn't he who gave the company its name), and his favorite book about the man is Wizard: The Life and Times of Nikola Tesla by Marc Seifer. I finished reading that book and learned, among other things, that one of the reasons Tesla could accomplish so much was that he was ambitious. This is very similar to Albert Einstein, who could also dedicate his life to whatever he was doing.  

When Tesla was a young student, his teachers were worried about him. The reason was that he had "a veritable mania for finishing whatever I began." So he couldn't simply stop himself from doing whatever he was doing. If he began reading a book he couldn't do anything else before he had finished it. So the teachers said that "the boy was at risk of injuring his health by obsessively long and intense hours of study." He could study for 20 hours a day. 

Tesla would move to the US together with his ambitions. He could experiment day and night, holidays not except. He drove himself until he collapsed, working around the clock, with few breaks. He preferred working through the night, when distractions could be minimized and concentration could be intensified. He argued that "every hour, every moment, that was not spent working on inventions was time away from his purpose." Even the intervals spent eating and sleeping delayed progress, so he reduced his sleeping to a minimum and his eating to the bare necessities. He argued he could sleep 2 hours per day while "dozing" from time to time to recharge his batteries. He said:
I get all the nourishment I require from my laboratory. I know I am completely worn out, and yet I cannot stop my work. These experiments of mine are so important, so beautiful, so fascinating, that I can hardly tear myself away from them to eat, and when I try to sleep I think about them constantly.

One other thing I learned from the book was that Tesla was also interested in Artificial Intelligence. The young Tesla studied the theories of René Descartes, who envisioned animals, including man, as simply "automata incapable of actions other than those characteristic of a machine." Tesla said that he wanted "to devise mechanical means for doing away with needless tasks of physical labor so that humans could spend more time in creative endeavors." When Tesla was asked to predict the future he said that robots and thinking machines will replace humans. His vision was that machines could liberate the worker and that fighting machines could replace soldiers on the field.

Tesla had come to see the human body in its essence as a machine. He said that memory "is but increased responsiveness to repeated stimuli." It's unclear if he actually tried to build a machine similar to himself, but he was thinking about it:
Long ago I conceived the idea of constructing an automaton which would mechanically represent me, and which would respond, as I do myself, but of course, in a much more primitive manner to external influences. Such an automaton evidently had to have motive power, organs for locomotion, directive organs and one or more sensitive organs so adapted as to be excited by external stimuli. Whether the automaton be of flesh and bone, or of wood or steel, it mattered little, provided it could provide all the duties required of it like an intelligent being.

But what is known is that Tesla built a remote controlled boat. To him, his boat was not simply a machine, it was "a new technological creation endowed with the ability to think." It was also, to him, the first non-biological life-form on the planet, arguing that life-forms need not be made out of flesh and blood. He said:
Even matter called inorganic, believed to be dead, responds to irritants and gives unmistakable evidence of a living principle within.

December 22, 2015

The secrets behind Albert Einsteins success

0 comments

I've read the book Einstein - His life and universe by Walter Isaacson, who is also the author of the most famous book about Steve Jobs. This summer I also read another book by Walter Isaacson called The Innovators, which is all about the history of the digital age, ranging from the first analog computer by Charles Babbage to Google. I also tried to read his book about Benjamin Franklin, but gave up because it was filled with politics which is not really my cup of tea.
The basic theme in the book The Innovators is that those who collaborated with other inventors succeeded, while those who didn't collaborate failed. It was the computer built by a team that succeeded and the computer built by the lone inventor failed. Now this is not always true, because Albert Einstein was in fact the loner who succeeded. 
Einstein didn't invent anything, but he developed the theories he's now famous for while working as a patent examiner. Why was he working as a patent examiner? Because no one wanted to hire him. Einstein was actually the only person graduating in his section who was not offered a job and he often didn't even get a reply on his applications! But he responded with humor by saying "God created the donkey and gave him a thick skin." 
So while trying to remain optimistic, Einstein examined patents six days a week and in the evenings he developed his theories that would eventually give him the Nobel Prize in physics in 1921. He was so efficient that he managed to do a full day's work in three hours, and the remaining part of the day he would work with his own ideas. It was doing what he enjoyed that kept him sane while everyone else succeeded. "What kept him happy were the theoretical papers he was writing on his own." 
In hindsight, Einstein argued that it was actually good for him to not get a job, because he wasn't influenced by other people's thinking and he could develop his own "crazy" ideas. "An academic career in which a person is forced to produce scientific writings in great amounts creates a danger of intellectual superficiality." So Einstein was a rebel, and there was a link between his creativity and his forced willingness to defy authority. He could throw out conventional thinking that had defined science for centuries.  
So how did he do it? 
  • Have imagination. Einstein argued that "Imagination is more important than knowledge." He also argued that "the value of a college education is not the learning of many facts but the training of the mind to think." Einstein never began with experimental data. Instead, he generally began with postulates he had abstracted from his understanding of the physical world. Einstein's ideas are abstract and are not always easy to grasp. But he believed that the end product of any theory must be conclusions that can be confirmed by experience and empirical tests. He is famous for ending is papers with calls for these types of suggested experiments.
  • Do something else when you are stuck. When he couldn't solve a problem he played the violin late at night. "Then, suddenly, in the middle of playing, he would announce excitedly, 'I've got it!'"
  • Work a lot. Einstein was ambitious. He and his wife had separate bedrooms so he could spend more time with his calculations. "For I shall never give up the state of living alone, which has manifested itself as an indescribable blessing." He worked so much that he didn't really enjoy food. When he invited visitors for lunch, he heated cans of beans. Then they ate the beans with spoons directly from the can. Einstein also used his work to escape the complexity of human emotions. When his wife was dying, he worked even more.  
  • Change your mind. Einstein wasn't mindlessly stubborn. When he realized his idea wouldn't work, he was willing to abandon it. Before Hitler, Einstein was a pacifist and thought the solution to war to not rearm after the First World War. But after the Second World War, Einstein thought he had made a mistake by encouraging Germany's neighbors not to rearm. 
  • Be a star. The reason Einstein is now an icon and almost everyone can recognize him if they see a picture of him is because he could, and would, play the role. "Scientists who become icons must not only be geniuses but also performers, playing to the crowd and enjoying public acclaim." And Einstein performed. He gave interviews and knew exactly what made a good story, and he often made jokes during interviews.

    December 15, 2015

    Santa Claus Down - or how to make a game in 48 hours

    0 comments

    This weekend I participated in a competition called Ludum Dare where the idea is to make a game in 48 hours or 72 hours. The former is called "Compo" and is more hardcore because you have to create everything on your own down to the smallest texture and sound. The 72 hours version, which is called "Jam," is more relaxed: you can work in a team and you can use old assets. But I'm hardcore, so I created the game Santa Claus Down in 48 hours.

    The theme this competition was either "Growing" or "Two button controls" - or both. It's usually just one theme, but this competition the voting between the themes was tied. I chose growing as my theme and the plan was to make a growing truck that's growing with more trailers as you progress in the game, like the classic game Snake.


    The basic idea behind the game is that Santa Claus has crashed and you have to deliver the gifts. I originally planed to create a random town where you have to drive around to deliver all gifts, but I ran out of time. Instead I ended up making an endless road system, where the roads varies between highway, house where you can deliver a gift, and a normal road.


    This was my sixth Ludum Dare competition. I failed once, but I submitted games to the other five competitions. The good thing is that users who are voting also give you constructive criticism. The main criticism I got from the last competitions was that my games were creative but were not fun to play. So this competition I decided to make a more simple game and spend about 50 percent of the time making the game fun to play. This failed because of the failed idea to make a random city, so I spent maybe 30 percent of the time making the game more fun.

    To learn how to make a game more fun I read the book The Art of Game Design. From that book I learned that (some) players like explosions, and most player want to play a game where the challenge is increasing. So I added explosions when you hit a car. It's not realistic but people who played the game said that it was fun to crash into cars:
    ...I felt like I was fighting the controls a bit, but it did make tail swiping cars more satisfying. As it was, tail swiping cars was really the high point of the game. I think this game could really work as a high paced drive around tailswiping cars and delivering presents to a destination kind of game.
    To make the game increasingly challenging I tweaked:
    • When new cars arrive on the roads
    • When you get a new trailer
    • When the Grinch is arriving. I added the Grinch, who is driving a green car and wants to crash into your truck. The Grinch is only appearing after you have delivered a few gifts
    • When ramps appear on the road. I added ramps that you have to either drive over or drive around
    • When a heart appears that will give back some of your health 


    This competition I also added sounds to the game. As I participated in the Compo I had to make all sounds myself. I didn't have time to go out and and record truck sounds, so I used a tool called Bfxr, which generates random sounds. Finding a good truck sound wasn't easy, so I ended up with a sound similar to the sound of a small boat. One of the players said it all:
    ...putt putt putt putt putt putt putt putt putt putt putt putt.. Don't mind me, just doin' donuts in ma truck!

    Looks interesting? You can play it here.

    December 9, 2015

    Books I've read in 2015

    0 comments
    2015 is almost over and it's time to summarize which books I've read this year. This year I wanted to learn more about Artificial Intelligence, so the list includes several books with that theme. I'm keeping track of the books through my Goodreads account, so don't feel sorry for me that it took a long time to complete the list, because it didn't!

    Artificial Intelligence:
    1. Neuroscience for Dummies
    2. Ten Years To the Singularity If We Really, Really Try... and other Essays on AGI and its Implications
    3. Between Ape and Artilect: Conversations with Pioneers of Artificial General Intelligence and Other Transformative Technologies
    4. The Computer and the Brain
    5. Alan Turing: The Enigma
    6. On Intelligence
    7. Consciousness: Confessions of a Romantic Reductionist
    8. How to Create a Mind: The Secret of Human Thought Revealed
    9. Our Final Invention: Artificial Intelligence and the End of the Human Era
    10. Vehicles: Experiments in Synthetic Psychology
    11. I, Robot
    12. Predictive Analytics: The Power to Predict Who Will Click, Buy, Lie, or Die
    13. Prey
    14. The Quest for Artificial Intelligence: A History of Ideas and Achievements
    15. Artificial Intelligence for Games

    Other:
    1. Stockholms undergÄng
    2. Game Programming Patterns
    3. The Man in the High Castle
    4. The Martian
    5. Python for Data Analysis
    6. SuperBetter: A Revolutionary Approach to Getting Stronger, Happier, Braver and More Resilient--Powered by the Science of Games
    7. Bombmakaren och hans kvinna
    8. The Animator's Survival Kit: A Manual of Methods, Principles, and Formulas for Classical, Computer, Games, Stop Motion and Internet Animators
    9. The Sell: The Secrets of Selling Anything to Anyone
    10. The Innovators: How a Group of Hackers, Geniuses and Geeks Created the Digital Revolution
    11. So, Anyway...
    12. The Signal and the Noise: Why So Many Predictions Fail - But Some Don't
    13. Thunder Run: The Armored Strike to Capture Baghdad
    14. Fundamentals of Computer Programming with C#
    15. SAS Survival Guide: For any climate, for any situation
    16. Almedalen har fallit
    17. The Unthinkable: Who Survives When Disaster Strikes - and Why
    18. Einstein: His Life and Universe
    19. Wizard - The Life and Times of Nikola Tesla

    If I would recommend a book, I would recommend The Unthinkable: Who Survives When Disaster Strikes - and Why. As the title reveals, it is all about disasters and how to increase your chance of surviving a disaster and the psychology behind it all. 


    The first story is about an unfortunate woman who almost died in the first Word Trade Center attack in New York, and a few years later she was in one of the towers when the second attack happened. Even though she was responsible for the evacuation of the floor she was working on, she blacked out and forgot all about it until a few weeks later when she remembered that "Hey, maybe I was the one responsible for getting everyone out of the building." 
    Another story is about the passenger ferry Estonia which sank during a heavy storm. One of the survivors recalled that when he escaped he walked past several passengers who just sat in chairs in a bar very close to the life boats. They could have survived but they just sat in the chairs doing nothing at all.
    So who is surviving a disaster? The answer is that one part of it is based on your life history. If you have lived a rough life it will increase your survival chances. Another answer is that you have to prepare so you don't black out and be aware of the "stupid" mistakes. One stupid mistake many people do in a disaster is that they look at what other people are doing. So instead of evacuating the burning World Trade Center, many people just stood there looking at what other people were doing who were also looking at what other people were doing. So they didn't escape when they could! Those who had practiced evacuating the buildings escaped as soon as possible and survived.