Monday, January 2, 2012

Facing the Singularity

In "Facing the Singularity" Luke Muehlhauser describes the inherent flaws of homo sapiens and the inevitability of Artificial Intelligence (AI) taking over. The future is quite bleak for us. The Earth is ours now, but maybe as soon as in 10 years we may be struggling to survive. Compared to AI we are mentally and physically inferior. Just one example:

Our axons carry signals at 75 meters per second or slower. A machine can pass signals along about 4 million times more quickly.

Luke is the director of Singularity Institute and he is researching friendly AI.

What if we cannot ensure that the AI is friendly to us?

We need to stop it. We need to introduce laws that prohibit AI and robotics research. We need to control it the same way we control chemical, biological, and nuclear weapons research and manufacturing.

And if we don't?
I can see two possibilities for us after the AI takes over:

1. It ignores us as long as we don't interfere with it, or stand in the way. Similar to how we ignore other animals. We may be treated as pets, or as pests depending on how we behave towards it. If we are hostile, it will be hostile. If we are docile, it will let us live.

2. At some point the AI may reach the conclusion that since the universe is slowly falling apart, and nobody can win the endgame, there is no point playing, and it will erase itself, like a depressed man with no future who kills himself.

Friday, December 23, 2011

Design Patterns Refresher

The most common design patterns from "Head First Design Patterns" by Eric Freeman and Elisabeth Freeman - the best book ever about design patterns:

Strategy
Encapsulate algorithms. Allows object's behaviour to be changed at runtime by substituting default algorithms. 

Observer 
Notify dependents of state changes. A very common pattern, often part of the language, see events and listeners in C#.

Decorator
Use and extend behaviour of the object being wrapped, while acting as that object to the external world. A decorator object is created with an instance of an object of the same type. When a method is invoked, it calls the embedded object's method, modifies the result, and returns it.

Simple Factory
Encapsulate object creation. Useful when you need to decide at runtime which object to create.

Factory Method
Same purpose as Simple Factory, but more abstract: moves actual object creation to other factory objects. 

Singleton
Indispensable when there is one of something in the system, like one database, or one set of configuration data. Implemented as a sealed class with private constructor and a static method that returns the only instance.

Command
Encapsulate actions. Every action object has "execute" method. Very useful for a processing system that needs to queue commands and then execute them in order. 

Adapter
Provide a converter that allows clients to use the interface they expect with an object that has a different interface.

Facade
Provide a simplified interface. Used to hide complexity of the underlying system from the external world.

Template Method
Provides extension points or hooks by defining steps of an algorithm and allowing or forcing subclasses to provide implementation for some of them. This pattern is often used in frameworks.

Iterator 
Provides a uniform way of accessing sequentially elements in an aggregate object of any type. Typically found in collections.

Composite
Organize objects into tree structures so a group of them can be treated the same way as a single element. Each object in the hierarchy is a component that can have sub-components. User interfaces are usually built as composites.

State
Encapsulate behaviours of an object in state objects. Current state object can request transition to another state.

Proxy
Provide a surrogate object that controls access to an object that is remote, needs to be secured or is expensive to create.

Saturday, December 17, 2011

Forgetting is the key to AI

I think that making computer programs fortget most of what they receive is the key to building Artificial Intelligence. Why? Because having to much data creates three problems:

1. Space needed to store it.
2. Speed of retrieval.
3. Classification: which piece of data is important?

Selective forgetting would solve these problems.

Spaced repetition algorithm should be used backwards to achieve that goal: when the AI program sees something for the first time, it keeps it until the next day. If it sees it again the next day, it keeps it for 6 more days. If by then it sees it again close to the 6th day, then it keeps it for another 15 days,  and so on. When something stops occurring, it is gradually forgotten. So, the AI program keeps less data, so the information can be retrieved faster, and the data kept is important in understanding the environment, because it keeps coming.

This mechanism works ok with the AI program learning about normal situations. It may stumble upon extraordinary, life-threatening situations, which need to be remembered separately from the spaced repetition algorithm.

Wednesday, November 30, 2011

Do you speak English, mate?

It's been almost a year since I moved to Australia, but I'm still being surprised almost every week by some cute Australian abbreviation for the long and boring English word. A few examples:
a postie - postman
a tradie - tradesman
a bikie - a member of a motorcycle gang
the ambos - ambulance personnel
a kindy - kindergarten
the crims - criminals
a journo - journalist
a doco - documentary
a sickie - sick leave
a fisho - seafood shop
a rego - car registration
a compo - compensation
a uni - university
a footie - football game
a garbo - garbage man - in our city, the garbage truck is operated by one man who drives the truck and picks up garbage using a remote arm - very XXI century
a schoolie - student on a final school break after graduating from high school
a truckie - truck driver
a ute - pick-up truck, for some strange reason it is cool to have one with low suspension, aluminium rims, two exhaust pipes, and dark windows.... are they prized by crims for easy loot loading?

