Solving the Birchbox Problem in #Clojure Part 1- #Clojure #data #math

This set of blog posts (no idea how many, we’ll see how it goes) is to attempt to solve a couple of things that have been going on in my head. Firstly, there seems to be a lack of material that shows you how the language of maths is transferred to the language of code. With more and more tech news outlets constantly harping on that data scientists “need a PhD” and “at least a maths degree” it puts some programmers at a worrying disadvantage.

Now, I’ve said in the past data science is a team, there aren’t many individuals that can easily cover skill wise what a data scientist actually is. I don’t have a hoverboard for a start….. If you look at the MastodonC team for example our backgrounds are varied but collectively it’s very agile indeed.

Not Knowing Mathematical Language Is My Personal Hangup

Yes this is a personal crusade but one that will help in other departments later on I hope. It’s become an interest along with statistics to battle through and figure this stuff out. And if I can learn a programming language then there should not be any reason why I can’t learn a mathematical one too.

In the same way I approached the book Machine Learning: Hands On For Developers and Technical Professionals in a half theory, half coded examples kind of way I want to do the same here, it’s how I figure things out. Who knows, there could be a book in it. (did I actually say that?)

The best way to start learning is to look at an existing problem, so I need to find a problem.

The Birchbox Problem


The Birchbox Problem is a question that the data science team at Birchbox had to solve, being: “The Birchbox Problem is the assignment of products to subscribers such that we maximize happiness.”

Their blog post, back from 2012, gives the outline of their solution in joyous mathematical notation.

maths2So that gives us an outline of what we need to do to solve the problem. Great if you understand it and totally confusing if you don’t. I’ll keep referring back to this while working on these blog posts.

The Code

The end game is that we have some code that satisfies that statements above. Okay it won’t be 100% how Birchbox do things but that’s not the point, the point is we learn something about transferring math to code. That’s the real challenge.

I’ve created a Github repository and I’m working in Clojure. If you want to fork it and do a pull request by all means do, always happy to read and learn. It’s a public repository too so there’s at least a little emphasis on me making some effort of progress to aid my learning.

Next Time…

I’m going to start breaking down this problem and building some code around it.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: