Sunday, November 27, 2011

Meet Mayor Hashimoto

The Osaka city and prefectural elections have been called. Hashimoto is the new mayor, and Matsui, from Hashimotos Isshin no Kai party, looks to become the new prefectural governor. Hashimoto is on track on his plans to unite Osaka city and Sakai city to the south.

And with about 2/3rds of the voters approving this plan it seems it may actually become reality. He still needs support in Sakai as well, and ultimately approval from the central government; this is where popular support for that plan specifically can make a real difference. He's nothing if not a doer — things will undoubtedly be rather interesting around here the next few years. Good interesting or bad is the question.

Thursday, November 24, 2011


It's autumn at last. Cool, clear weather; leaves are turning color; Uniqlo is filled with shoppers looking for warm underwear in anticipation of the winter electricity rationing. Not much time to enjoy it this year, though. This time of year always seems to be the busiest as everybody pushes to get things done before the year-end holidays. And this is the last year for this project to there's plenty of extra pressure to get as much definite results as possible out the door in time for project reviews and final reports.

Each year, everybody with a camera is morally obliged to take at least one picture of colorful leaves. This is undoubtedly a leaf. It is arguably quite colorful. I have hereby fulfilled my obligation.

Speaking of autumn: We sometimes drink hot, sweet, spicy wine in Sweden around Christmas. Warm rice wine is moderately popular here in Japan and something I really enjoy. Shōchū or Awamori cut with hot water is another good drink for cold days or chilly evenings. A new variation to me is umeshu and hot water. Very strong, full sweet flavour and it really heats you up. You feel every sip right out to your fingertips; it's like having a portable heater installed in your stomach. Try it.

And on a scientific note, I posted on G+ the other day about a small Youtube film showing just how bad P-values really are for estimating the quality of experimental results. Check it out here. It's well worth seeing.

Friday, November 18, 2011

The Comfort Principle

Here's a neat way to think about things: spend your resources where you spend your time. He calls it "the comfort principle".

So, if you — like me — spend much of your day in front of your computer, then don't be afraid so spend money to get a really good one that will give you a minimal amount of problems and frustrations. I rarely listen to music on the other hand, so it would make little sense for me to get an expensive pair of speakers. And it'd make no sense at all for me to get a worse computer in order to get better speakers. Somebody who always listens to music and uses a computer only occasionally may take the opposite choice.

Of course, you have to look at the larger picture and be sure you're not optimizing the wrong thing. The author takes an office chair as an example: better to get a good, comfortable chair than a cheap one if you're going to sit all day. But what if you chose not to sit all day long instead? A cheap chair and a desk that lets you stand may be better still. And instead of a really good laptop, what I need is perhaps a job that doesn't put me in front of a computer every waking moment?

Kansai Airport
Kansai airport departure lounge. Airports and airplanes are exciting and memorable, but that's not where you spend most of your time during a trip.

This thinking doesn't just apply to buying stuff. I have a belt. It's a very nice, brown leather belt with a plain metal buckle that I got for my birthday from Ritsuko some years ago. It's sturdy and simple, and it looks good with any clothes I have. I like it very much.

However, the buckle always, inevitably sets off the airport scanner alarms. Whenever I fly I have to remove the belt and put it on the conveyor belt. And as I've been losing weight I really need a belt to hold my pants up. I stand there in front of the X-ray scanner, juggling belt, computer, phone, change, keys and carry-on bag with one hand while clutching at my jeans with the other. I'd drop something on the floor and scramble to pick it up while the people in line behind me start becoming restless. It's just a matter of time before I screw up and literally drop my pants in public.

So why do I use that belt on travel then? It's the comfort principle. I spend a total of, oh, five minutes or so per round trip valiantly trying to avoid a wardrobe malfunction in security. I spend around 3000 minutes of a three-day trip with my belt securely holding my clothes in place, and looking damn good doing so. I'd much rather optimize my wardrobe for the 3000 minutes of my trip than for the five minutes I spend in security.

If you see somebody obviously ill-dressed or badly packed for the security control, remember that they're probably not stupid. They may just know how to prioritize right.

Monday, November 14, 2011

If you want to sell news, at least get it right

I've mentioned the worldwide drop in violence previously, and I've occasionally touched on the role of media in distorting the perception of violence, crime rates and the perception of risk in general.

Here is a fresh new example, from both Asahi Shimbun and Yomiuri Shimbun, based on a white paper from the ministry of justice1. They report that "40% recidivism rate among youths released from juvenile facilities". Repeat crime rate among all arrested minors have risen to almost 32%, and has been increasing for the past 14 years! In 2004 the total rate was only about 27%; it's risen 5 points, or almost 20% in these eight years! Panic! Mayhem! Blood on the streets! Mass Hysteria!! Cats and Dogs Living Together!!!

Except, well, not.

Take a look at the graph from Asahi (reproduced here, as newspaper links have a tendency to disappear):

See something interesting? The rate of repeat offences — the red graph at the top — have indeed gone up. But look at the dark blue bar at the bottom: the number of repeat offenders have dropped, from around 4 minors in 10000 in early 2000's down to about 2.7 minors last year. That's a drop of 30%! Let me say it again: the number of repeat juvenile offenders have dropped by a third in ten years. This is good news.

And look at the light blue bars, with total juvenile arrests: from around 14 per 10000 in 2000-2002 down to about 8.5 last year. That's a drop in arrested minors of 40%! So, the proportion of arrested repeat offenders have dropped, but the total number of arrests have dropped even more. That's how the repeat offender rate has been rising — not from any worsening trend, but from two good trends, with one improving even faster than the other.

That's nowhere to be found in the Asahi article though. Even with their own graph in plain view, the text discusses only the repeat offences and never mentions that the total rates are down, not up. Yomiuri notes in a single sentence that the total number of offences has been dropping, with no further comment or any attempt to connect it to the rate.

Why the alarmist treatment? One reason can be that a bad news angle sells more papers, and the editors are more interested in their sales numbers than in the accuracy of their reporting. That, or the reporters at both Asahi and Yomiuri are so innumerate that they do not even realize what these figures are telling them.

I've been interested in the Asahi online subscription, where you get the full paper online at another 1000 yen over the subscription we already have. I'd happily pay for factual, balanced, well-researched news, but shoddy pieces like this are putting me off the whole idea.

#1 I've ben browsing their site but I can't seem to locate the white paper itself; it's either not obvious from the title, or it is obvious but my Japanese is insufficient to understand it. This is unfortunate, as Asahi talks about 40% youth repeat offenders while Yomiuri seems to talk about repeat offenders in general, though possibly about juvenile criminals that get arrested again as adults. I can't check this without the original report. Why can't media put links to their source material now that it's so easy to do?


OK, so you're into photography. Like most of us, you download your pictures from your camera, or you scan your negatives, then process them on your computer. Nice. Fun. Convenient.

But frustrating. Why? Because of color. As in, the color you saw in the scene is not what you see on your computer screen, which is not what you see on your other computer screen or what people will see online or what you end up with from your printer.

Coffee Break
This is one solution to color problems, of course. I love black and white; and with no color there is no problem with color casts.

Maiko at Shochikuza theatre in Osaka.

There's lots of reasons. Your camera doesn't really capture the "true" color (if you shoot negative film you know just how malleable "true" really is). A printer can't really reproduce all colors your camera can capture or your screen can show; it fudges things outrageously just to give you a vague impression of similarity.

But one frustrating reason is that your screen isn't neutral. Pretty much all screens have a color cast — they're bluish or reddish, or a green tint, or have some odd color shift between lighter and darker colors. And monitors change as they get older. The backlight changes color with age, and the screen pixel colors themselves can change with years of exposure.

So you carefully edit your pictures to look great on your computer. But if your screen is, say, a bit blue, then you will have added extra red to your pictures to compensate for that. They'll look reddish on other peoples screens, and come out red-tinted on your printer. Of course, their screens and your printer have color casts of their own, making things even worse.

You can't do much about other peoples screens. But at least you can do something about your own. Most image-related software today can handle "color profiles". That is, a file that describes how your monitor (or camera, or printer) handles color, and lets the software compensate for it. If you have a good color profile for your particular screen then your software can take it into account. Everything will look "right", that is neutral, as you work with it. It won't fix other peoples screens of course, but at least they get a nice, neutral, well-balanced image without color casts to begin with. It should look better, at least, if not great.

Yodobashi - Color
Why can't we just eyeball the color cast ourselves? Because we are really, really bad at evaluating color accurately. Any hint of the right color and we "fill in" the rest ourselves. The picture above is black and white. I added a few areas of solid color tint to it — red, green and blue areas for the signs in the background, muted orange for skin areas, a few splashes on clothes and bags. All colors are solid tints, and just vaguely similar to the real colors. Most of the image is still in black and white, with no trace of color.

Still, at first glance it looks like a natural color image to most people, and some refuse to believe it's largely black and white until you explicitly cover up the colorized parts. Our brains see the hints of color and fills in the rest by itself.

How do you create a color profile? You use a "colorimeter" — a device that measures the color on a screen, or paper — together with software that takes the measurement and generates a color profile from it. There's a few such devices for sale out there like the Pantone Huey or X-Rite ColorMunki. They work well enough. But the software is not open source, so you're dependent on them to support you in the years ahead. If the company goes bust or they decide to discontinue support for newer OS version your expensive device ends up as a paperweight. They also typically work only on recent Macs or Windows machines.

Enter ColorHug. It's a colorimeter, built as open hardware (schematics and the firmware is available for you), and with open source software for Linux. It's a fair bit faster than other systems, and less expensive too. The developer is gearing up for a first production run, and has just announced an advance order program that gets you a unit at a discount in exchange for helping out with reporting bugs and issues.

This is very useful for Mac and Windows users too by the way. The software is for Linux, but the color profile files are the same for every operating system. You get a bootable CD with a Linux system, so you can boot the CD, calibrate your monitor, then use the profile in your own operating system with no problem. And of course, the client software is open source, so somebody is bound to port it to both Windows and Mac if there is enough interest.

