Category: Miscellaneous

Weather Prediction Error

I wrote a Python script to download the 1 through 5 day predictions for the weather in the top 50 American cities from the Weather Underground. I’ve got almost 2 years of data now. Here are the RMSE for predictions for all cities. I believe the RMSE for all cities is 2.24, 2.89, 3.68, 4.29, 4.92 degrees F for 1 through 5 days respectively. I put the data up here, but I don’t yet know how to add visualizations. Unfortunately I have forgotten what little statistics I’ve ever learned. I tried a naïve prediction: tomorrow will be the same as today. This scored a RMSE of 6.11, which is significantly worse than even the 5 day forecast. I’ll try some machine learning algorithms on the data. In addition to the temperature, I stored things like weather condition (rain, snow, cloudy, etc) which may help make better predictions. Overall, I guess the weather underground does ok.

Google Interview

Prompted by a recruiter, I submitted a resume to Google. They let me skip the phone screen and just do the full-day interview with 5 guys. It was easier than I feared. If you can do the first half of CLR you should be fine, except for trick questions. Unfortunately, I think I blew my last interview. He posed a simple problem: Given a lot of files, find all the duplicates. This is easy. Hash all the files, store each in a Map<hash#,filename> and whenever the key already exists you’ve found an identical file. So he asked me to implement a hash function. I thought he wanted a real hash function, which is very complicated. I fumbled around for a while and suggested XOR could work but it sucks for many reasons. He said XOR was fine, surprised that I was struggling. Then he asked what the odds are of a collision, except he asked it in a weird way that I didn’t understand for a while. I thought he wanted to know the odds of collisions using XOR as a hash. I know that XOR doesn’t distribute hash keys uniformly for normal input, but there’s no way I can compute the probability for it. I fumbled for a long time. Finally, I said it’s 0.5^N for N bits in the hash, unsure of what he was looking for. The whole interview went like this, including how to implement a hashtable. He asked a vague question and I misunderstood it as something much more complicated. I didn’t realize we were talking past each other until he told me what he was looking for at the end. So now he will probably tell the hiring committee that I don’t know about hashes and hashtables. That’s too bad.

The Right Milk for a Latte

Milk-based espresso drinks require that the milk be heated and produce a thick microfoam vaguely like shaving cream. I have tried every variation and brand of milk available in my area and concluded that pasteurization seriously effects the taste and texture of the foam.

  • The very best is “raw” milk straight from the cow, un-pasteurized and un-homogenized. The foam is beautifully thick and the milk imparts a caramel sweetness to the espresso. Unfortunately, this is illegal in most states and a potential health hazard if handled incorrectly.
  • We usually heat raw milk at home, a process called vat pasteurization (150F for 30 minutes). Somehow this reduces the sweetness yet preserves most of the thick foam.
  • In Europe most milk is processed with ultra-high temperature (UHT) pasteurization. In the US some half-gallon cardboard containers are labeled as such. We buy organic brands. Somehow this preserves the thick foam but has none of the natural sweetness from raw milk.
  • No other milk produces the thick foam you need for espresso drinks. Instead, it’s like a lousy latte from Starbucks: hot milk with a bit of soapy foam bubbling on the surface. Most milk in the US is processed with high-temperature/short-time (HTST) pasteurization. A food science book I read says this changes the flavor substantially but American consumers now expect that “cooked” flavor. It says 10% of the whey protein is denatured, which may explain why it doesn’t produce the proper foam.

Raw milk is illegal, expensive and easily contaminated with killer bacteria. I don’t want to use it. However, we’ve tried head-to-head tests comparing raw milk against the best commercial milk we can find for a variety of recipes, including Indian desserts. In blind tests it is easy to notice the vastly better flavor from raw milk compared to regular milk. It’s in a completely different league. (FYI: French chefs agree that young raw-milk Camembert in France is better than that made from pasteurized milk.) I’m forced to continue smuggling in raw milk, but I’ve purchased better health insurance just in case things go wrong.

Espresso machine buying guide

My current espresso machine, a Francis!Francis! X5, has been losing pressure and producing swill for several weeks. After reading tons of information scattered on the web, I’ve decided to write it all down for posterity and save others from doing all this work. First, it’s important to understand that the toilet water served at Starbucks and other cafes is not espresso. Try an espresso or cortado at one of these fine coffee shops to understand why.

Continue reading