Archive for September, 2011

Mortar Hawk: hadoop made easy

September 30, 2011 6 comments

Yesterday a couple of guys from Mortar came to explain their hadoop platform. You can see a short demo here. I wanted to explain it at a really high level because it’s cool and a big deal for someone like me. I’m not a computer scientist by training, and Mortar allows me to work with huge amounts of data relatively easily. In other words, I’m not sure what ultimately will be the interface for analytics people like me to get access to massive data, but it will be something like this, if not this.

To back up one second, for people who are nodding off, here’s the thing. If you have terabytes of data to crunch, you can’t put it on your computer to take a look at it, and then crunch, because your computer is too small. So you need to pre-crunch. That’s pretty much the problem we need to solve, and people have solved it either one of two ways.

The first is to put your data onto a big relational database, on the cloud or something, and use SQL or some such language to do the crunching (and aggregating and what have you) until it’s small enough to deal with, and then download it and finish it off on your computer. The second solution, called MapReduce (the idea started at Google), or hadoop (the open-source implementation started at Yahoo) allows you to work on the raw data directly where it lies (e.g. on the Amazon cloud (where it’s actually Elastic MapReduce, which I believe is a fork of hadoop)), in iterative steps called mappings and reduction steps.

Actually there’s an argument to be made, apparently, because I heard it at the Strata conference, that data scientists should never use hadoop at all, that we should always just use relational databases. However, that doesn’t seem economical, the way it’s set up at my work anyway. Please comment if you have an opinion about this because it’s interesting to me how split the data science community seems to be about this issue.

On the other hand, if you can make using hadoop as easy as using SQL, then who cares? That’s kind of what’s happened with Mortar. Let me explain.

Mortar has a web-based interface with two windows. On top we have the pig window and on the bottom a python editor. The pig window is in charge and you can call python functions in the pig script if you have defined them below. Pig is something like SQL but is procedural, so you tell it when to join and when to aggregate and what functions to use in what order. Then pig figures out how to turn your code into map-reduce steps, including how many iterations. They say pig is good at this but my guess is that if you really don’t know anything about how map-reduce works then it’s possible to write pig code that’s super inefficient.

One cool feature, which I think comes from pig itself but in any case is nicely viewable through the Mortar interface, is that you can ask it to “illustrate” the resulting map-reduce code and it takes a small sample of your data and shows example data (of “every type” in a certain sense) at every step of the process. This is super useful as a bug-watching feature to see that it’s looking good with small data sets.

The interface is well designed and easy to use. Overall it reduces a pretty scary and giant data job to something that would probably take me about a week to feel comfortable. And new hires who know python can get up to speed really quickly.

There are some issues right now, but the Mortar guys seem eager to improve the product quickly. To name a few:

  • it’s not yet connected to git (although you can save pig and python code you’ve already run),
  • you can’t import most python modules except super basic ones like math (including ones you’ve written; right now you have to copy and paste into their editor),
  • they won’t be able to ever let you import numpy because they are actually using jython and numpy is c-based,
  • it doesn’t automatically shut down the cluster after your job is finished, and
  • it doesn’t yet allow people to share a cluster

These last two mean that you have to be pretty on top of your stuff, which is too bad if you want to leave for the night and start a job and then bike home and feed your kids and put them to bed. Which is kind of my style.

Please tell me if any of you know other approaches that allow python-savvy (but not java savvy) analytics nerds access to hadoop in an easy way!

Occupy Wall Street: Day 13

September 29, 2011 14 comments

So I went to see the Occupy Wall Street protests this morning before work and this evening after work again. Here are some of my comments and observations.

First, if you are interested in checking it out, know that there are small marches at opening and closing bell for the market.

However, the police have made it basically impossible to walk on Wall Street, due to some incredibly annoying barricades.

So for our march this morning we seemed to just circle the city block where the protest is based, although I didn’t stay til the end so it’s possible they decided to very very slowly march on Wall Street proper.

Second, they have “assemblies” twice a day, with guest speakers sometimes (Michael Moore, Susan Sarandon and Cornel West have visited), and this is where general announcements are made. The crowd was quite large tonight and it was difficult to hear what the speaker and the repeaters were saying, which is frustrating. But maybe it’s easier at the 1pm assembly. Also, it seems to be easier to actually discuss issues in the morning- at night it gets loud and kind of crazy and hard to focus in my opinion.

