Thursday, April 10, 2014

Finitism

Numbers are not infinite. I don't believe in infinity in the sense that for all numbers, there exists a larger number. There are a finite number of numbers. This is more a statement about what I think about the nature of existence.

For a finite universe, there is only a finite number of combinations of particles. Therefore, there is no way to represent even a single number beyond the set of all the integers up to that number of combinations.1 The axiom of infinity becomes pure myth exactly at the point where the platonic ideal of a number can no longer be reified. I don't believe that platonic ideals really exist.2

Objections: (1) What if the universe is infinite? (2) What if there could be an infinite number of particles in a finite space? And, (3), what if particles are positioned with infinite precision? I might be wrong. I have an extra-scientific feeling that the universe is finite, that there are a finite number of particles and that space is quantized. But I could be wrong, in which case, numbers could be infinite.

However, my second, weaker argument is that no one should ever care about an infinite number of numbers. Over all human history, past and future, only a finite number of numbers will be represented. An even small set will ever be economically useful.

Objection: What if human history is infinite? Not at the rate we're going.

Notes:
1. The Bekenstein bound might support this idea.
2. In social situations, I tell people that I don't believe in numbers. It's a sharp conversation starter.

Thursday, April 3, 2014

The Vaccination Game

One day the next town over has an outbreak of Nashococcal. One elderly man even died. Along comes a fat, red-faced doctor and starts offering a Nashococcal vaccine. "There is, however, a chance of swelling around the jab site and you will most definitely feel dizzy for twenty-six minutes afterward," says the doctor.

Do you take the vaccine? Of course! Dizziness for half an hour is much better than risking serious illness and possible death. By the same logic, almost everyone gets vaccinated. The doctor's double chin quivers slightly with worry as he recommends his vaccine: "Especially for old folk, children and others whose health is generally at risk."

There is, however, one family of right-wing, climate-change-denying, homeschooling UFO-worshipers that chooses not to be vaccinated. "It's got mind control stuff, agent orange. Sheeple!" As a person of logic, laws and general conformity to sound advice, you judge that these loonies are risking their health and worse, they are endangering their vulnerable children.

But are people who reject an otherwise well-distributed vaccine doing something crazy? Maybe not as much as you might think. Suppose that everyone in the world has already had the vaccine, except you. Unless you're actively infected, then Nashococcal has been eliminated completely. So would you let a nurse stab you for nothing? Not unless she or he were particularly attractive and free for a drink later.

You and the people in your community are playing the Vaccination Game. Each person's outcome depends on their action and the aggregate of everyone else's actions. The cost of being vaccinated is fixed:
The cost of being vaccinated = 26 minutes of dizziness and a chance of swelling
The chance of a Nashococcal outbreak depends on the number of people without the vaccine, so the expected cost to you of not being vaccinated yourself is some function of the number of people who aren't vaccinated:
Cost of not being vaccinated = f(number of other people not vaccinated)
What does this function, f, look like? Well it's increasing with the number of other people not vaccinated. It's probably non-linear, so that the cost of being not vaccinated increases faster and faster as more people are not vaccinated. Big outbreaks happen when the population isn't sufficiently vaccinated.

So what will people do? John Nash Jr. tells us that rational agents will play his equilibrium. At a Nash equilibrium, you choose the best actions for yourself, assuming that no one else will help you and that everyone else will behave similarly. At a Nash equilibrium:
Cost of not being vaccinated against Nashococcal = Cost of being vaccinated against Nashococcal
If the two costs were different, then everyone would change their probability of taking the vaccine and it would not be a Nash equilibrium.The exact proportion of people who get vaccinated will depend. But the moral of the story is the crazy family who didn't vaccinate might be just as well off as the Spock family who did vaccinate.2

What are some factors that affect how many people get vaccinated? If the disease is highly deadly, then more people will vaccinate. But if the disease isn't so bad, then people won't vaccinate as much. If the side effects of the vaccine are small, then more people will vaccinate. But if the vaccine is almost as bad as the disease, then few people will vaccinate. (Real life example: the flu vaccines that I've had made me feel flu-like for half a day or so. The actually flu makes you feel flu-like for a week or so. By this reasoning, if you think you've got a smaller than 1 in 14ish chance of getting the flu, then you shouldn't get a flu vaccine. Most years I don't.)

In practice, people are not rational agents but they act based on their perceptions. So real life might not be like my toy model. There are also other factors. Some people cannot be vaccinated at all, like newborns. So it's a moral imperative that you vaccinate yourself to reduce the chance that the vulnerable will be harmed by your inaction. The social good is not necessarily maximized at the Nash equilibrium. That's probably why  governments push people to get vaccinated: everyone will be better off if almost everyone gets vaccinated.

Notes:

1. Except in the two cases: First, no one takes the vaccine because it is always the worse option. (A bullet to the head often will eliminate any chance of future disease.) Second, the vaccine has no side effects and is always a better option. (I'm not sure if this is a real possibility or not; maybe it's something like taking vitamin C -- always a good idea.)

2. The idea of using game theory to model vaccination and epidemics is not new, see for example Bauch, C. T., & Earn, D. J. D. (2004). Vaccination and the theory of games. Proceedings of the National Academy of Sciences of the United States of America, 101(36), 13391–13394.

Thursday, July 11, 2013

On Artificial Intelligence

Could we somehow construct an entity that would be intelligent, without also being human? We have already built amazingly powerful computers that can add, subtract, multiply and divide better than any human being. Are computers, therefore, intelligent? Something in us says no, to be intelligent implies a wider range of skills than arithmetic. The devil’s advocate will announce that ‘computer’ used to mean ‘a person who computes.’ We must admit that, yes, computers can do some clever tricks with numbers. But an intelligent man needs only amateur arithmetic skills; a truly intelligent agent can employ strategic reasoning and martial logic to play a good game of chess. On the other hand, the chess machine Deep Blue beat the world champion Garry Kasparov in 1997 (Campbell et al., 2002). Chess has little of the uncertainty present in other domains, so maybe we ought to say that an intellectual should be able to act decisively in the face of his uncertainty fate while outwitting his opponents for his own gain, such as in the old game of backgammon. However, the TD-gammon algorithm can also play backgammon to a master level (Tesauro, 1994). The goal posts keep moving further away; our standard for intelligence increases each time a non-human entity reaches a measurable standard.

Turing (1950) suggested that we could identify intelligence through natural language rhetoric interrogation: get a judge that is known to be intelligent to have a conversation with some entity, and we let the judge decide if the entity is intelligent. The Turing test defines intelligence in a circular way: ‘if a known intelligent agent thinks the agent under test is intelligent, then the agent under test is intelligent.’ We escape the logical loop because we assume that humans are intelligent, or at least one of us is. The beauty of Turing’s test of machine intelligence is that it can encompass arithmetic, chess, backgammon and many other domains by encoding them into natural language questions. Google and Wolfram|Alpha both make laudable attempts to answer natural language questions in a staggering range of domains well beyond the latitude of any one human expert. Has an algorithm pass the Turing test of intelligence? Sort of. Google answers some questions with super-human ability and other with definitely sub-human ability. You would probably be better off asking your mother for relationship advice, while she would refer you to Google if you asked her about the capital of Madagascar. I suggest that instead of thinking of Google as being intelligent, we tend to think of Google as changing what ‘intelligence’ means. Google and the internet change the way we think (Carr, 2008) and some worry that these new media are infecting our minds, deleting previously relevant skills and replacing them with images of cats with mysteriously hovering witless captions written in crippled English. But people consistently adopt new technologies that enhance our abilities to think and partially abandon old skills as technology replaces them. Writing and calculators have decreased the importance of memory and arithmetic, respectively. A piece of paper can remember hundreds of words, but we do not consider that paper is endowed with intelligence. As a machine gets closer to being ‘intelligent,’ we hand over progressively higher level cognitive functions. Google is not intelligent but rather, we are more intelligent if we have Google.