Some other differences between everyday Australian and American English that may trip you out:
to chuck out - throw away
a rubbish bin - waste basket
a cash out - cash back
a bashing - beating
the thongs - flip-flops (for American readers: thongs are called g-strings in Oz, and they may draw a blank if you mention flip-flops)
relief teacher - substitute teacher
super - 401k
a council - town or county government


All over the town you can see signs that may make most American visitors smile:
Dick Smith - a chain of electronics shops.
LJ Hooker - a chain of real estate agents.

The word "mate" is used where "man" or "sir" would be used in the States.
The word "cheers" is used where "thanks" or "bye" would be used in the States.
The "shopping mall" is more commonly known as "shopping centre".

Australians write "kind regards" in e-mails where Americans would put "best regards".
I haven't heard anyone say bullsh#t, but sh#t is heard quite often.
I almost never hear "bless you" when someone sneezes, and almost never hear politicians referring to God. It may be related to the low importance of religion in general. Australian Roman Catholic Churches, new or old, are miniatures of their American counterparts.

The pronunciation may be peculiar : Super is often pronounced and written as "supa", doctor is often pronounced "docta". Strangely, I did not see a single "nite" or hear "wanna", "gonna", "gotta" or "ain't".

Some other general (subjective, subject to change, and not to be taken dead serious) observations:

Australians are very punctual and it's contagious as demonstrated by the fact that most Poles living in Australia tend to be punctual. That doesn't mean that things get done quickly. Although new laws are introduced very swiftly compared to the US.

Bureaucracy is alive and well. Things often get done slowly and costly, maybe after a number of failed attempts, but surely - they DO get done. Australians love filling forms. They must do. How else to explain these hundreds of pages that I had to go through to rent a house, open a bank account, register with Centrelink, buy a car, sign up the child for school, keep the child at school, and last but not least do taxes? On the other hand, medical forms are minuscule in Australia compared to the US.

Australia surprises me sometimes by giving for free things I expect to pay for elsewhere, and for paying for things I expect to be free. For example, my child went with the school choir to sing in a shopping centre. In the States, the school would get some donation from the shopping centre for that. In Australia, parents paid for the bus. Children and parents at my daughter's elementary school must buy tickets to go to the official end of school year event. On the other hand there are great free libraries with CDs, DVDs, computer games, and books and movies in foreign languages. At work, I have to buy and wear company polo shirts to come to office in jeans, but I get free breakfast everyday, and beer, wine, and snacks every Friday afternoon. There are free council events including movies in the park and various classes. You are never too far away from a free public park with playgrounds, toilets, and barbecues.

Australians love challenge and a chance to beat the odds. Sailing solo around the world? An Australian girl can do it. Getting in and out of the parking garage without a scratch? The designers and builders put a lot of effort into making the spaces and corners as tight as possible. Most Australians pass, the paint and grooves on the concrete walls are the fault of the tourists, probably Americans. Parking in your own garage? Again, the designers and builders made sure that in many homes you need a 4 wheel drive to get up the driveway, and then when you get to the top you either stop in place or turn 90 degrees to park. Trying to get on the motorway? You turned right to go right or you went straight to go straight? Wrong decision mate, you will have at least 3 kilometres to rethink that and try your luck at getting back on the motorway in the right direction.

Many Australians speak softly. In my first work meeting in Australia I was confused for a while, because I didn't notice that it started. The person chairing the meeting spoke so quietly that I thought it was a private conversation.

Australians love America, except those who don't. But most do. I think. Julia likes Barack very much.

Australians make great mainstream TV shows and movies about life (that includes sex): Satisfaction, The Slap, and about controversial subjects: Go Back to Where You Came From.

Australians have high quality public radio and television without irritating fund-raising drives.

Australians have a sense of humour. The public TV made a comedy about the current prime minister: At Home With Julia.

On a more serious note. I noticed that Australians are able to take with a smile various misfortunes: floods, fires, being robed, being demoted, being bitten by a jelly fish, spraining an ankle, long commute, expensive living, low quality housing and so on.

The sight of multiple families having a picnic, preparing a hot meal on a barbie in a park, sometimes right by the beach is a very Australian scene for me. Another is people, not just children, sometimes walking barefoot in shopping centres or in the city, but you can see that in New Zealand too, so what do I know?

Cheers mate!

Sunday, October 16, 2011

The Code Book by Simon Singh / The proof that we are a simulation

The Secret History of Codes & Code-breaking.

Simon Singh takes us on a journey through ages: from the cipher of Mary Queen of Scots, through Enigma, public key cryptography to quantum cryptography. He reveals the history of code making and code breaking.

The Code Book is not just about history. It is a study guide, too. Everything is illustrated with examples, formulas, and diagrams. Simon has a gift of describing frequency analysis, one way functions and even quantum computing in an simple way.

The Code Book is a great read. Highly recommended.

......................................

