This repository contains a refactored version of the source code used in Lecture 2 (Uncertainty) of the CS50AI course. The original code relied on an outdated version of the pomegranate
library, which raised errors and could not be easily updated to work with modern environments.
To address this issue, I have refactored the code to use pgmpy
and hmmlearn
, two well-documented, up-to-date, and cross-platform libraries for probabilistic inference and Hidden Markov Models (HMMs).
I have kept the structure and comments as close as possible to the original code while ensuring clarity and simplicity. I hope this is helpful for anyone currently learning CS50AI.
- Lecture Link: CS50AI - Uncertainty
- pgmpy Documentation: https://pgmpy.org/
- hmmlearn Documentation: https://hmmlearn.readthedocs.io/en/latest/
- Original Source Code: CS50AI Lecture 2 Source Code
(Note: The first commit in this repository contains the original, unmodified code as a reference.)
To run the refactored code, install the required dependencies:
pip install pgmpy hmmlearn
Run the refactored scripts as you would with the original course materials:
python [folder]/filename.py
Ensure that your Python environment is set up properly and that you have all required dependencies installed.
- Contributions and feedback are welcome!