Next, I’d like to address the issue of the message of the protesters being dismissed as incoherent. For the record, I went to a conference at the end of 2009 at Columbia Business School on the financial crisis and what we should do about it, where the speakers were fancy economists from central banks and CEOs of international banks, and they were about as incoherent as these protesters. There was absolutely no getting them to say anything that was an actual plan or even an attempt at a plan for changing the system so this mess wouldn’t happen again. I should know, because there was a question and answer period and I asked.

Having said that, there have been some pretty unconvincing statements reported from some of the protesters in terms of what they would like to see. For example, some of them seem to think that short selling should be banned. As some of you know, I disagree. In fact there are lots of seriously corrupt and ridiculous things going on in the financial system which they should know about and they should protest, and I’d like to invite them to educate themselves.

In particular, if you are someone interested in knowing stuff about how the financial system works, then please ask! A major part of why I blog is to try to inform people about these things who are interested. Please comment below and ask whatever you want, and if I don’t know the answer I will find someone who does, or I will blog about the question.

Having said that, I’d like to add that it’s on the one hand perfectly reasonable that people don’t understand the financial system, because it has essentially been set up to be too complicated to understand, and on the other hand it’s also reasonable to think of the entire financial system as a black box which can be judged by its outputs.

Finally, if we are going to judge the system by looking at its outputs, then these protesters, who are in general young, with educations, huge students debts, and hopeless outlooks, have a pretty dismal view. In other words they have every right to complain that the system is fucking them, even though they don’t know how the system works. I for one am super proud that they’re out there doing something, even if it’s not obviously organized and polished, rather than passively sitting by.

Categories: #OWS, finance, rant

Go Rays!

September 29, 2011 1 comment

As a long-time (yes since they sucked) Red Sox fan, let me just say, the Tampa Bay Rays totally deserve to be in the play-offs. They made me a fan last night with an absolutely amazing game.

Categories: news, rant

Never apologize

September 28, 2011 11 comments

Last night I was talking to a friend of mine about my teaching experiences, and what’s it’s like to be a woman in math and to be taken seriously. We were going over the standard stuff, that women are too self-effacing compared to men and tend not to strut their stuff enough. But then I remembered this story from my early teaching experiences that kind of put a different spin on that.

I was in grad school, and over the summer I went to Berkeley to teach at a women in math program, which was still called the “Mill’s program” even though it was being held at Berkeley. It was a really fun experience, something like 30 days of lecture and problem session, and I led the problem sessions.

It was some time in the second week when, one day because of something or other, I hadn’t prepared completely and I apologized to the class for being slightly unprepared. I said something like, “sorry I’m not completely prepared today”. I remember thinking that, in spite of that, the class went very well and there was no “damage” from my being unprepared. Every other day I was completely, perhaps overly prepared, and that was the only day I ever mentioned something about my preparedness.

At the end of the summer we got back teaching evaluations, and I remember that a full half of the evaluations described me as unprepared.

I made a promise to myself never ever to apologize for anything again. And I never have, and I’ve never been accused like that since. Which isn’t to say I pretend to be a perfect teacher, but there are subtle ways of dealing with imperfections (my favorite: turn a self-criticism into a flattery. Instead of saying, oh how stupid I am for not thinking of that, say oh how smart you are for thinking of that. Generosity is not a negative in my experience!).

Going back to last night, though, it’ a two-way street. Women may be too self-effacing, but other people (including women!) are absolutely too dismissive. It’s a very important thing to keep in mind when you are teaching or presenting.

One other thing, in a one-on-one, professional setting, I believe you can apologize and not be executed for it (sometimes and depending on the person), but in a teacher-students setting, or when you’re presenting to clients in business, or even when you’re presenting to colleagues, you’re giving a performance and need to be flawlessly confident.

In an ideal world, we would use this information to learn to become better audiences, to not be dismissive and overly harsh of self-effacing people, and I do try to keep this in mind when I’m in the audience. But it’s going to take lots of effort for this to happen on a large scale, especially among strangers. It’s a cultural axiom in a certain sense.

My advice to young people, especially women: never apologize.

Occupy Wall Street—Report

September 27, 2011 10 comments

This is a guest post by FogOfWar.

I was originally going to lead with a tongue-in-cheek comment (later in the post now), but then the NYPD did something colossally stupid.  If you haven’t seen it, here’s the video from this last weekend. It pretty much speaks for itself.

