Curated educational Python examples rebuilt from older personal scripts, coursework experiments, and standalone prototypes.
This repository is intentionally selective. The goal is to keep the best ideas, rewrite them cleanly, remove brittle local assumptions, and make the examples easier to learn from.
- A cleaned educational lab covering calculus, linear algebra, finance, time series, streaming, and text processing
- A portfolio-friendly archive of reusable, self-contained examples
- A safe rewrite of older scripts with secrets, API keys, and local-path assumptions removed
- A production trading system or financial guidance
- A dump of every historical experiment
- A promise that every model here is statistically sound for live use
python-learning-lab/
├── src/learning_lab/
│ ├── calculus/ # Numerical integration
│ ├── finance/ # Monte Carlo, correlation, GARCH
│ ├── linear_algebra/ # PCA walkthrough
│ ├── streaming/ # Kafka + Spark examples
│ ├── text/ # LaTeX to plaintext
│ └── time_series/ # SARIMA workflow
├── notebooks/ # Jupyter notebook walkthroughs
├── docs/
│ └── curation_notes.md # What was kept, rewritten, or dropped
├── inventories/ # Classification CSVs for source files
├── pyproject.toml
├── LICENSE
└── README.md
| Module | Description |
|---|---|
calculus/riemann_sum_demo.py |
Midpoint Riemann sums with exact integral comparison |
linear_algebra/pca_walkthrough.py |
Step-by-step PCA on a tiny two-feature dataset |
finance/monte_carlo_gbm.py |
Geometric Brownian Motion simulation (CSV or synthetic data) |
finance/correlation_heatmap.py |
Correlation heatmap from adjusted-close price data |
finance/garch_t_simulation.py |
GARCH(1,1) volatility forecast with Student-t Monte Carlo |
streaming/kafka_price_producer.py |
Kafka producer for streaming price events from CSV |
streaming/kafka_social_producer.py |
Kafka producer for social text events from JSONL |
streaming/spark_social_sentiment_stream.py |
Spark Structured Streaming with VADER sentiment |
text/latex_to_plaintext.py |
Strip common LaTeX commands into readable text |
time_series/sarima_workflow.py |
Train/test SARIMA workflow with holdout evaluation |
python3 -m venv .venv
source .venv/bin/activate
pip install -e .Run modules directly:
# Calculus — no extra dependencies
python -m learning_lab.calculus.riemann_sum_demo --plot
# PCA — no extra dependencies
python -m learning_lab.linear_algebra.pca_walkthrough
# Monte Carlo — uses synthetic data by default
python -m learning_lab.finance.monte_carlo_gbm --sims 500 --plot
# With a CSV of historical prices
python -m learning_lab.finance.monte_carlo_gbm --csv prices.csv --plotSome modules need additional packages, installable via extras:
pip install -e ".[finance]" # yfinance, seaborn, scipy
pip install -e ".[timeseries]" # statsmodels, scikit-learn
pip install -e ".[volatility]" # arch (for GARCH)
pip install -e ".[streaming]" # confluent-kafka, pyspark, nltkThe Kafka and Spark examples are reference implementations that require running infrastructure. They are included as educational reading and as templates, not as standalone demos. To run them you need:
- A running Kafka broker (default:
localhost:9092) - Apache Spark (for the Spark Structured Streaming example)
- Sample CSV/JSONL data files matching the expected schemas
This repo was curated from:
~/projects/legacy-python-scripts— older personal Python experiments~/Documents/Stevens-MS-Math— graduate coursework scripts- A small number of home-directory utility scripts
The full classification of every source file (keep, rewrite, archive, drop) is recorded in: