Historical features
Lagged closes, rolling averages and volatility, plus 5-, 10-, and 20-session momentum features.
A Python machine-learning project that compares Linear Regression and Random Forest on historical stock prices, with expanding walk-forward evaluation instead of random train/test splits.
Built with Python · scikit-learn · yfinance · Streamlit
Illustrative graphic only — no live market data or forecast is shown on this static page.
The goal is not to promise a winning trade. It's to make the modeling process inspectable and compare predictions against a simple baseline.
Lagged closes, rolling averages and volatility, plus 5-, 10-, and 20-session momentum features.
Compare Linear Regression and Random Forest against a previous-close baseline on later observations.
Three expanding chronological windows with MAE, RMSE, R², directional accuracy, and an actual-vs-predicted chart.
A clear, repeatable pipeline from price history to a one-session forecast.
Download adjusted daily closing prices through yfinance.
Construct lagged and rolling features using prior observations.
Expand the training history and evaluate on later dates, without shuffling.
Measure model errors and compare them with a naive baseline.
Deploy the existing Python app to Streamlit Community Cloud. After the one-time deployment, the app runs in the cloud and visitors can use it from a browser without installing Python locally.
Sign in with GitHub, review the repository settings, and deploy app.py from the main branch.
First deployment requires your own Streamlit/GitHub authorization. Choose a public app if you want others to use it.
Users enter a Yahoo Finance ticker, choose 1, 2, 5, or 10 years of daily history, and run an online forecast. The app compares Linear Regression and Random Forest with a previous-close baseline across expanding chronological test windows.
python -m venv .venv python -m pip install -r requirements.txt
python -m streamlit run app.py