Is selling placebos ethical?

Lying isn’t murder but murder is such a good morality yardstick that I’ll use it anyway. Imagine the truth as the victim, though people can and do actually die at the hands of disingenuity. From the US justice system:

  • First degree lie is any lie that is willful and premeditated.
  • Second degree lie is a lie that is not premeditated or planned in advance.
  • Voluntary falsehood is any intentional lying that involved no prior intent to lie, and which was committed under such circumstances that would “cause a reasonable person to become emotionally or mentally disturbed”.
  • Involuntary falsehood stems from a lack of intention to lie but involving an intentional, or negligent, act leading to falsehood. Note that the “unintentional” element here refers to the lack of intent to bring about the falsehood. All three crimes above feature an intent to lie, whereas involuntary falsehood is “unintentional”.
  • Assault could be related to telling misleading truths, or merely injuring veracity and not obliterating it. But that’s a story for another time.
  • Lies in self defense are generally considered acceptable if the lie doesn’t cause more harm than good.

To understand the scale of offense, here’s what the penalty for a corresponding murder in Arizona would be:

1st Deg Murder 25 – Life, or death penalty
2nd Deg Murder 10 – 25 years
Manslaughter 0 – 12.5 years
Negligent homicide 0 – 3.75 years

A criminal killer would be punished for every person harmed in crime. The same logic applies to a serial or mass misinformer.

Why is this interesting? First of all I recently enjoyed the Harvard course on Justice which was 12 hours of thought provoking discussion. I was amazed at how Professor Michael Sandel could sculpt even some seemingly moronic prepositions given by students into fine pieces of ethic argument. Thanks to this course I believe I may have the tools to tackle the moral dilemma of quackery, the promotion of unproven or blatantly fraudulent medical practices. Sadly the practice of quackery is still profitable and prevalent even after the 2000’s information revolution. But as much as I deplore the phenomenon I can’t bring myself to unequivocally denounce it because of its 10%-40% efficacy for certain ailments. I can’t even unequivocally denounce the expensive ones because the more expensive inert pills have been found to be more effective.

Health Fraud

To quote Tim Minchin:

Alternative Medicine […]
“Has either not been proved to work,
Or been proved not to work.
You know what they call “alternative medicine”
That’s been proved to work?
Medicine.”

“Proved not to work” may refer to:

  • Tested and found equally effective to another placebo
  • Tested and found not effective at all, or detrimental

Advising and practicing alternative medicine that’s been proven worthless or harmful should be prohibited because they are only causing harm and profiting from it. As obvious as it may be, there are many people who have and will get away with this crime. But what about the effective placebos? From a consequential perspective, they’re helping people and thus perfectly legitimate. From a categorical perspective, these quacks are committing 1st degree lies or involuntary falsehood at the least. Either way, the truth is left dead. Quite a few people are left a lot poorer, but ~20% of these poorer individuals will actually feel better. Is that worth it?

My philosophical judgement

I’m an agnostic utilitarian, meaning to say I believe a global human utility function may exist though I don’t know exactly what it is. In fact I believe all philosophers were closeted utilitarians. They all tried to improve aspects of humanity, or at least fix wrongs. The difference between these great thinkers was merely their choice of utility function, or their methods of modeling it.

Philosopher Utility Function
Aristo Telos – The greater good is achieved by things meeting their purpose.
Immanuel Kant Universalizability – The greater good is achieved by committing actions which should be universalized.
Jim Rawls Max-min – The greater good is achieved by maximizing the benefit of those which have the least of it.

To summarize, I believe we should maximize the benefit of man kind. Preserving life being one of the most clearly visible tenants of any tribe.

Seeing as how doctors and scientists work so diligently to provide humanity with well-researched, candid and effective solutions to health problems, undermining their value is simply atrocious. The place of modern medicine in the modern home is tarnished by the likes of the keywords “natural”, “holistic”, “alternative” and relatives. This has gotten to the point where individuals who believe in alternative medicine are more likely to avoid a visit to the physician, this I’ve met first hand. I have no estimate on the amount of lives lost per avoidance of a visit to the doctor by a quack-fan, any data found is welcome. But still, I must conclude that the general damage of people avoiding life-saving treatment is fundamentally more detrimental than the benefits of allowing alternative medicine as it is today. Mainly because placebos and alternative medicine are mostly relevant for non-life threatening ailments.

A better future with regulation

Considering the danger of undermining proper medicine, dispensers of alternative medicine should be licensed, registered and labeled as such and may only treat those ailments to which a placebo has been tested effective. I’m pretty sure these clinics wouldn’t mind posting on their walls and brochures “Licensed Alternative Medicine Clinic” or “Licensed Alternative Medicine Pill”. Hopefully this label is clear enough so a person who wishes to avoid ignorance can do so with ease.

Treatments statistically shown ineffective or detrimental should be prohibited by a government agency. Tight controls in the form of license revocation, fines and arrests of quacks promising more than they’re worth should allow a legitimate placebo market. That way doctors needn’t ever sacrifice their honesty to effectively prescribe placebos, and the general public can enjoy them at their leisure.

Appendix

Why I’m not leaving Python for Go

First of all, Go seems like a great language. It has an excellent tutorial which I joyfully went through and found:

  • Go is Fast.
  • Concurrent by design.
  • Typed (important for JIT and IDE’s) but not cumbersome and ugly like C or C++’s spirals.
  • Duck-type-esque interfaces.
  • The defer mechanism is really nifty.

But there’s one problem I can’t live with. Which is a shame as I was eager to make the leap of faith in the name of concurrency. That problem is errors are handled in return values. 70’s style.

Verbose and repetitive error handling

The designers of go consider this a virtue.

In Go, error handling is important. The language’s design and conventions encourage you to explicitly check for errors where they occur (as distinct from the convention in other languages of throwing exceptions and sometimes catching them). In some cases this makes Go code verbose, but fortunately there are some techniques you can use to minimize repetitive error handling.

This is one of the things I can’t stand in C. Every single line requires an if statement to prevent programs from doing crazy things. This is an official, canonical example from the aforementioned link with perhaps “minimal repetitive error handling”:

    if err := datastore.Get(c, key, record); err != nil {
        return &appError{err, "Record not found", 404}
    }
    if err := viewTemplate.Execute(w, record); err != nil {
        return &appError{err, "Can't display record", 500}
    }

The correct way to call a function in Go is to wrap it in an if statement. Even Println returns an error value that I’m sure most on the planet will never check. Which brings me to…

Errors passing silently – ticking time bombs to go

To quote Tim Peters:

Errors should never pass silently
Unless explicitly silenced

Go isn’t just stuck with verbose and repetitive error handling. It also makes it easy and tempting to ignore errors. In the following program we would trigger the doomsday device even if we failed protecting the presidential staff.

func main() {
    http.Get("http://www.nuke.gov/seal_presidential_bunker")
    http.Get("http://www.nuke.gov/trigger_doomsday_device")
}

What a shame. Oops.

In theory we could require the programmer never ignore returned errors. By static analysis or convention. In practice it’d be a pain worth enduring only in the most error critical programming tasks. Perhaps that’s Go’s purpose.

panic/recover

Panic and recover aren’t good enough as long as the standard library rarely uses them. Why is an array out of bounds any more cause for panic than a bad format string or a broken connection? Go wanted to avoid exceptions entirely but realizing they can’t – a few exceptions were tacked on here and there, leaving me confused as to which error happens when.

Perhaps another time

So I say this with much regret because Go has a lot of amazing ideas and features, but without modern error handling – I’m not going.

I’m still waiting for that open source, concurrent, bottom left language to come along. Any suggestions are more than welcome.

redditp – a fullscreen presentation with reddit

tl;dr – add a “p” before the “.com” to any subreddit you visit and voila, you have a fullscreen presentation of all the images.

I like to show my friends cool stuff on the internet but browsing is a real conversation killer. You can’t really lean back, talk and have fun with friends while operating a website, surely not one as clunky as reddit. Even though RES does help.

So I just had to make this “hands-free” reddit mode. Where I can see:

Easy!

Welp, not that easy, there was a lot of CSS to handle and the design right now is dead ugly but functional. Also, many stories on reddit aren’t images and I skip those that aren’t in a quirky way. If the url’s 4th character from the right is a dot, I display it. That’s a hack that works for imgur (which is most of reddit’s images) so I’m using it for now until I have more time to fix it. Any suggestions are more than welcome – help improve redditp on github! Also, comics are a pain to watch right now. I might implement some sort of scroll wheel zooming in the future, though that really is a bit of a different use case that might deserve a different site.