There’s a lot to be said about freedom of expression and police overreaction.  I’ve been to see the protests a number of times, and they’ve never been violent and in fact seem pretty well trained in the confines of freedom of assembly in the US legal system.  Using mace against an imminent threat of violence is OK for the police, but the video seems to show no threatening moves made at all (and it runs for a good period before the police attack so it wasn’t edited out).

I’d suggest the NYPD be shown the following video (taken from the protests in Greece) to demonstrate when things reach a level where force might be an appropriate response. Note that the crowd is attacking with sticks, Molotov cocktails and a fucking bowling ball.  In contrast, the NYPD appears to be pepper spraying people for just holding signs and walking down the street.  What the fuck?

There are maybe a few hundred people consistently protesting at “Occupy Wall Street” for about 10 days now.  It’s got a definite crunchy vibe to the center.  Drumming and Mohawks are mandatory:

But also a (growing?) contingent of more mainstream participants like this one:

Here’s a crowd shot for scale:

And some people painting signs:

And then of course, there’s the dreaded “consensus circle”:

It’s hard to tell what they really want to happen—this was up at one of the information booths (but then down the next time I went):

Misspelled “derivatives”, and there are some things on that list that are spot on and then others that are just weird and irrelevant (DTC?  Really?). I don’t think you can hold that against them though.  I work in the industry, and I’ve been spending the last three years thinking about this stuff and I still find it confusing and hard to come up with a cohesive plan of what I think should be done.  At least these people are doing something, even if it’s a bit incoherent at times.

I have to end with my all time favorite sign from the protest.  Someone was looking for good cardboard and inadvertently came up with the following:

“Delicious pizza to pay off the taxpayers”.  Now that’s a slogan I think we can all rally behind!


Categories: #OWS, finance, FogOfWar, news, rant

The flat screen TV phenomenon

September 26, 2011 12 comments

Do you remember, back in 2005 or 2006 or even up to early 2008, how absolutely everyone seemed to be buying flat screen TVs? And not only one, they’d actually buy new ones when new models came out, or ones with different high definition properties. And not just people who could afford it, either. The marketers did an excellent job in somehow convincing people that they needed these flat screen TVs so bad that they should just put it on their credit cards, all 3 thousand dollars of it, or whatever those things cost.

I don’t know exactly how much they cost because I never bought one. The last TV we bought was in 1997 and it still works, for the most part, although it’s really hard to turn it on and off. When it finally kicks the bucket I’m thinking we go without a TV, since TV pretty much sucks anyway. When we do watch it, it’s for live sports (local, or nationally televised, since we don’t pay for cable). Baseball we watch or listen to on the computer.

I was reminded of the the “flat screen TV era” by my friend Ian Langmore the other day when we were discussing household debt amnesty. His argument against debt amnesty for consumers was that they might spend it on crappy things. His example was luxury dog poo, but I’ve been obsessed with the flat screen TV phenomenon ever since a friend of mine, who was $120,000 in debt and didn’t have a salary, somehow managed to buy a flat screen TV in 2007. It blew me away in terms of wasteful consumerism. Ian found this unbelievable blog which kind of sums up my concerns.

In Ian’s opinion, the danger of amnesty, or any system where money is put willy-nilly into the hands of consumers, is twofold:

1)  We waste time on unproductive activities.  E.g. people spent time buying/building cars that are unneeded.
2)  If a miscalculation is made, then the over-leveraged money-go-round stops with a huge mis-balance.  E.g. home mortgage crisis.

These are very good points, and put together form a lesson we somehow can’t learn, although perhaps that can be partially explained by this article.

I have two thoughts. First, I’m also uncomfortable putting money in the hands of irresponsible consumers. But the truth is, the way I see it is currently working, we are already putting money in the hands of irresponsible bankers (that’s what the term “injection of liquidity” really means), and they are not doing anything with it, so let’s try something else. In other words, an alternative unpleasant idea.

Second, I don’t think we are going to see a new wave of flat screen TV buying any time soon. If we put money into the hands of consumers right now, I think we’d see them pay down their debts, go to the doctor, and buy jeans for their kids. Of course, there is always someone whose pockets burn with cash, and they would waste money in any situation. Let’s face it, though, credit is tight right now compared to the mid-2000’s. In fact, since economists seem to have a tough time spotting bubbles until afterwards, maybe we can take “a huge part of the population starts buying useless gadgets on credit” as almost a definition, or at least a leading indicator. Then at least there would be some point to all of that wasteful spending.

