Two Truths and A Lie

I just tweeted a very interesting two truths and a lie:

  • P=NP
  • All even numbers greater than 2 are sums of primes
  • The logical conjunction of the above two

I'll leave the solution to the reader. It occurred to me while lying in bed, however, that it should be possible to make a list such that any of the three can be the lie. After a little thought and some trial and error, the following fits the bill:

  • One of the following two statements is false
  • One of the other two statements is false
  • One of the previous two statements is false

Simple, but it works. Neat.

This reminds me of the riddle in Inside Man:

Which weighs more: all the trains that pass through Grand Central Station [in NYC] in a year - or the trees cut down to print all U.S. currency in circulation? Here's a hint: It's a trick question.

Once again, I leave the solution as an exercise to the reader... or you can watch the movie.

EDIT: here are a few more humorous Two Truths and A Lie's I came up with:

  • Water is wet
  • Fire is hot
  • The cake

"well, obviously, the cake is a lie."

  • You think this one is true
  • You think the last one is probably the lie
  • You're not sure anymore

What?

  • Either you won't answer, or you'll answer correctly
  • Either you won't answer, or you'll answer incorrectly
  • You will answer

Interestingly, it's possible to correctly answer this last one. You can figure out how.

No comments

A Year in My Life

As most of you know, I keep a personal journal where I record my thoughts and significant daily happenings. Unlike most people who journal - but probably typical as a Linux guy - I keep my journal digitally as plain text. Because it's searchable, I often include references to previous events and people that I am reminded of. I almost depend on it now as an integral part of my memory, and will sometimes be surprised when some incident I remember wasn't recorded in it.

Anyway, recently I started playing with graph visualization. I discovered Graphviz, which automatically moves nodes arounds to make the graph understandable. Primarily I needed it to do some visualizations for my research, but I then realized that the back references between journal entries are perfect for visualization.

Here's the graph for 2009. There are some extra edges to entries from other years which are not drawn.


That's 99 vertices and 183 edges, out of 110 entries for the entire year. Because most entries only reference previous dates, the dates are earlier near the bottom of the graph. You can see some seemingly important dates in the year, ones which I reference often: 2009-03-08, for example, and 2009-04-05. They can be identified by the high in-degree.

Out of curiosity, I also made a graph for my entire journal, a small version of which is shown below. The full version is 27917x4667 pixels, and weighs in at 20 mb.


The horizontal lines are not indicative of anything - it's just an artifact from how Graphviz works. This much larger graph contains 940 vertices and 1821 edges, out of 1283 entries I've written in the last 8 years. I don't have anything to say about it though.
No comments

BMI on Craigslist

There was a post, w4m, on Craigslist. In it, the author listed that she was 170lbs (I'm not sure if she posted her height), and was looking for someone who's single, under 30, and has no kids.

As tends to happen on any anonymous internet board, someone replied that she was picky. Someone else posted that the requires were not particular at all (which I agree with). Then two other people chimed in to say that 170 is "pretty big" unless "you must be like 7'8?", and that 1"70 is large unless you are REALLY tall".

I was curious, so I looked up the Body Mass Index (BMI), which has the following form:

BMI = (weight * C) / height^2

where C is a constant adjusting for the units.

A BMI in the normal range means it is between 18.5 and 25, with 22 being the average. This gives a height range of [69.14,80.37] inches, with an average of 73.70 inches. The average height for American females above twenty is 64 inches, which results in a BMI of 29.18, firmly in the overweight category and bordering on obese. There is a 3.8% chance of her being within the normal range, as 96.2% of American females are shorter than 5'9.

So, while the Craigslist posters were harsh, they were also, unfortunately, correct.

On a different note, the section of the US female population least likely to be overweight is (sterotypically) the Asian/Pacific-Islander (25.2% overweight/obese). The next least likely (surprisingly) are those with a graduate degree (29.2%). Interesting.
3 comments

My Research

I've wanted to write this post for a while, but have never found the motivation to do so. There's a workshop this coming week, however, and I am scheduled to present this stuff on Thursday (today... I did okay, I think). So, I decided this is the perfect time to given a non-technical (that is, non-mathematical) introduction to what I do... there truly is no greater motivator than procrastination.

For those of you who don't know, I'm a grad student in computer science at the University of Michigan, specializing in artificial intelligence. Within this field, which is wider and deeper than most people realize, I am looking at the problem of reinforcement learning (RL). The formulation of the problem is simple. An agent interacts with some environment by performing actions. The environment reacts, and may occasionally reward or punish the agent. The goal of the agent is to maximize the amount of reward (or equivalently, minimize the amount of punishment) it gets. Hence the name reinforcement learning: the reward and punishment terminology is borrowed from the theory of operant conditioning in psychology.

Does this problem sound easy? It's not. Let's use a computer game as an example... say, Pong. A Pong agent has two actions available to it: move up and move down. The environment includes the ball and the opposite agent. A simple reward function gives the agent 1 point for winning a game and -1 point for losing the game. Now, put yourself in the role of the agent. You might think, "Oh, just follow the ball by moving up and down, and don't let the ball get past me." Well, you know that, but how does the agent know that? Remember, the agent doesn't know it is in a Pong game - all it observes are a bunch of numbers. The agent doesn't know it will be rewarded for getting the ball past its opponent, nor that it will be punished for letting the ball past it. It doesn't know that the ball will "bounce" when it touches anything - or even what constitutes "touching", "opponent", and "past".

Without any knowledge, the agent will have to act randomly, at least at first. It might get lucky and defend its goal once or twice, but more likely it will let its opponent score and be punished. There comes the first hurdle of reinforcement learning: how does the agent know what it did wrong? The converse is also true if the agent scored - what did it do right? This is called the credit assignment problem, because the agent is trying to figure out what gets the credit (or blame) for the reward (or punishment) it received. Again, remember what while you intuitively know that the agent missed the ball, the agent doesn't have any model of cause and effect to realize this.

To understand the basic solution to reinforcement learning, I must say more about those numbers that the agent observes. For Pong, there might be four numbers: the agent's vertical position, its opponent's vertical position, and the vertical and horizontal position of the ball. Each of these numbers are a state variable, and the different values these numbers can take in conjunction is called the state space - as in "the state of the union", not "the state of Michigan" - because they can describe every situation in the environment. To make reinforcement learning somewhat easier, researchers tend to view tasks as a Markov decision process (MDP). The distinguishing property of an MDP is that the next state of the environment depends only on the current state. For the Pong example, the state space described by the four numbers listed above does not make the game an MDP, since the ball can be moving arbitrarily fast or slow. If instead six numbers are used - the represent the horizontal and vertical velocity of the ball - then the task would become an MDP.

To be concrete, every action the agent takes changes the state of the environment. At each new state, the agent may receive a reward or a punishment, and then it has to take another action, and so on.

Now that the agent has some idea of how to relate one set of numbers to another, it can start learning. In place of human level reasoning, the agent simply plans backwards. Intuitively, if you get punished for being in this state, you know you shouldn't have taken that last action from the previous state. For Pong, this partially corresponds to not moving up if the ball is below you and just about to pass you. This picture is not complete though, because if you are at the top of the screen and the ball is at the bottom, you would not have gotten to the ball in time to deflect it anyway. This means that the faulty action lies further back in time.

Here's what the agent does. The agent remembers the state in which it got a reward or a punishment. Knowing whether this state is good or bad, it knows that the previous action from the previous state is also good or bad. Now knowing about this previous state, and can know about the state two steps back, and three steps back, and so on. That is, the agent learns by propagating the rewards back through the states, so the next time it finds itself in the same situation, it will either avoid that action (because it was eventually punished for it) or do the same thing (because it was eventually rewarded for it).

This was the state of the art 25 years ago.

Before I talk about more recent developments in the field, I want to raise a few problems in the solution above. The shallowest, but also most thought provocative, is this: how does the agent know it's doing its best? Imagine the task is to go from the bedroom to the bathroom to pick up an object. Through pure chance, the agent does this by going through the living room, the kitchen, and the broom closet, despite there being a door directly between the two rooms. Further imagine that the agent is rewarded based on how quickly it gets to its destination (I'm sure you can think of a reasonable, real life scenario for this). How would the agent know that the path it found is the shortest one? This problem is known as the exploration-exploitation problem. It is thus named because the agent needs to explore to know more about the environment, but this often means not exploiting the best action for the agent. In practice, researchers simply make the agent act randomly some small percentage of the time, so it will do its best for the most part but be constantly exploring. For the jargon-philiac, this is called an epsilon-greedy exploration strategy, where epsilon is the small percentage mentioned above.

