When reading about arbitrary optimalization and variations of the maximum-likelyhood method I stumbled accross the EM and Baum Welch algorithms, and I thought I'd experiment with them and see how they work.
In this repository I have made three small applications using these, from a very simple dice bias-parameter system to an investment portfolio implementing the Baum Welch algorithm to try to estimate market regime parameters.
In the file "dice.ipynb" I first explore the core workings of the EM algorithm, implemented on a simple situation where our goal is to determine the bias parameters of two dice, given a sequence of head-tail results. The problem is however, we don't know which sequence corresponds to which dice.
In the folder "WeatherModels" I then explore and implement the Baum-Welch algorithm, applied to a weather HMM. I first make a simpler implementation where we have two states and a discrete observation space, and then extend this idea into a continuous version where we have four states and a continuous observation space.
In the folder "PortfolioModel" I also made some implementations of the Baum-Welch algorithm in the setting of constructing a financial portfolio, where Baum-Welch is used for regime detection. This is done for both synthetic and real trading data.