Hooray for ExifTool

May 21, 2012 5:58 pm

Ever realize that the date on your camera is wrong and has been for months?  Wish you could correct the timestamps on all those pictures you took?  ExifTool can help (available for Linux/Windows/Mac).

I discovered yesterday that I hadn't updated our camera for Daylight Saving Time, so all the pictures since March 11 have been 1 hour off, not dire, but annoying.  I've had trips in the past where I forgot to change the timezone, but didn't know this tool existed, so the times on those pictures are just wrong.

In Linux I combined ExifTool with the "find" command to locate the photos taken after March 11 and adjust their time data by one hour so that they're correct:

#find . -type f -newermt 2012-03-11 -iname "*.jpg" -print -exec exiftool -AllDates+=1 -overwrite_original_in_place '{}' \;

I'll just stash this here for future reference, as I will probably need it again.

Jury Nullification

May 18, 2012 2:36 pm

Along with Bayesian reasoning, I think jury nullification is a topic that is important, yet widely unknown.  While somewhat controversial, I'll present my viewpoint and why I think it's important.  Before I start, I will note that I'm not a lawyer, and I'm limiting my discussion to criminal trials because the laws surrounding civil trials are different.

Borrowing from Wikipedia: "Jury nullification is a constitutional doctrine which allows juries to acquit criminal defendants who are technically guilty, but who do not deserve punishment. It occurs in a trial when a jury reaches a verdict contrary to the judge's instructions as to the law."  That is, a jury, though believing the defendant is guilty under the law, refuses to return a guilty verdict because they disagree with the law.

It certainly can be abused to allow criminals to go free who should be convicted, but I think far more important is that it can be used as another check and balance to protect the people from unjust laws.

What's particularly interesting is that jury nullification isn't something that can be outlawed without inherently jeopardizing the jury system at large.  What I mean is that jury nullification isn't a thing that was specifically created, it's more of a necessary side effect of having juries who can return verdicts without coercion.

In the United States, it is illegal to punish a jury member for the returned verdict.  I would hope that it is obvious why this law is necessary.  No jury could return an impartial verdict if they fear retribution.  Of course, there are laws against jury tampering as well, but the difference is that I could fear punishment without prior threat.  For instance, without this law one could be fired by one's employer after serving on a jury because one's employer didn't agree with the verdict.  For juries to even pretend to be impartial they can't be worrying about such consequences while deliberating.

In the United States, the other law necessary to create the opportunity for jury nullification is codified in the Fifth Amendment: "[N]or shall any person be subject for the same offence to be twice put in jeopardy of life or limb..."  Once a jury has returned a legitimate verdict the defendant can't be retried for the same crime.  Without this law a judge could simply continue issuing a new trial until the desired verdict was returned--effectively stripping the jury of any power.

With these two laws, jury nullification comes into existence as a possible avenue of justice and injustice.

Personally, I consider the benefits of jury nullification to outweigh the risks.  But that may be due to my predilection for the idea that it is better to let 10 guilty persons go free than to convict 1 innocent person.  I realize that many people feel instead that it is better to convict 10 innocent persons than allow 1 guilty person to go free, but I think that's rather sad (and perhaps a reason the U.S. has more prisoners than any other country in the world whether you measure per capita or absolute numbers).

The risk of allowing jury nullification is that like-minded individuals can allow criminal behavior by refusing to find defendants guilty when tried.  For example, an all-white jury of racists may refuse to convict a white person of murdering a black person.  This is clearly a bad thing and a failure of the justice system.  Yet this is entirely possible and legal because of the concept of jury nullification.

The benefit of allowing jury nullification is that like-minded individuals can protect themselves from an oppressive government.  For example, were the government to enact a law making it illegal to refuse a body search at airport security a jury could simply refuse to convict anyone tried under that law.  (What I find interesting is that this currently is law, yet the people that have broken it have never gone to trial.  I think the prosecutors are afraid jurors might refuse to convict and then airport security will look even stupider than they already do.  The most they've ever done is threaten a civil suit, which don't "suffer" from jury nullification because in civil suits the judge can override the jury.)

Of course, jury nullification only works if citizens are actually given jury trials for their crimes.  So when the government reclassifies you from citizen to terrorist and hands you over to the military for indefinite detention without a trial you're kind of out of luck.  I see this as a flaw rather than a feature.

