I’ve been reading up on investment banking lately for work, also out of interest. The first chapter in Investment Banking: Valuation, Leveraged Buyouts, and Mergers and Acquisitions by Joshua Pearl and Joshua Rosenbaum talks about comparable companies analysis, also called trading comps. It’s one way that investment bankers go about valuing private companies that are about to go public, or those that may merge or be acquired by another company, for example.
Automating comparable companies analysis
The process seems fine, it involves data collection, then essentially comparing the “target” (the company you’d like to value) to those in a “comparables universe.” It’s all manual work, with the most difficult part being amassing the universe of comparable companies. The rest of it essentially involves simple addition, subtraction, multiplication, and division. And it makes me think… why can’t we just automate it with machine learning?
In 2003, Amazon revealed their secret to the world: their item-item based collaborative filtering algorithm! In their paper, Amazon.com Recommendations Item-to-Item Collaborative Filtering, which has ~6000 citations on Google Scholar as of October 2019, they share the details on their recommender system that drove their website’s revenue for years.
There are 3 interesting problems that are solved in this paper. Those are:
how to represent items
how to compute similarity of items, and
how to scale the solution.
And, the most interesting part of this is: they patented it.
Before we discuss the patent, and ask some questions, let’s step through each sub-problem and how they solved it.
I’m an organizer of A.I. Sorcatic Circles, a machine learning discussion group based in Toronto, focused on reviewing highly technical advances in machine learning literature.
We hold events one to two times a week, and stream our sessions online on our YouTube channel. Our sessions run about an hour and a half long, so this makes for content that’s very long. As part of an effort to produce shorter, more digestible content for YouTube, we came up with The 5 Minute Paper Challenge.
Participating in The 5 Minute Paper Challenge is simple in its description, but complicated in its execution. Simply put, participants were asked to create videos of 5 minutes in length, describing their favourite machine learning paper. It may sound easy, but it really isn’t. I learned the hard way, through spending a few days putting together a “sample” video for our participants to refer to. I thought it’d be a matter of writing a script, pointing a camera at my face, and quick editing. I was wrong.
Take a look at my video below, if you’d like. The paper I chose to explain is called Folding: Why Good Models Sometimes Make Spurious Recommendations. It discusses how matrix-based collaborative filtering systems often embed unrelated groups of users close to each other in the embedding space. The way to rectify it, they say, is to use some sort of goodness metric (like RMSE) along with some badness metric (they propose a “folding” metric), when training your model and evaluating its performance.
Mean is overrated. As a statistical measure, and as a way of being (it’s easiest to just be nice!). Just as mean is overrated, mode is overlooked. Sometimes I don’t want the mean of my data, I want the mode, or the median. And for some reason, this is hard to do with Apache Hive. To explain what I mean by this, let’s get our hands dirty with a dataset. (Should I say let’s clean our teeth with a dataset, since the picture I chose below is toothpaste? Nah, that would be weird).
Cleaning our teeth (?) with some data
Consider the case where we have order data for a particular item. Specifically, we have a dataframe with 2 columns: number_of_orders, and item_id. Let’s say for simplicity’s sake that we’re dealing with a single item, say, toothpaste (to yes, clean your teeth with), and each (number_of_orders,item_id) pair tells us the number of times someone has purchased that item. If our population includes myself and my friend Hanna, and I have purchased toothpaste 13 times, and Hanna has purchased toothpaste 55 times, then two rows of our dataframe using Pandas would look like:
(I use Redshift to change the colour of my screen- it seems to affect screenshots too!).
What does oceanography have in common with the stock market? A lot, actually.
Consider the iconic Black-Scholes equation that prices European call and put options. In my previous post, I outlined how the Black-Scholes equation can be transformed into an analogue of the heat equation. I also mentioned how the heat equation came up in my Master’s thesis, which focused on fluid dynamics and physical oceanography. In this post I’ll explain to you why financial mathematics = fluid dynamics.
The heat equation is a fundamental partial differential equation (PDE) that every math student is (or should be!) familiar with. The heat equation describes the distribution of heat in a given region over time. The one dimensional heat equation is:where x is the horizontal axis, t is time, u(x,t)is temperature, and k is thermal diffusivity.
For me, the heat equation is an old friend that just keeps showing up. I worked with an analogue fairly extensively as part of my Master’s thesis on fluid dynamics/physical oceanography, and I feel like it shows up everywhere I look. My recent revelation is that the heat equation is relevant in financial markets: not only is the famous Black-Scholes equation a PDE, but it’s an analogue to the heat equation!