I guess not too surprisingly the first 200 visits where mostly to gonewild. You internet you….

edit – here are some stats from the launch night

redditp launch night stats

redditp launch night stats

Introducing Absolute Ratio

Let’s define the absolute ratio for positive numbers:

abs_ratio(x) = 1 / x when x < 1, otherwise: x

When x is smaller than 1 return 1 / x, otherwise return x. Here are a few example values:

x abs_ratio(x)
0.5 2
2 2
0.2 5
5 5

And a graph:

Absolute Ratio Graph

Another spelling for the same operator would take 2 positive numbers and give their absolute ratio:

And a graph:

Absolute ratio in 3D

Use case examples

  • Music and audio – an octave of a frequency F is 2F. More generally a harmony of a frequency F is N*F where N is a natural number. To decide if one frequency is a harmony of another we just need to get their absolute ratio and see if it’s whole. E.g. if abs_ratio(F1, F2) == 2 they’re octaves. If abs_ratio(F1, F2) is whole – they’re harmonies.
  • Computer vision – to match shapes that have similar dimensions e.g. their width is only 10% larger or smaller. We don’t care which is the bigger or smaller, we just want to know if 0.91 < W1 / W2 < 1.1 which may be easier to pronounce as abs_ratio(W1, W2) < 1.1
  • Real life – when we see 2 comparable objects we’re more likely to say one is “three times the other” vs “one third the other”. Either way in our brains both statements mean the same concept. We think in absolute ratios.
  • General case – When you want to know if X is K times bigger than Y or vice versa and you don’t care which is the bigger one.

Interesting Properties

  • abs_ratio(Y / X) == abs_ratio(X / Y)
  • log(abs_ratio(X)) = abs(log(X))
  • log(abs_ratio(Y / X)) = abs(log(Y / X)) = abs(log(Y) – log(X))
  • You can see from the above that absolute ratio is somewhat of an absolute value for log-space.

What’s next for absolute ratio

  • I’d love to hear more use cases and relevant contexts.
  • What would be the written symbol or notation?
  • How can we get this operator famous enough to be of use to mainstream minds?
  • About negative numbers and zero – right now that’s undefined as I don’t see a use case for that domain.
  • For some code and graphs in python checkout https://github.com/ubershmekel/abs_ratio

EDIT – I’m growing to like the binary form of the operator more so from now on let’s call it like this in python:

def abs_ratio(a, b):
    return a / b if a > b else b / a

Precision, recall, sensitivity and specificity

Nowadays I work for a medical device company where in a medical test the big indicators of success are specificity and sensitivity. Every medical test strives to reach 100% in both criteria. Imagine my surprise today when I found out that other fields use different metrics for the exact same problem. To analyze this I present to you the confusion matrix:

Confusion Matrix

Confusion Matrix

E.g. we have a pregnancy test that classifies people as pregnant (positive) or not pregnant (negative).

  • True positive – a person we told is pregnant that really was.
  • True negative – a person we told is not pregnant, and really wasn’t.
  • False negative – a person we told is not pregnant, though they really were. Ooops.
  • False positive – a person we told is pregnant, though they weren’t. Oh snap.

And now some equations…

Sensitivity and specificity are statistical measures of the performance of a binary classification test:

Sensitivity

Specificity

sensitivity and specificity

Sensitivity in yellow, specificity in red

 

In pattern recognition and information retrieval:

Precision

Recall

Let’s translate:

  • Relevant documents are the positives
  • Retrieved documents are the classified as positives
  • Relevant and retrieved are the true positives.
Precision, recall

Precision in red, recall in yellow

Standardized equations

  • sensitivity = recall = tp / t = tp / (tp + fn)
  • specificity = tn / n = tn / (tn + fp)
  • precision = tp / p = tp / (tp + fp)

Equations explained

  • Sensitivity/recall – how good a test is at detecting the positives. A test can cheat and maximize this by always returning “positive”.
  • Specificity – how good a test is at avoiding false alarms. A test can cheat and maximize this by always returning “negative”.
  • Precision – how many of the positively classified were relevant. A test can cheat and maximize this by only returning positive on one result it’s most confident in.
  • The cheating is resolved by looking at both relevant metrics instead of just one. E.g. the cheating 100% sensitivity that always says “positive” has 0% specificity.

More ways to cheat

A Specificity buff – let’s continue with our pregnancy test where our experiments resulted in the following confusion matrix:

8 2
10 80

Our specificity is only 88% and we need 97% for our FDA approval. We can tell our patients to run the test twice and only double positives count (eg two red lines) so we suddenly have 98.7% specificity. Magic. This would only be kosher if the test results are proven as independent. Most tests are probably not as such (eg blood parasite tests that are triggered by antibodies may repeatedly give false positives from the same patient).

A  less ethical (though IANAL) approach would be to add 300 men to our pregnancy test experiment. Of course, part of our test is to ask “are you male?” and mark these patients as “not pregnant”. Thus we get a lot of easy true negatives and this is the resulting confusion matrix:

8 2
10 380

Voila! 97.4% specificity with a single test. Have fun trying to get that FDA approval though, I doubt they’ll overlook the 300 red herrings.

What does it mean, who won?

Finally the punchline:

  • A search engine only cares about the results it shows you. Are they relevant (tp) or are they spam (fp)? Did it miss any relevant results (fn)? The ocean of ignored (tn) results shouldn’t affect how good or bad a search algorithm is. That’s why true negatives can be ignored.
  • doctor can tell a patient if they’re pregnant or not or if they have cancer. Each decision may have grave consequences and thus true negatives are crucial. That’s why all the cells in the confusion matrix must be taken into account.

References

http://en.wikipedia.org/wiki/Confusion_matrix

http://en.wikipedia.org/wiki/Sensitivity_and_specificity

http://en.wikipedia.org/wiki/Precision_and_recall

http://en.wikipedia.org/wiki/Accuracy_and_precision

The Python 3 Wall of Shame

Here’s my attempt at motivating package maintainers to port to python 3 and you can check out the code that generates the chart. I basically scraped PyPI (13,000 webpages) for this info and formatted it into an HTML table which is uploaded to appspot. I added a ‘cron’ task on my PC to recrawl PyPI every Sunday so the chart stays fresh. When developing the WOS I used filecache (from the previous blog post) so I could just write the code that parses the crawl as though it just now scraped PyPI while infact everything was cached to disk. Without filecache I would have had to either wait for ages, or write code that stores the scrapes, and reparses them. About 10 lines turn into an import and a decorator, now that’s magic.

I hope no one takes offense from this. The situation we’re starting at is pretty bad. Only 11 out of the top 100 packages on PyPI are labeled as supporting python3. There are a few glitches (e.g. multiprocessing) where the developers simply haven’t yet labeled the package as python 3 compliant.

Once we pass the 50% mark I guess we can change it from “Wall of Shame” to “World of Strength” or something because the subdomain is “wos”.

Projects I’d Like To Do

I’ve got too many things on my mind, I was thinking of doing the following:

  1. Help improve 3to2, sounds like it could help bridge the PyPI gap and allow for writing “backwards compatible” libraries, using the newest of technologies (it’s alot better than imitating decorator behavior using the silly syntax it’s sugar for).
  2. Help port Numpy to py3k
  3. Help port Django to py3k
  4. Build a small script that’ll crawl svn.python.org and give points to developers. [update: ohloh did it]
  5. Build a python ascii art lib (not one that does the greyscale trick, one that actually tests for lines etc).
  6. Build a pinax captcha app
  7. Make a py2exe, Freeze, py2app mashup that can easily compile on all platforms.

I think that’s it. I wonder how much of the above I’ll be able to complete by next month considering I’m really not good enough in Rock Band 2 drums yet.

Thoughts On Ecosystems And If There Is No Cold

  1. Does a self sustaining ecosystem aquarium/zoo exist? I mean like a closed space with a few different kinds of animals that sustains itself without an external food supply. Of course I’ve heard of a few lakes that only have water coming in and out, but what is the minimum size of a body of water or piece of land that can sustain a non-trivial amount of life?
  2. We like to think of ‘cold’ as the lack of heat. Why? Because there is a minimum of heat, or you could say a maximum of cold. But actually there’s also a maximum of heat, though it probably would be hard to reproduce in a lab. The maximum temperature is what you get when you make all the particles in the world explode thus summing up all their energies into one particle. That one last surviving particle that contains all of the universe’s energy, it’s temperature is MAX_T. So maybe this whole ‘there is no cold’ fiasco was a simplification of the real situation. Hot/cold is just a scalar with two end-points, call it heat, call it coolness, whatever.