Part of the beauty of the Turing test is that it can encode many other intelligence tests by way of word problems: “Let us play a game of chess. You are white. What is your first move?” or “Suppose Bob is a business executive with the opportunity to practice anti-competitive tactics. How should he balance the chance of being sued with the potential advantage to his company, if the situation is …?” But part of the trouble of the Turing test is that no exact programme of questioning is supplied. What must we ask an intelligent agent to prove their intelligence? We have devised a range of IQ and schooling tests for people, but perhaps those only test ‘academic’ intelligence: some people perform poorly in school but excel in other areas of life. We could require an intelligent agent to pass all possible interrogations but this would take an infinitely long time. In some ways, Turing provided us with an excellent framework for testing machine intelligence, but in other ways, I consider that the open ended nature of the test is a bug as well as a feature. If got a modern chatroom bot algorithm and tested its ability to fool a room full of educated men and women from 1950, I imagine the people would find the chatter bot to be indistinguishable from a person. But if we replaced the pool of testers with adults living today, would the algorithm perform that well? My point is that people’s expectations of the performance of machines has greatly increased in the last 60 years. I expect a machine to be able to converse about the weather and maybe even current events. But if I were recruited by an undergraduate psychology or computer science student to undergo a Turing-style test, I would intentionally ask questions that I thought a computer would not be able to answer. As computers get better at answering some questions (like IBM’s machine that plays Jeopardy), we humans invent new questions that computers are not so good at answering. Computers are good at chess, but in 1988 Walter Zamkauskas invented Amazons, a game that has a much larger game-tree complexity (Hensgens, 2001). To be able to answer all lines of reasoning, even those specifically contrived to defeat algorithms, is a very hard task indeed.

Turing thought that people would consider machines to be able to think by now. ‘Nevertheless I believe that at the end of the century the use of words and general educated opinion will have altered so much that one will be able to speak of machines thinking without expecting to be contradicted’ (Turing, 1950, p. 442). We anthropomorphise our computers when they hang, saying that the computer ‘is thinking,’ but I sense that Turing’s prediction has not come true yet. Why do we hesitate to call a non-human entity intelligent? Partly, because we fail to define intelligence in a complete and unchanging way. A further difficulty may be that we simply do not want to call a machine intelligent. Turing (1950) calls this the ‘Heads in the Sand’ objection to the possibility of thinking machines. Our species has a unique corner on being smart. Cheetahs are run faster and lions have more deadly natural weapons, but no animal can match us in the battle of intelligence. We live by our cunning. We classify other parts of the world as being agent-ish or non-agent-ish because the agent-ish things may turn on us with malice and deception. Our tendency towards self-interest and deception leads us to deny even other people of the coveted property of ‘intelligence.’ The more stupid something is, the easier we can exploit it to our own ends.

Perhaps an important attribute of intelligence is that ‘someone who is intelligent cannot be easily manipulated or exploited.’ For this reason, a cat may be more intelligent than Google because conducting searches with the website is usually easy, whereas cats resist many of our suggestions. We cannot defining intelligence merely as resilience to manipulation, because such a definition contradicts our intuition that a child is more intelligent than a mountain. Furthermore, we would have to admit that the chess and backgammon algorithms really are intelligent because they are difficult to overcome. Maybe Deep Blue and TD-gammon really are intelligent; at least they have the property of being winners in their respective domains of competition. The questions asked by a judge of intelligence should include social, multi-agent dimensions such as competition and cooperation. The importance of the social aspects of intelligence are relevant in multi-agent reinforcement learning (Buşoniu et al., 2008). ‘Agent-aware’ algorithms have the advantage over algorithms that believe they are the only actor in an otherwise random world. Minimax-Q (Littman, 1994) is a wonderful example of a Machiavellian algorithm, it plays in such a way as to maximise its payoff while assuming that its opponents will try to do it maximum harm.

So are computers intelligent? By Turing’s original definition, using people of his era as testers, I’d say yes. If we used people of the present era, then I’d say no. My conclusion: our definition of intelligence has been changing as our machines gain new abilities.

References

Buşoniu, L., Babuška, R., and De Schutter, B. (2008). A comprehensive survey of multiagent reinforcement learning. IEEE Transactions on Systems, Man, and Cybernetics, Part C: Applications and Reviews, 38(2):156–172.

Campbell, M., Hoane Jr., A., and Hsu, F. (2002). Deep blue. Artificial Intelligence, 134(1–2):57–83.