Categories: finance, news, rant

Why and how to hire a data scientist for your business

September 25, 2011 22 comments

Here are the annotated slides from my Strata talk. The audience consisted of business people interested in big data. Many of them were coming from startups that are newly formed or are currently being formed, and are wondering who to hire.

When do you need a data scientist?

When you have too much data for Excel to handle: data scientists know how to deal with large data sets.

When your data visualization skills are being stretched: as we will see, data scientists are skilled (or should be) at data visualization and should be able to figure out a way to visualize most quantitative things that you can describe with words.

When you aren’t sure if something is noise or information: this is a big one, and we will come back to it.

When you don’t know what a confidence interval is: this is related to the above; it refers to the fact that almost every number you see coming out of your business is actually an estimate of something, and the question you constantly face is, how trustworthy is that estimate?

Let’s take a step back: Should you need a data scientist?

Are you asking the right questions? Is there a business that you’re not in that you could be in if you were thinking more quantitatively? Big data is making things possible that weren’t just a few years ago.

Are you getting the most out of your data? In other words, are you sitting on a bunch of delicious data and not even trying to mine it for your business?

Are you anticipating shocks to your business? As we will see, data scientists can help you do this in ways you may be surprised at.

Are you running your business sufficiently quantitatively? Are you not collecting the data (or not collecting it in a centralized way) that would lead to opportunities for data mining?

So, you’ve decided to hire a Data Scientist (nice move!)

What do you need to get started?

Data storage. You gotta keep all your data in one place and in some unified format.

Data access — usually through a database (payoffs for different types). Specifically, you can pay for someone else to run a convenient SQL database that people know how to use walking in the door without much training, or you could set something up that’s open source and “free” but then it will probably take more time to set up and make take the data scientists longer to figure out how to use. The investment here is to create tools to make it convenient to use.

Larger-scale or less uniform data may require Hadoop access (and someone with real tech expertise to set it up). The larger your data is the more complicated and developed your skills need to be to access it. But it’s getting easier (and other people here at the conference can tell you all you need to know about services like this).

Who and how should you hire? It’s not obvious how to hire a data scientist, especially if your business so far consists of less mathematical people.

A math major? Perhaps a Masters in statistics? Or a Ph.D. in machine learning? If you’re looking for someone to implement a specific thing, then you just need proof that they’re smart and know some relevant stuff. But typically you’re asking more than that: you’re asking for them to design models to answer hard questions and even to figure out what the right questions are. For that reason you need to see that the candidate has the ability to think independently and creatively. A Ph.D. is evidence of this but not the only evidence- some people could get into grad school or even go for a while but decide they are not academically-minded, and that’s okay (but you should be looking for someone who could have gotten a Ph.D. if they’d wanted to). As long as they went somewhere and challenged themselves and did new stuff and created something, that’s what you want to see. I’ll talk about specific skills you’d like in a later section, but keep in mind that these are people who are freaking smart and can learn new skills, so you shouldn’t obsess over something small like whether they already know SQL.

What should the job description include? Things like, super quantitative, can work independently, know machine learning or time series analysis, data visualization, statistics, knows how to program, loves data.

Who even interviews someone like this? Consider getting a data scientist as a consultant just to interview a candidate to see if they are as smart as they claim to be. But at the same time you want to make sure they are good communicators, so ask them to explain their stuff to you (and ask them to explain stuff that has been on your mind lately too) and make sure they can.

Also: don’t confuse a data scientist with a software engineer! Just as software engineers focus on their craft and aren’t expected to be experts at the craft of modeling, data scientists know how to program in the sense that they typically know how to use a scripting language like python to manipulate the data into a form where they can do analytics on it. They sometimes even know a bit of java or C, but they aren’t software engineers, and asking them to be is missing the point of their value to your business.

What do you want from them? 

Here are some basic skills you should be looking for when you’re hiring a data scientist. They are general enough that they should have some form of all of them (but again don’t be too choosy about exactly how they can address the below needs, because if they’re super smart they can learn more):

  • Data grappling skills: they should know how to move data around and manipulate data with some programming language or languages.
  • Data viz experience: they should know how to draw informative pictures of data. That should in fact be the very first thing they do when they encounter new data
  • Knowledge of stats, errorbars, confidence intervals: ask them to explain this stuff to you. They should be able to.
  • Experience with forecasting and prediction, both general and specific (ex): lots of variety here, and if you have more than one data scientist position open, I’d try to get people from different backgrounds (finance and machine learning for example) because you’ll get great cross-pollination that way
  • Great communication skills: data scientists will be a big part of your business and will contribute to communications with big clients.