There are other variations to this general framework which researchers are working on, such as partial observability (what if the agent doesn't know the value of some state variables?) and stochastic actions (what if actions only succeed some of the time?). I will skip the details on these topics and instead focus on what I'm looking into.

Pong, while an illustrative example, is not the most complicated environment for an agent to learn in. For one, there are only a limited number of situations for the agent to be in: in the original pixelated arcade game, there might only be a thousand or so different states. A modern computer running the algorithm I described above would find the optimal strategy (or policy) in less than a minute. Consider instead the rooms example I just gave, where the agent must move from one room to another. There can be an arbitrary number of rooms, and each room itself can be arbitrarily large. Even if the starting and ending positions are unchanged every time the agent must complete the task, it might still take the agent a long time simply due to how much exploring it has to do.

Yet, unlike Pong, this more complicated problem also presents more information for the agent to use. For example, completely exploring one room is useless when the goal is in another room. If you were to give directions to a human, you might tell them to go out of the room, walk down the hallway, and take the last right. Alternately, you might tell them that the thing they're looking for is not in the living room, but in the kitchen. The other person, on hearing these instructions, could then ignore everything in their current room.

What these two instructions have in common is abstraction. The first instruction abstracts over actions (it doesn't say "take 10 steps forward, then 2 steps left,..."), while the second instruction abstracts over states (it's saying that everything outside the kitchen is one room which doesn't matter). Despite this distinction, the two types of abstractions are related: the first instruction is implicitly saying that the current room and the hallway are not worth exploring, and the second instruction can be thought of as the action "go to the kitchen".

My research is related to this idea, although it's a little more specific. Expanding the example beyond rooms, if I'm giving instructions for someone to get to the Eiffel Tower in Paris, I would tell them to get to the airport, take a plane, etc. Each of these "actions" can be further broken down: order a cab, get out of the house, get in the cab,... And even further: walk to the phone, call the cab company,... This is called an action hierarchy, as the first actions "contain" the second ones, which "contain" the third, and so on, until at the lowest level the actions are simply "move this muscle". How do humans break down such a complex task, and can a computer do the same thing?

So far, the state of the art (which is about 5 years old) is "sort of". Given just the MDP assumption, there are proposals for what subgoals should be. The most general ones are different ways of identifying bottlenecks - that is, states which an agent must go through to reach a goal. Think of the door to a room, and in order to get anywhere else you must first go through that door. Other ideas include things like looking at what states you have commonly visited in your experience, or perhaps looking at what you're rewarded handsomely for.

Even knowing what appropriate subgoals are, the agent is not done. Imagine that both the door to your room and the door to the apartment are given as subgoals. How will you know that the door to your room is the first thing to go for, before trying to read the door to your apartment? Depending on the viewpoint, this could either be a problem of restricting the proposal of actions, or it could be one of inducing a preference on different possible actions. This appears to be a slightly easier problem to solve, and I was surprised to find that there is almost no prior work in this area. I intend to look into this question further, and hopefully by the end of the summer I will have some intuition as to what might work and what won't.

Post script: to people not in computer science or perhaps in but not in AI, the problem of action hierarchies might sound insignificant. Despite my previous misgivings about being limited to too specific a field, I find this problem genuinely interesting. Although it may not change the world (yet), I do think its solution will contribute to an understanding of humans and intelligence.
No comments

Can You Hear Me?

I sang this song with the choir back in middle school. We got either second or third place in the Hong Kong wide competition with this.

Although my middle school years were mostly terrible, this song has always stuck with me. It floats into my thoughts every once in a while.





Can You Hear Me?
(By Bob Chilcott)

I look around me as I grow
I'd like to tell you all I know
I see life with all its energy
The city streets, the rush time
This is my world, it's where I like to be
So much to see, so much to find
I sometimes sit and wait a while
See the sun, it makes me smile
Can you see it
Can you see it too

I feel life with all its energy
The joy of waking every day
This is my world, it's where I like to be
So much to do, so much to say
I sometimes sit and feel the sun
Its warmth is there for everyone
Can you feel it
Can you feel it too

My world is a silent one
But it's enough for me
I hear you through your hands
The movement sets me free
But it could be a special thing
To hear your voice
To hear your sing
Can you hear me
Can you hear me too
1 comment

Intermediate

I have another post in the writing, but I want so share my discovery that my experiment on Craigslist is no unique. At least two other people have done it before: Simon Owens, whose results were "tame" like mine, and Jason Fortuny, who posted all the replies he got on Encyclopedia Dramatica (both of these are definitely NSFW). I believe several people lost their job over the Fortuny case, and more had to deal with problems in their family.

On the ethics over Fortuny's case, I happen to think he should not be punished. Legal considerations aside, I think the fault lies mostly on the people who replied to his ad for giving personal information to a stranger on the Internet. Without evidence otherwise, the worst case assumption should always be made.

That said, I don't think Fortuny is a shining example of how humans should act, either.
No comments

Prologue to Jurassic Park

I've only written once about the environment and environmental causes, although that was in reference to a larger issue. My apathy is mentioned in passing elsewhere as well. I might have eventually written more on the subject, but I just discovered that the prologue to Michael Crichton's Jurassic Park (now a major motion picture) very articulately explains my views. It is copied below for your enjoyment.
You think man can destroy the planet? What intoxicating vanity. Let me tell you about our planet. Earth is four-and-a-half-billion-years-old. There's been life on it for nearly that long, 3.8 billion years. Bacteria first; later the first multicellular life, then the first complex creatures in the sea, on the land.

Then finally the great sweeping ages of animals, the amphibians, the dinosaurs, at last the mammals, each one enduring millions on millions of years, great dynasties of creatures rising, flourishing, dying away -- all this against a background of continuous and violent upheaval. Mountain ranges thrust up, eroded away, cometary impacts, volcano eruptions, oceans rising and falling, whole continents moving, an endless, constant, violent change, colliding, buckling to make mountains over millions of years.

Earth has survived everything in its time. It will certainly survive us. If all the nuclear weapons in the world went off at once and all the plants, all the animals died and the earth was sizzling hot for a hundred thousand years, life would survive, somewhere: under the soil, frozen in Arctic ice. Sooner or later, when the planet was no longer inhospitable, life would spread again. The evolutionary process would begin again. It might take a few billion years for life to regain its present variety.

Of course, it would be very different from what it is now, but the earth would survive our folly, only we would not. If the ozone layer gets thinner, ultraviolet radiation sears the earth, so what? Ultraviolet radiation is good for life. It's powerful energy. It promotes mutation, change. Many forms of life will thrive with more UV radiation. Many others will die out. Do you think this is the first time that's happened? Think about oxygen. Necessary for life now, but oxygen is actually a metabolic poison, a corrosive glass, like fluorine.

When oxygen was first produced as a waste product by certain plant cells some three billion years ago, it created a crisis for all other life on earth. Those plants were polluting the environment, exhaling a lethal gas. Earth eventually had an atmosphere incompatible with life. Nevertheless, life on earth took care of itself. In the thinking of the human being a hundred years is a long time.

A hundred years ago we didn't have cars, airplanes, computers or vaccines. It was a whole different world, but to the earth, a hundred years is nothing. A million years is nothing. This planet lives and breathes on a much vaster scale. We can't imagine its slow and powerful rhythms, and we haven't got the humility to try. We've been residents here for the blink of an eye. If we're gone tomorrow, the earth will not miss us.
2 comments