Wednesday 23 October 2013

Programming fault-tolerant babies

One of the things that many new parents share with new programmers is a lack of experience with how their charges (babies or software) should best adapt to the world around them. When I became a father for the first time, one crucial goal was to ensure that my new son was getting enough sleep. So that meant making sure that his room was quiet and that people tiptoed around and spoke quietly when he was sleeping.

New programmers are often given tasks such as writing a program to read a list of numbers and calculate their average. So the programmer creates a list of ten numbers which he uses to test his program. After a while, he has a program that works perfectly. He even tries a list of five numbers and a list of twenty numbers and it continues to work perfectly.

However as soon as he releases the program into the public domain, he receives reports that it isn't working. Confused, he investigates the reports and finds out that people have lists that contain letters as well as numbers. Or they are using commas instead of spaces to separate the numbers. Or the list is empty and the program crashes with a divide-by-zero error. Or the list can't be found. The naïve programmer's first response is to tell the users that they're doing it wrong. The program expects a list of numbers so give it a list of numbers! Sheesh.

The more experienced programmer realizes that programs shouldn't crash and burn just because they can't handle the input correctly. They should give advice to the user to help them provide appropriate input and be nice about it.

Similarly with parenting young children. It is sometimes possible to create a perfectly quiet environment when you have only one child. Though it can still require a lot of effort by the parents to keep it that way. But what happens when you have visitors, or have more kids, or have noisy cars in the street? At some point it becomes easier for everyone if the baby can sleep despite the background noise or the ambient light and feed happily despite the odd location or the precise milk temperature.

Although having siblings banging loudly on the baby's door might still be input that it is better to try to prevent!

Monday 21 October 2013

Calvin and Pink

As part of a discussion on Calvinism and free will, I read A.W. Pink's 1928 essay titled "God's Sovereignty and the Human Will". He defended three theses, one of which seems sensible and two that don't.

1. People's beliefs and actions have their cause in their nature and motivations (Pink gives his examples of motivations such as "the logic of reason, the voice of conscience, the impulse of the emotions, the whisper of the tempter, the power of the Holy Spirit"). I think his basic point is right. We don't make our choices in a vacuum. You choose to open your umbrella because you don't want to get wet. You choose to tell the truth because you believe it is the right thing to do (or perhaps don't because you're trying to avoid getting in some trouble).

2. People do not choose the good and they lack any ability to do so. This denies the common experience of the good things that people often do. The Calvinist response is to either deny that those things are actually good or else state that they are outwardly good but lack any good motivation. Both responses seem to assume their conclusion by appealing to the agent's apparently unobservable "true" nature and motivation.

3. People have no ability to choose the good and they are morally responsible for not choosing the good. This also seems clearly wrong. Consider an analogous situation where you discover that a small child is drowning and that there is no way to save him except by swimming out to him. However, you can't swim and so he drowns. Can you be morally responsible for not saving him?

Thursday 17 October 2013

A Nobel effort

This year's Nobel Memorial Prize in Economic Sciences has been awarded to three path-breaking economists for their empirical analysis of asset prices.

Eugene Fama is the father of the Efficient Market Hypothesis (EMH) which states that financial markets instantly factor in all known information into asset prices. One implication of this hypothesis is that professional investors cannot outperform the market except by luck. Therefore the best strategy is to simply invest in an index fund.

Robert Shiller challenged the EMH with his findings that the volatility of stock prices is greater than would be expected by the changes in dividends. His work has been part of the behavioral revolution in economics which studies the psychological factors in economic decisions and their effect on markets.

Lars Peter Hansen developed statistical tools that greatly simplified the analysis of asset prices.

Of relevance to all this, in Thinking Fast and Slow, Daniel Kahnemen describes his statistical research that demonstrates the inability of professional investors (including fund managers) to consistently beat the market. As he puts it, "There is general agreement among researchers that nearly all stock pickers, whether they know it or not - and few of them do - are playing a game of chance. The subjective experience of traders is that they are making sensible educated guesses in a situation of great uncertainty. In highly efficient markets, however, educated guesses are no more accurate than blind guesses."

