OMSCS CS7646 (Machine Learning for Trading) Review and Tips

Valerie Lim
3 min readDec 26, 2021

In my first semester, I took Machine Learning for Trading (ML4T) and Reinforcement Learning (RL) which you can find my review and tips about that course here.

Why did I take the course?

Understanding human behaviours has been an area of interest to me, in particular human behaviour with a temporal aspect (such as consumer decision journey).

Through my projects in my current role at Dell, I found that sequential models (e.g. LSTM, transformers) are a great way to model unstructured text such as feedback. I found that such models achieve decent results in classifying feedback/comments into their respective categories with minimal feature engineering. As such, I wanted to dive into the ML4T course to learn more about sequential modelling, and how to frame the stock market data into a machine learning problem. I believe such techniques would be useful and transferable to datasets in other domains.

While I have some basic understanding of trading and investment that I gathered through research, I wanted to improve my acumen in this aspect, as I believe learning how to invest is a life skill, and it is an important component to achieve FIRE.

What’s the course like?

There are 2 components to this course, 8 homeworks, and 2 non-cumulative exams, a midterm and final exam. Most of the applied learning stems from the homeworks.

There is 1 homework assignment due every alternate week. The assignments require knowledge in Python programming and a basic understanding of object-oriented programming. All assignments are auto-graded when you submit your source code to the autograder system. Some assignments require an additional report (ranging from 5 to 7 pages depending on the assignment) that includes your methodology, discussion of results and visualizations, in addition to your source code. There are grading test scripts for most of the assignments. These were really helpful checks to ensure my scripts were functioning as intended.

These are the eight assignments we had in Fall 2021:

  • Assignment 1: Martingale: Analyze the “Martingale” roulette betting approach for unlimited vs. limited loss
  • Assignment 2: Optimize Something: Use optimization to find the allocations for an optimal portfolio
  • Assignment 3: Assess Learners: Implement decision tree learner, random tree learner, and bag learner (i.e., ensemble)
  • Assignment 4: Defeat Learners: Create data sets better suited for Linear Regression vs. Decision Trees, and vice versa
  • Assignment 5: Marketsim: Implement code that takes trades data as input and output portfolio values and metrics given a start value, commission and impact
  • Assignment 6: Manual Strategy: Create a manual strategy that outputs higher returns than benchmark (this manual strategy is used as a comparison with a machine learner in assignment 8)
  • Assignment 7: Q Learning Robot: Implement a Q-Learner with Dyna Q framed by a simple robot navigation problem
  • Assignment 8: Strategy Learner: Frame the trading problem using a learning approach from one of the earlier assignments (Tree-based, Q-Learner).

Lastly, each exam consists of 30 MCQs, to be completed in 35 min. I prepared for it by going through the lectures, assigned readings. I also practiced past year exam questions.

  • Question bank for midterm here
  • Question bank for finals here

The class is organised into three mini courses: (1) General Python, Numpy, Pandas, (2) Finance, (3) Machine Learning (in Finance). The first mini-course covered the use of Python libraries for data manipulation and analysis. This would be a breeze for those with a background in Python. It is also a good refresher on the use of Numpy to perform vectorization to reduce the time complexity of your code. The second mini-course covered fundamental analysis and technical analysis, with a stronger focus on the latter, as this is where machine learning can be applied on. The final minicourse covered the use of decision trees and Q-learning to solve a trading problem. More details can be found on the course website.

What did I learn?

The course helped to supplement my knowledge in trading — I had a better understanding on how the stock market works, on stock market data, on how to leverage technical indicators to construct a portfolio. I also enjoyed framing the stock market trading problem into a supervised learning problem for machine learning, such as prediction the next day’s price (i.e. a regression problem), or whether to buy or sell (i.e. a classification problem)

Grades

I got an A for this course :)

--

--

Valerie Lim

A fast learner and self-starter, Valerie is results driven and possesses strong analytical skills | Data Scientist @ Dell | linkedin.com/in/valerie-lim-yan-hui/