Elon Musk Indicted by SEC, Can AI Help?

The big news from the tech and finance world on September 27, 2018, is that Elon Musk has been sued by the US Securities and Exchange Commission (SEC) for his tweets about taking Tesla private at $420 per share. 

The SEC is seeking to have Musk banned from serving as an officer or director of any public company. Their reasoning? Musk was lying about having funding secured. This implies that he was trying to manipulate Tesla’s share price in an upward direction. Well, it worked, for about a day, that is. On the day of the tweet, Tesla’s share price rose to a high of $379.87 US per share from its previous price of around $350 per share, before falling back to $352 the next day (August 8, 2018). If the markets had actually believed Musk’s Tweet, Tesla’s share price likely would have climbed closer and closer to the mythical $420 price as the take-private day neared.

Tesla’s share price peaking after Musk’s announcement.

Instead, Tesla’s share price dropped like a rock because every savvy investor realized that Musk’s statement was either pure fanciful bluster, a joke about weed, or both. Of course, today has been much worse for Tesla’s share price than any of Musk’s recent ill-advised tweets. In after-hours trading, Tesla’s share price is down as much as 13%. That’s a lot and it is falling dangerously close to their 52 week low. This is all especially troubling considering that Tesla is expected to announce their best quarter ever, in terms of cash flow, in a few days.

  • Loading stock data...

So, what is the SEC doing, was it possible to predict this, and could AI make this type of situation any better? The answer to the first question is unclear, however, the answer to the second two questions is likely, yes.

AI is already being used in the legal profession to help identify responsive documents that must be turned over to the opposing party during a lawsuit. MIT Professor Emeritus Frank Levy leads a research that helps law firms apply machine learning software to the practice of law. 

If AI can predict what documents will be useful in a lawsuit, then whenever the CEO of a publicly traded company does something suspicious, it should be possible to use these same programs to parse historical cases and see what precedent there is for a lawsuit to be filed. At the very least, it could provide some insight into the likelihood of an indictment and, in the future, could even suggest potential courses of action for a company to take if it found itself in this type of situation.

Would the AI be able to help predict whether or not Elon will be convicted? Possibly. While I am not aware of any AIs currently being used to predict the outcome of legal matters, in my September 24, 2018 column, I covered the AI that perfectly predicted the outcome of last year’s Superbowl. While legal cases may be more complicated than a football score, there is likely several orders of magnitude more data about the outcome of various lawsuits than there is about football players, simply because there are WAY more lawsuits than there are football teams.

From a financial perspective, we could use this type of AI to predict potential lawsuits and their results and train the AI to make trades based on these predictions. If these types of AI were already in use, we could expect much smoother and more predictable share prices as the effect/implications of a particular news story would become apparent almost immediately after the information surfaces.

For now, I’ve programmed a simple AI for Elon Musk to help him decide if he should tweet something or not. You can try it, too, if you’d like. It’s posted below:


The True Cost of an MBA

Everything has an opportunity cost. An MBA, for example, costs about fifty to eighty thousand dollars, but that’s just the face value. It turns out, by taking two years off of work to go to school, you are also sacrificing the earnings you could have had from those two years, not to mention any promotions, raises or job experience that would have come along with it. If we’re thinking about lifetime earning potential, we can calculate the incremental earnings that you’d need from the MBA in order to break-even on the investment. Of course, all of these calculations should always be done ex-ante (prior to enrollment) because otherwise, we’re falling prey to the sunk-cost fallacy, and that will only make us regret a decision we’ve already made.

For example, let’s say that your MBA will cost $75,000 up front and that you are currently making $50,000 per year annually at your current job. What incremental salary increase would you need in order to account for the opportunity cost of the MBA?

First, we have to calculate an appropriate discount rate for our money. In this case, we can probably use r_m , the market’s rate of return because if we choose not to put the money towards an MBA, we could instead put it in an Index Fund or another similar investment vehicle, where it would grow at around the market interest rate.

Source: Market-Risk-Premia.com

Based on the July 2018 numbers, the market risk premium is about 5.38%. Notice that we didn’t just use the Implied Market Return of 7.69%, this is because we need to subtract the Risk-free rate r_f in order to account for the incremental risk.

Let’s round down to 5% for simplicity. Assuming we’re starting our MBA in January of 2019 and Finishing in December of 2020 (2 years) with a cash outflow of $37,500 in 2019 and 2020 and sacrificed earnings of $50,000 in each of those years. We can calculate the future value (FV) of that money in 2021 as follows:

Future Value of Annuity Formula
Future Value of an Annuity

Our periodic payment, P , is $87,500, our discount rate,r , is 5% and our number of periods, n , is 2. That leaves us with the following:

FV = \$87,500*[((1+0.05)^2-1)/0.05]  = \$179,375

Assuming we’re able to land a job on day 1 after graduation, how much more do we have to make in our careers to make up for the opportunity cost of the MBA? For that, we can use another annuity formula to calculate the periodic payment required over a given number of years to equal a certain present-value amount.

Annuity payment formula

Let’s say that we will have a 30-year career and that our market risk premium stays the same at 5% (the historical average for Canada is closer to 8%, however, let’s be conservative and stick with 5%). Substituting in these values to our formula with PV = $179,375 r = 5% and n = 30, we find that the payment, P, is:

P = {0.05*\$179,375}/{ 1 - (1+0.05)^{-30}} = \$11,670

So, we need to make an additional $12,000 per year every year for the rest of our careers, because of the MBA, in order to make up for the opportunity cost of the program.

If that seems realistic to you, maybe you should consider an MBA.

Of course, if we’re being really clever, we should probably also include a risk premium for our MBA. There is not a lot of data out there to suggest what the probability of completing an MBA is, but we can assign some probabilities to our equation for reference. Let’s say that there’s a 60% chance that the market will be strong when we complete the MBA and we’re able to find a job that pays $62,000 per year right out of the MBA program. There is also a 20% chance that we’ll make the same amount as we made before the MBA program $50,000 per year, a 10% chance that we’ll make $75,000 per year after the program and a 10% chance that the market for MBAs tanks and we’ll make below $40,000 per year when we graduate.

Expected Value = 0.6 * \$62,000 + 0.2 * \$50,000 + 0.1 * \$75,000 + 0.1 * \$40,000 = \$58,700

How do we make a decision with all these different possible outcomes? Simply multiply the probabilities by the annual salaries and add them together to find the probable result. If these numbers are correct we’re looking at an equivalent salary of $58,700 per year coming out of the MBA program. Of course, these numbers are completely made-up, but if we find numbers like these in our real-world evaluation, the logical decision from a financial perspective would be to reject doing an MBA because the cost is outweighed by the potential gains.

According to PayScale, the average salary in Calgary for an MBA with a finance specialization is $87,500 per year, but the average salary for someone with a bachelor of science degree is over $75,800 per year. Based on these numbers, it might not make sense for someone with a science degree to do an MBA.

Of course, there are other intangible factors that come into play including career preferences, lifestyle, and happiness. These are all important and should definitely be factored into your decision.

Graphs and iPads are an important part of any MBA

Yes, this is a very hard decision to make but can machine learning algorithms help make these decisions easier for us? It should be possible to use machine learning algorithms to predict future earnings potential and even take into account qualitative variables like career preferences and working style to give us a better idea of which choices might be right for us.

It is my goal to understand the capabilities of machine learning models to assist in these types of financial predictions. Hopefully, in the next few weeks, I’ll have an update for you on whether this type of predictive capability exists and if it does, how to access it.

For now, good luck with your decision making! I did an MBA and I don’t regret it at all because it was the right decision for me. My hope is that this article has given you the tools to decide whether the decision might be right for you.

Matrix Madness

Linear algebra is an important tool used in modern deep learning algorithms. Unfortunately, when I did my undergrad in Electrical and Computer Engineering, I had no idea that the ability to transform vectors and matrices would ever be practicably useful for anything (other than giving me migraines at 2AM the night before my midterm exams). So, once I had learned enough to pass the course, I immediately forgot everything.

It was only when I decided to pursue a deeper understanding of machine learning and AI, in order to apply it to my business and to my work in finance, that it dawned on me. I should have paid attention in Linear Algebra II when I was back at the UofA in Engineering school! Well, since I didn’t, and even if I did, all my books on the subject mysteriously burned up in the great notes fire of ’09, I guess it’s time to re-learn me some matrix math.

Lucky for me, Udacity has brought on some of the best professional educators in the world for their AI Nanodegree program including former Khan Academy animator and 3 Blue 1 Brown creator, Grant Sanderson.

So, now I’m super good at manipulating matrices thanks to the magic of a YouTube superstar and the LaTeX plugin for WordPress websites.

