Google is shelling out $400 million to buy a secretive artificial intelligence company called DeepMind.