Monday 14 October 2013

A simple solution to the Gettier problem

Long ago, Plato proposed that knowledge is justified, true belief. That is, your beliefs count as knowledge if you have good evidence for them and they are actually true. Otherwise they are either mere opinions or false beliefs.

This definition seemed to reflect the common use of the term through history. However, in more recent times, Edmund Gettier provided counterexamples showing that if a belief relies on a false premise, then it won't commonly be regarded as knowledge. For example, you may believe the correct time by looking at the clock on your wall. But your belief doesn't count as knowledge if your tacit assumption that the clock is working is mistaken.

My amendment to Plato's definition is to recognize that for a conclusion to be known, any essential premises also need to be known. This is a slightly stronger formulation than William Lycan's excellent no-essential-false-assumptions analysis.

My proposal for the definition of knowledge: For S to know that P is true means that:
(1) P is justified
(2) P is true
(3) P is believed
(4) S knows that the essential premises of P (if any) are true

One intuition for this definition is that knowledge is constructed hierarchically like building blocks. If a low-level building block fails, then building blocks that sit on it are not supported and so also fail.

Thursday 10 October 2013

Plausible denial

Linda is 31 years old, single, outspoken, and very bright. She majored in philosophy. As a student, she was deeply concerned with issues of discrimination and social justice, and also participated in anti-nuclear demonstrations.

Which is more probable?
  1. Linda is a bank teller.
  2. Linda is a bank teller and is active in the feminist movement.

Also think about why you think the option you chose is more probable.

Cognitive psychologists Tversky and Kahneman posed this question in an experimental study and found that 90% of respondents chose the second option. However the correct answer is the first option. The reason it is correct is that two conditions occurring (being a bank teller and being a feminist) is less likely than for one of the conditions to occur (being a bank teller regardless of whether she is a feminist or not). Tversky and Kahneman coined this the Conjunction Fallacy.

What is true is that the second option is a more representative, more coherent and more plausible match with Linda's personality description. Linda doesn't really seem the bank teller type but being a feminist would certainly be in character. Thus, instead of making a judgment about probability, most people substitute a judgment about similarity instead.

Does this actually matter in practice? Yes, it matters when important life choices are made based on similarities rather than probabilities. For example, a doctor may diagnose a patient's illness due to symptoms being representative of a particular disease (or even of having no disease at all) when in fact other diseases are more likely.

Tuesday 8 October 2013

Conditioned thinking

Steve is a shy and tidy man. Is Steve more likely to be a librarian or a farmer?
 
With a few facts about librarians and farmers, it is possible to calculate the exact likelihood. In the US, there are twenty times more male farmers than male librarians. If four out of five librarians are shy and tidy and only one in five farmers have both those personality traits, then how likely is it that Steve is a librarian rather than a farmer?
 
Bayes' Theorem enables us to calculate the precise figure. The answer, perhaps surprisingly, is that Steve has only a seventeen percent chance of being a librarian rather than a farmer.
 
How can this be? If you guessed that Steve was more likely to be a librarian than a farmer then why does this intuitive answer contradict the calculated answer? The reason is that while we readily recognize the stereotypical personalities of librarians and farmers, we tend to ignore the general population sizes of the groups we are analyzing. The population sizes complicate the calculation, so we use a representative heuristic instead that neglects the relevant base rates.
 
The moral of the story is that we should try to identify base rate information and allow it to moderate our intuitive conclusions. In this case, the knowledge that there are many more male farmers than male librarians means that the answer is likely to be much less than Steve's resemblance to librarians suggests.
 
--
 
I came across the librarian story in Thinking, Fast and Slow by Daniel Kahneman. Working through the problem, we have:
 
  L = Librarian, S = Shy and tidy, P(L|S) is the probability of L given S

  P(L) = 1/20 [ the probability of being a librarian (actually 1:20 which is 1/21, but rounded for simplicity) ]
  P(S|L) = 4/5 [ the probability that a male librarian is shy and tidy ]
  P(S|~L) = 1/5 [ the probability that a male farmer is shy and tidy ]
  P(S) = P(S|L) * P(L) + P(S|~L) * P(~L) = 4/5 * 1/20 + 1/5 * 19/20 = 23/100 [ the probability of being shy and tidy ]

  Now plug the above values into Bayes' Theorem:
  P(L|S) = P(S|L) * P(L) / P(S) = 4/5 * 1/20 / 23/100 = 4/23 (17%) [ the probability that a shy and tidy male is a librarian ]
 

Monday 7 October 2013

Square quotes

How would you measure, with a ruler, the square root of the number two?

One way to figure it out is by reading Plato. In Meno, Socrates shows how you can construct a square with an area of eight feet from a square with an area of four feet (that is, with two-foot sides). To do this, join four squares with four-foot areas together to make a larger square with a sixteen-foot area. Then draw a line between the midpoints of the adjacent sides of the sixteen-foot square to make a new interior square (see diagram). This cuts each four-foot square in half along the diagonal. Since you have cut each four-foot square in half, you now have eight two-foot triangles, with four of the triangles joining together to make a square with an eight-foot area.

You can follow a similar procedure to create a square with a two-foot area from a square with one-foot sides. Since the area of a square is equal to the side length squared, the side length of a square with an area of two feet is the square root of the number two, now easily measurable.

Or you could skip the philosophy and just read Pythagoras instead! The square of the hypotenuse is equal to the sum of the squares of the other two sides.

Wednesday 2 October 2013

Behavioral problems

The philosopher Gilbert Ryle is probably best known for his book The Concept of Mind which argues against Cartesian Dualism. This includes the proposition that much of what we consider private mental life is inextricably linked to perfectly ordinary and publicly observable behavior. For this reason he is usually considered to be a Behaviorist. However a more careful reading of his work shows that he rejects both the Dualist and Behaviorist extremes and instead adopts a common-sense position that rejects the errors of both sides.

To illustrate this, in Thinking and Saying, Ryle gives the example of two boys - one writing a letter and the other boy mimicking him. Both the Behaviorist and the Dualist agree that the boys actions would differ only if the mimic performs additional actions that his victim does not perform. Since no extra actions were witnessed, says the Behaviorist, their actions were therefore identical. Since no extra actions were witnessed, says the Dualist, the mimic was performing extra internal, unobservable actions.

Ryle's view, in contrast, is not that there were unobservable actions or that their actions were identical, but instead that the seemingly identical actions that we did observe were of different sorts. The broader context shows that their intentions and skills were different and so therefore their actions were different. This conclusion avoids both the "Nothing But ..." of Behavioral Reductionism and the "Something Else As Well ..." of Cartesian Dualism.
 

Tuesday 1 October 2013

Thinking about thinking

What is Rodin's The Thinker doing?

Ponder it for a while. Perhaps in trying to figure it out, you are doing what The Thinker is doing.

Presumably he is having thoughts. Perhaps talking to himself. Maybe, but is that all that he is doing? A greenback dollar is a piece of paper but also more than that. What exactly is he thinking about? What is he trying to achieve?

Suppose a teacher has set you a math problem. You are trying to figure out the answer - an answer that is already known by the teacher. But is The Thinker a student? If not, then who would know the answer to his problem?

Maybe the problem has no known answer, or is not well-defined or has never been posed before. If so, then The Thinker is more like an explorer. Perhaps he doesn't know what the hoped-for destination looks like. But maybe he's had some experience in this kind of territory in the past. He makes many wrong turns but also sees some promising avenues.

Either way, he has not yet reached his destination. The discovery of any new place first requires a journey.

--

A reflection on Gilbert Ryle's The Thinking of Thoughts: What Is 'Le Penseur' Doing? and Thinking and Self-Teaching.