A = \begin{bmatrix} a_{11} & \cdots & a_{1j} & \cdots & a_{1n} \\ \vdots & \ddots & \vdots & \ddots & \vdots \\ a_{i1} & \cdots & a_{ij} & \cdots & a_{in} \\ \vdots & \ddots & \vdots & \ddots & \vdots \\ a_{m1} & \cdots & a_{mj} & \cdots & a_{mn} \end{bmatrix}

…I spent 30 minutes trying to get this matrix to display correctly.

If you want to learn why vectors are cool and how to use matrix multiplication to rule the world, watch the video series that I’ve linked below.

We haven’t arrived at the part about why Linear Algebra is so important for creating neural networks and deep learning algorithms, but we will. If you’re still with me, keep plugging along, learn how to understand all matrix transformations using only the unit vector and a 2×2 matrix. Eventually, we’ll discover how to program a computer to predict Apple’s  share price the day after they launch a ‘new’ iPhone

/insert corny iPhone XS Max joke here/.

  • Loading stock data...

That’s all for today. Now go out on your own and learn the basics of linear algebra! If you message me directly, I’ll even send you my notes. Tomorrow, we’ll talk about why this stuff is important for machine learning.

Linear algebra joke: One year for halloween I was ‘Snakes on a Plane’

If you’re still here and you’re wondering why yesterday we were talking about valuing a company and today we’re talking about undergraduate linear algebra, you’re probably not alone. So I’ll tell you why: It’s going to take a foundational understanding of programming, mathematics and finance to get where we need to go. To understand machine learning, we have to understand how the software is built and to build software that is capable of doing what a CFA can do, we’ll need to know what a CFA knows. I’m bringing you along on this journey as I learn the fundamentals on both ends, machine learning and finance. Let’s see how it goes!

Do you get it now?

Python Is Awesome

If you’ve ever looked into what it takes to become a developer of AI software, you probably know that Python is the language of choice for 95% of Machine Learning applications out there.

So, why Python? It’s not super easy to learn. Students can learn graphical programming languages like Apple’s Swift much faster. It’s not the speediest. There are other programming languages that are better optimized to develop the GPU and CPU intensive tasks that Machine Learning software requires. Unfortunately, it’s not even the most ubiquitous (for applications outside of machine learning and data science). Many programmers are much more familiar with Javascript for web development. It is free, so it does have that going for it.

Here’s what Quora has to say about it:

“…it is a general language that does a little of everything at a good enough complexity-performance tradeoff with a full suite of tools for productionizing machine learning.”

Thia Kai Xin, Head of Data (Tech In Asia), Co-Founder of DataScience SG.

Essentially, Python is effective enough to get the job done. Major companies like Google, Facebook, and Uber all use Python for the majority of their ML software development, so that helps. If you want a job at a major tech company, and you want to develop artificial intelligence applications, you’ll probably need to understand Python pretty well.

So, what can Python do? It’s built on an open-source licence, so there’s no need to worry about licensing fees. Python comes pre-installed on all Apple desktops and can be easily installed on Windows or Linux builds. The latest version of Python (Python 3.7) can be easily integrated with mathematical packages like NumPy and with clever development visualization tools like Jupyter Notebooks.

“The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.”

Project Jupyter – jupyter.org

There are many, many online and in-person courses available that teach Python, including many free and low cost options. Udacity offers a free intro to Python course that you can sign up for right now. 

Python is easy to learn and powerful. It’s accessible to pretty much anyone with a computer and there are lots of ways to get started. Here’s an example of what you can do with Python in only a few days of practice:

Using only freely available libraries and packages, along with some tutelage from Udacity’s AI Programming Fundamentals program, a student can learn to program a deep-neural-net, a type of machine learning tool, that is able to distinguish images of various types of animals, including dog breeds, with a high degree of accuracy. That’s pretty amazing. Someone with limited programming experience can learn how to build their own AI program in less time than it takes to fail your first University midterm.

If you’re interested in programming these types of tools or if you’re curious about how they work, I highly suggest you head over to the 3 Blue 1 Brown YouTube channel and watch his videos on Neural Networks. The animations are world-class and the topics are simplified enough to be understood but still cover the topic in great depth. I’ve linked the first video in the series below and I can’t recommend the channel enough.

So where is this all going and what applications does this have for people in finance?

Using the tools described above, I have already created software that tracks the share price of several tech giants and tries to predict their short-term market performance. Mind you, I have about a decade of software development experience, but nearly all of my experience is outside of the machine learning space.

Python is a great tool for experienced programmers and beginners alike to build some amazing software. Try it out for yourself, and when you get hooked, don’t blame me when you inevitably find yourself up past midnight solving the world’s problems one line of code at a time.