There is one thing in The Code Book, which may be interpreted as a proof that we live a computer simulation. It is about Thomas Young's experiment with a light source, a partition with two slits, and a screen. That experiment shows the wave nature of light. Waves of light reinforce or cancel each other producing multiple stripes on the screen. But nowadays we can send just one photon, wait for a minute, then send another, again wait, send another and so on. In this case, should we see multiple stripes on the screen or just two? Each photon that we send has no other photon to interact with, so it should behave like a particle and just go through one of the two slits. There should be only two stripes on the screen.

Simon writes: "However, for some extraordinary reason, even with single photons the result on the screen is still a pattern of light and dark stripes, just as if photons had been interacting." There are two scientific theories currently that try to explain it: superposition and multiverse. Either the photon passes through both slits simultaneously and then interacts with itself - that's superposition, or the universe splits into two which interfere with each other - that's multiverse.

Well, I'm a programmer, and from my point of view it looks like a silly bug. If I was designing the universe, I could easily make an error of assuming that the characters in my world would never get smart enough to send a single photon, so I would take a shortcut and compute the pattern as if photons were sent continuously. It's a simpler explanation than superposition or multiverse, isn't it? :-)

I need to learn more about photons.

Tuesday, October 4, 2011

Washington, DC


Originally posted 2010-04-18.

During this spring break we went on a trip to Washington, DC. After a long winter the flora was eager to flourish again. A thick layer of pollen was obstructing visibility and making life difficult for people with allergies all the way from Florida to DC.

In South Carolina we saw this fine specimen of Luna Moth.
 We spent most of the time in Washington around The Mall - the downtown area where most important institutions of the U.S. government are located.

Here is one of them, the well known classical Capitol building.






 

The most famous museums in Washington belong to the Smithsonian Institution, and the most famous of them is the Air and Space, which takes pride in the quality of their artifacts: it showcases only originals in perfect condition. The admittance is free and the guided tours are excellent. Here are some examples of what is on display.

A nose section of Boeing 747.

















The Enterprise orbiter. Smithsonian will get a real space shuttle after they are retired by NASA, if it can find the 20 something million dollar fee NASA wants for shipping and handling.









The retired British-French supersonic passenger jet - the Concorde.







Do you know why the windows are so tiny? It's because Concorde was flying much higher than other passenger jets, and if it lost a regular sized window, it would not be able to descend to safe height before suffocating everybody on board.


Enola Gay is the name of a B-29 plane that dropped an atomic bomb on Hiroshima. This specimen, like all others at Smithsonian, is an original.

   












The underside of a Predator UAV.












Finally, the UAVs. Boeing X-45 was an experimental Unmanned Aerial Vehicle. UAVs are the future of military aircrafts.

Our volunteer guide, a retired pilot, said that the F-35s are probably the last manned fighters the U.S. will produce.






Some less known museums and attractions.




Botanical Gardens near the Capitol.














The Building Museum was originally a home to the U.S. Pension Bureau headquarters.

Imagine that floor with a fountain in the middle, and plenty of air and natural light filled with desks.

This is what I call a decent office space.













The Basilica of the National Shrine of the Immaculate Conception - the largest Roman Catholic church in North America.















Ghostly Korean War Memorial.










The Postal Museum located near the Union Station is new and surprisingly interesting. You can learn that parts of U.S. Route 1 were originally a trail used by native Americans, and later by mail riders.  You can learn that pneumatic mail delivery systems were operating in major U.S. cities in the XIX century.




U.S. Mail travelled under the seat of the driver of that stagecoach.













An ingenious postal snow mobile.

   


     








On the way back to Florida, we stopped again in South Carolina and visited Patriots Point Naval and Maritime Museum near Charleston.



Slowly deteriorating USS Yorktown aircraft carrier at Patriot's Point in South Carolina.










Towards the end of the war, the kills consisted mainly of trains, planes on the ground (sitting ducks), and ships.












The legend for the stats.






International maritime signal flags.







Most planes on USS Yorktown are displayed with their wings folded allowing us to peek into the folding mechanism.

Japan - Tokyo, Yokohama - First Impressions


Originally posted 2008-03-22. 

First impressions:
Long lines for passport control for foreigners at Narita Airport. I have waited for about 45 minutes. After the passport control everything went much smoother:

It was easy to use a public phone.
It was easy to buy a bus ticket.

On the bus journey to Tokyo my main impression was that Tokyo was more similar to European cities and thus more familiar to me than most of the U.S. cities I have seen:

The sidewalks made from pavers and actually used by people to walk.
The maximum use of space.
The trees planted in the sidewalks despite their narrowness.
The Carrefour and IKEA shops.
The buses and the trains.
The metric system: standard road signs in kilometers, temperature in degrees Celsius.

Small things.

The east entrance to the Imperial Gardens in Tokyo. The Imperial Palace is not visible from any point. The emperor does not wish to be disturbed.


Shin-Yokohama means new Yokohama. The Shinkansen stops at Shin-Yokohama. Tokyo Central is only two stops away.


This is a picture of one of the 3 types of Shinkansen trains operated by JR Tokai. I love these trains: fast, quiet, safe, comfortable.


   The view of Tokyo from the Tokyo Tower.