I've sent in my preorder already. Interest seems huge, though, so I can only hope I'll actually get one.

Saturday, November 12, 2011

Data collection and analysis app, anyone?

Here's a question for people doing data analysis and programming. I'm looking for a tool that I don't know if it exists:

I often find myself collecting data over time; temperature data, my weight, baking results, lots of stuff like that. I want to be able to very quickly, simply, add data on a daily or hourly basis and do my own exploratory analysis and visualisation. Normally I use a spreadsheet, or hack together a small script to deal with the data, but neither is very convenient.

  • A spreadsheet lets you enter data as it comes in, but both data entry and analysis is clumsy and rudimentary, and you soon hit the wall in what you can do with it. Try to write a spreadsheet that correlates your data with the day of the week, for instance.

  • Octave, R and tools like that are very powerful. But they're not really geared for this kind of simple daily data entry and presentation.They're really about analysing fixed data sets and don't do interactive data collection very well.

  • One-off tools in Ruby or Python will do what I want of course, and in practice it takes less effort than doing this kind of interactive thing in Octave and the like. But it feels like I'm reinventing the wheel every single time.

I'm really looking for a tool somewhere between a completely open-ended scripting environment and a restrictive tool like as spreadsheet; Octave or R but geared towards interactive, daily data collection rather than extensive analysis of fixed data sets.

Is there such a thing?

If not, it may be time to start thinking about creating it. A spreadsheet-like, but more task-specific, frontend, with a good way to enter new data and a real language to do your data analysis. Bonus for being able to generate a matching data entry component for Android phones (can't sideload apps on iPhone).

I'm crossposting this to Google+, and you can also reach me through email as well of course.

Thursday, November 10, 2011

Porn and Atheism

PZ Myers of Pharyngula asks why somebody can't both do porn and be a spokesperson for atheism? It's not like pornography is illegal, or even seen as wrong by a substantial population after all. I think he's missing a point. It's not about what is permissible, or what is somebody's right. It's all about communication effectiveness.

Leaving aside the two particular things — porn and atheism — in the post above, you can't really do more than one even slightly controversial or disputed thing in public, and still be an effective spokesperson. When you publicly arguing for a particular cause you can potentially reach anybody who is inclined to at least listen to your arguments. If you are also publicly arguing for a different, unrelated cause, you're likely to lose those who are firmly against this cause, even if they're sympathetic to the other one.

Anybody who is firmly set against your position in one field will by implication tend to reject your position in any other. As you publicly declare your opinion on more controversial issues, the circle of people receptive to your arguments in any of those areas will shrink.

If you are an economist, but also publicly a hippie and a drug liberal then many financial workers (who tend to be conservative and dislike people like you) will dismiss any argument you may have for financial reform, no matter how good how solid, your arguments. People who are sympathetic to drug liberalization may well give your economic arguments more weight than they deserve. If you're an arch-conservative fire-and-brimstone religious leader, then your arguments for, say, community schooling in poor areas may well be dismissed by many liberals and non-believers who suspect you're just trying to push your religion onto more people.

If you do porn movies and argue for atheism, you'll lose potential atheists that dislike porn. And you'll lose religious people that could otherwise view porn in a more sympathetic light. Companies love athletes as spokespeople; they typically do not take public stances on anything else, leaving the reach of the company message as wide as possible.

As private people we are free to live as we want, and argue for whatever we want. But if you choose to try to be an effective advocate of a cause then you do need to limit your public engagement in other areas.

Edit: edited the text for clarity. Never blog before morning coffee.

Sunday, November 6, 2011

Short Takes

You can track my work habits pretty reliably through this blog. If I am mostly coding or running simulations I write a lot around here. If I'm mostly trying to work on a paper or a presentation this place goes silent. No prices for guessing what I'm currently doing. The silence here gets worse now that I tend to post short notes on Google+ rather than here. I think I would like a way to repost those fragments around here too in some way. As a test, let me post links here to some recent posts of mine. Is it good, unnecessary, or annoying? Please let me know.

  • Vim Turns 20. Vim is a text editor, beloved by many programmers and other people that spend most of their time writing text. It's very powerful one you know it, but the learning curve is quite steep. I love it, and it's one of my main tools.

  • I get a lot of my daily information through RSS feeds. On my laptop I've used Google Reader for years, but after a recent redesign it's become unusable to me. I'm looking at alternatives such as Feedly, but I have not found anything that really works for me yet.

    If anybody has a good suggestion for a news reader, let me know. My main criteria is that I get the feeds in list form (no newspaper-like layout), that syncs with Google Reader, that it is navigable by keyboard and that I be able to go through items feed by feed (or group by group), not just all new items jumbled together in time order.

  • Japanese curry goes well with couscous. If you get tired of always having curry with rice, this is a good alternative. My Madeleine cookies are improving, but I still don't get the light and fluffy consistency I want. Any tips for fluffier Madeleines are very welcome.