What does a Data Scientist want from you?  This is an important question because data scientists are in high demand and are highly educated and can get poached easily.

Interesting, challenging work. We’re talking about nerds here, and they love puzzles, and they get bored easily. Make sure they have opportunities to work on good stuff or they’ll get other jobs. Make sure they are encouraged to think of their own projects when it’s possible.

Lots of great data (data is sexy!): data scientists love data, they play with it and become intimate with it. Make sure you have lots of data, or at least really high-quality data, or soon will, before asking a data scientist to work for you. Data science is an experimental science and cannot be done without data!

To be needed, and to have central importance to the business. Hopefully it’s obvious that you will want your data scientists to play a central role in your business.

To be part of a team that is building something: this should be true of anyone working in business, especially startups. If your candidate wants to write academic papers and sit around while they get published, then hire someone else.

A good and ethically sound work atmosphere.

Cash money. Most data scientists aren’t totally focused on money though or they would go into finance.

Further business reasons for hiring a Data Scientist

Reporting help: automatically generated daily reports can be a pain to set up and can require lots of tech work and may even require a dedicated person to generate charts. Data scientists can pull together certain kinds of reports in a matter of days or weeks and generate them every day with cronjobs. Here’s a sample picture of something I did at my job:

Having a data scientist enables you to see into data without taxing your tech team (beyond setup) via visualizations and reports like the above.

A/B testing: data scientists help you set up A/B testing rigorously.

Beyond A/B testing: adaptability and customization. What you really want to do is get beyond A/B testing. Instead of having the paradigm where customers come to the ad and respond in a certain way, we want to have the (right) ad come to the customer.

Knowing whether numbers are random (seasonality) or require action. If revenue goes down in a certain week, is that because of noise? Or is it because it always goes down the week after Labor Day? Data scientists can answer questions like this.

What-if analysis: you can ask data scientists to estimate what would happen to revenue (or some other stat) if a client drops you, or if you gain a new client, or if someone doubles their bid at an auction (more on this later).

Help with business planning: Will there be enough data to answer a given question? Will there be enough data to optimize on the answer? These are some of the most difficult and most important questions, and the fact that a data scientist can help you answer them means they will be central to the business.

Education for senior management: senior people who talk to and recruit new clients will need to be able to explain how to think about the data, the signals, the stats, and the errorbars in a rigorous and credible way. Data scientists can and should take on the role of an educator for situations like this.

Mathematically sound communication to clients: you may have situations where you need the data scientists to talk directly to clients or to their data scientists. This is yet another reason to make sure you hire someone with excellent communication skills, because they will be representing your business to really smart people who can see through bullshit.

Case Study: Stress Tests

We can learn from finance: the idea of a stress test is stolen directly from finance, where we look at how replays of things like the credit crisis would affect portfolios. I wanted to do something like that but for general environmental effects that a business like mine, which hosts an advertising platform, encounters.

You know how big changes will affect your business directionally and specifically. But do you know how combinations will play out? Stress tests allow you to combine changes and estimate their overall effect quantitatively. For example, say we want to know how lowering or raising their bids (by some scalar amount) will effect advertisers impression share (the number of times their ads get displayed to users). Then we can run that as a scenario (for each advertiser separately) using the last two weeks (say) of auction data with everything else kept the same, and compare it to what actually happened in the last two weeks. This gives an estimate of how such a change would affect impression change in the future. Here’s a heat map of possible results of such a “stress test”:

This shows a client-facing person that Advertiser 13 would benefit a lot from raising their bid 50% but that Advertiser 12 would suffer from lowering their bid.

We could also:

  • run scenarios which combine things like the above
  • run scenarios which ask different questions: how would advertisers be affected if a new advertiser entered the auction? If we change the minimum bid? If one of the servers fails? If we grow into new markets?
  • run scenarios from the perspective of the business: how would revenue change if the bids change?

In the end stress tests can benefit any client-facing person or anyone who wants to anticipate revenue, so across many of the verticals of the business.

Categories: data science