Carr, N. (2008). Is Google making us stupid? Yearbook of the National Society for the Study of Education, 107(2):89–94.

Hensgens, P. (2001). A Knowledge-Based Approach of the Game of Amazons. M. Sc. Thesis, Universiteit Maastricht, Maastricht.

Littman, M. L. (1994). Markov games as a framework for multi-agent reinforcement learning. In Proceedings of the 11th International Conference on Machine Learning, pages 157–163. Morgan Kaufmann.

Tesauro, G. (1994). TD-Gammon, a self-teaching backgammon program, achieves master-level play. Neural Computation, 6(2):215–219.

Turing, A. M. (1950). Computing machinery and intelligence. Mind, LIX(236):433–460.

Wednesday, January 9, 2013

Python Script for Transposing a Table in LaTeX

Sometimes you gotta try transposing a table in LaTeX, just to see if it looks better. It probably doesn't, but you gotta try. And it's a nasty job to be doing that by hand.

Try this:
(Download the .py file to keep that indentation right!)


#LaTeX table transpose
#Peter Raffensperger
#9 Jan 2012

import numpy

x = r"""
\hline
a & b & c & d & e\\
\hline
f & g & h & i & j \\
k & l & m & n & o \\
"""

x = x.replace(r'\hline', '')
tableRows = x.split(r'\\')
table = None
for i, t in enumerate(tableRows):
if t != '\n':
if table is None:
table = numpy.array(t.split('&'))
else:
table = numpy.vstack((table, numpy.array(t.split('&'))))

tableTrans = table.T.tolist()

tNew = ''
for row in tableTrans:
for col in row:
tNew += col.strip() + ' & '
tNew = tNew[:-2] + r' \\' + '\n'
print tNew

Saturday, January 5, 2013

Archimedes' War Machine


Archimedes entered the darkened room where the sibyl of the Oracle at Delphi sat on her tripod seat. He heard the woman raving as the priests translated the words of the prophetic god Apollo:
...
To wit, every single one.

If you count successive
Letters in Russian prose
Observe the likelihood
Of this one after that
Now then you find indeed
That the law of large sums
Generalises to
Those sequences that are
History dependent
...

"Which great future thinker sayeth these fell things?" Archimedes asked the chief priest.

"One Andrey Andreyevich Markov of Ryazan. But seek you now occulted things, things other than the deep knowledge of statistics, probability and history-dependent sequences?"

"Forsooth, I do seek! I must devise a war machine to defend Syracuse. Summon me one yet born, who knows things of strategy, of intrigue and complexity, and of those black things yet to be named that teach a nave the ways of bloodshed, revenge and violence."

The chief priest's eyes darkened. The smoke rising from the crack in the floor thinned. The sibyl of oracle abruptly stopped her babbling. The translating priests stopped on syllable four of the hexameter, interrupting their poetic description of the foundation of 20th century statistics.
This implies that ...

The smoke, raving, and translations then began anew:
Here you are, a spirit
Of trouble and deceit
Wars are fought on his guile
And nobles fall without
His counsel; So now heed:

I am John Forbes Nash two
The son of John Nash one
A mathematician,
And a man of great vice
But I have what you seek!

Calculate you must, the
Von Neumann-Morgenstern
Utility functions
For each of the players
To know his value for
Each possible outcome!

Then, we define a point
In the space of player
Strategies and vices:
The equilibrium!
At this magical point
No player can ever
Improve his lonely lot
By changing his vile plan
Without another's grace!

Find ye this fabled point
Of assured destruction
And act, fight, now defend!
You can do nothing more
If your enemy knows
What truly is in store

But evil, evil woe!
Beware exam marking!
Bad undergraduates
Always make undue haste
When writing their answers,
Filling reams upon reams
With poorly reasoned crap
And demonic scribbles
... 

Another brave man came to the oracle to make an inquiry about x-ray computed tomography, so the chief priest shuffled Archimedes off on his way. "But how?" inquired Archimedes, "How can I calculate your equilibrium point?" But the sibyl of the oracle silenced the soul of John F. Nash Jr and started the processing of summoning the soul of Professor R. H. T. Bates.