Perspective

May 13, 2012 8:07 pm

We watched a movie last week on Netflix called Turtle: The Incredible Journey.


A. It was awesome.

B. I don't know what Heather finds to cry about. She didn't have to break out of an egg and then dig through sand for 3 days to get to the surface. She didn't have to then make a mad dash to the ocean, and she's certainly never been chased by crabs or birds who want to eat her. Her life is so easy!

Bayes' Theorem

May 12, 2012 3:38 pm

By request, here's my attempt to explain Bayes' theorem (cribbing heavily from Wikipedia).

Deriving Bayes' Theorem

We start with the standard definition of conditional probability (for events A and B):

3c5bf4874edc582346cb78a5eb66aaeb

Which reads: The probability of event A given the known occurrence of event B is equal to the joint probability of events A and B (e.g., the probability of both events occurring) divided by the probability of event B (assuming the probability of B is not zero).  I'm not going to show the derivation of conditional probability.

The summation axiom helps us understand the joint probability of A and B:

9e168c9112e06ac47b11fef388957692

It tells us that the joint probability of A and B is equal to the probability of A given B multiplied by the probability of B.  All we're talking about is the likelihood of events A and B both occurring.

Keep the following equivalence in mind, we'll need it in a minute.  It simply says that the order of variables when writing the joint probability is irrelevant.  It should be fairly straightforward that the likelihood of events A and B both occurring is the same as the likelihood of events B and A both occurring.

joint_equivalance

Filling back in our definition of conditional probability, we have (with the understanding that P(B) is not 0):

bayes_derivation

The third equation is the simplest form of Bayes' theorem.  It wasn't very hard to get to and the math, relatively speaking, is quite simple (we're not talking about deriving the Schrödinger equation or anything absurd).  But its application, and understanding what it means, can be tricky.

P(A) is called the "prior," representing our prior belief in the occurrence of event A.

P(A|B) is called the "posterior," representing our belief in the occurrence of event A after (post) accounting for event B.

The remaining pieces, P(B|A) / P(B), are called the "support," representing the support event B provides for the likelihood of event A occurring.

Applying Bayes' Theorem

I'll re-use the medical testing scenario from the previous post.

Substituting T to represent a positive test result and D to indicate the presence of the disease our equation becomes:

test_disease

We expand P(T) into P(T|D)P(D) + P(T|¬D)P(¬D) which is to say: The probability of getting a positive test, P(T), is equal to [the probability of getting a positive test when the disease is present, P(T|D), multiplied by the probability that the disease is present, P(D)] plus [the probability of getting a positive test when the disease is not present, P(T|¬D), multiplied by the probability that the disease is not present, P(¬D)].

So now we just need to map the numbers we have about the disease and the test to the variables in our equation:

P(D), our prior, is 1 in 200 million--the disease occurrence rate in the general population.

P(T|D), the probability of getting a positive test when the disease is present, is derived from the false negative rate.  When the disease is present, our test will only incorrectly say it is not 1 out of 200,000 times; so P(T|D) is 199,999 out of 200,000.

P(T|¬D), the probability of getting a positive test when the disease is not present is the false-positive rate: 1 in 100,000.

P(¬D), the probability of the disease not being present is simply the other 199,999,999 out of 200 million.

So let's plug these numbers in step by step:

test_disease_computation

And we see that P(D|T), the probability that the disease is present given a positive test, is only 4.76%.  (My previous post incorrectly reported this as 0.05%, I've corrected the error.)

The car example I presented didn't use hard numbers, but I'll frame the concept into Bayes' Theorem.  S will represent a car being stolen and H will represent a car being a Honda Civic:

stolen_honda

Which says, the probability that a car is stolen given that it's a Honda Civic is equal to [the probability that a car is a Honda Civic given that it's stolen] multiplied by [the probability of a car being stolen] divided by [the probability of a car being a Honda Civic].

The dealership was trying to push an insurance policy on me by only reporting P(H|S), but unless we account for the number of Honda Civics on the road in the first place, P(H), we aren't getting the full story.

(Notice that we don't have to actually care about P(S) if all we're doing is comparing car make/models.  P(S) doesn't change for the different make/models so it doesn't affect the relative rankings.)