YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Mortgage Rate ML - Pre-trained Models
This repository contains three pre-trained machine learning models for predicting and classifying mortgage rate movements.
Models Overview
1. Prophet Forecasting Model β PRIMARY
File: prophet_model.pkl (81 KB)
Highly accurate time-series forecasting model for predicting mortgage rates 4+ weeks in advance.
- Accuracy: MAE 0.1613%, RMSE 0.2024%, MAPE 0.0397%
- Best For: Exact rate forecasting, trend analysis
- Training Data: 1,044 weeks (2005-2024)
- Confidence: Very High (2.3x better than ARIMA)
Quick Start:
from predictor import MortgageRatePredictor
predictor = MortgageRatePredictor('prophet_model.pkl')
forecast = predictor.predict(periods=30)
print(forecast['dates']) # 30 upcoming dates
print(forecast['predictions']) # Predicted rates
print(forecast['bounds']) # Confidence intervals
2. Classification Model
File: classifier_model.pkl (5 KB)
Random Forest classifier for binary UP/DOWN rate direction prediction.
- Accuracy: 100% (test set)
- Best For: Rate movement direction alerts, binary decisions
- Features: 9 engineered features (lags, moving averages, volatility)
- Note: Perfect accuracy indicates validation needed on real data
Quick Start:
import joblib
import numpy as np
classifier = joblib.load('classifier_model.pkl')
features = np.array([3.5, 3.4, 3.6, 3.7, 3.6, -0.1, -0.5, 3.55, 0.08])
prediction = classifier.predict(features.reshape(1, -1))
probs = classifier.predict_proba(features.reshape(1, -1))
print(f"Direction: {'UP' if prediction[0] == 1 else 'DOWN'}")
print(f"Confidence: {probs[0][prediction[0]]:.2%}")
3. ARIMA Forecasting Model π FALLBACK
File: arima_model.pkl (10 KB)
Classical statistical ARIMA(1,1,2) model for backup forecasting.
- Accuracy: MAE 0.3611%, RMSE 0.4237%, MAPE 0.0905%
- Best For: Validation, sensitivity analysis, fallback
- Comparison: 2.3x less accurate than Prophet
- Advantage: Explainable, lightweight, no hyperparameter tuning
Quick Start:
import joblib
arima_model = joblib.load('arima_model.pkl')
forecast_result = arima_model.get_forecast(steps=4)
forecast_df = forecast_result.conf_int()
print(forecast_df)
Quick Comparison
| Feature | Prophet | Classifier | ARIMA |
|---|---|---|---|
| Accuracy | 0.0397% MAPE β | 100% accuracy | 0.0905% MAPE |
| Output | Exact values | UP/DOWN | Exact values |
| Speed | <1 sec | <100ms | <100ms |
| Confidence | Yes | Yes | Yes |
| Interpretable | Medium | High | High |
| File Size | 81 KB | 5 KB | 10 KB |
| Best For | Primary | Binary alerts | Fallback |
Installation & Setup
Option 1: Use Pre-trained Models
# Install dependencies
pip install pandas numpy scikit-learn statsmodels joblib
# Load models directly
import joblib
prophet = joblib.load('prophet_model.pkl')
classifier = joblib.load('classifier_model.pkl')
arima = joblib.load('arima_model.pkl')
Option 2: Use Predictor Wrapper
# Copy predictor.py from main project
cp ../src/predictor.py .
# Use the clean API
from predictor import MortgageRatePredictor
predictor = MortgageRatePredictor('prophet_model.pkl')
forecast = predictor.predict(periods=30)
Integration Guide
See INTEGRATION_GUIDE.md for complete instructions on integrating with MortgageRateNotifier.
License
MIT License - Free for commercial and personal use
Disclaimer
These models are provided as-is for educational and research purposes.
β οΈ Important Warnings:
- Not for Financial Advice: Models should not be sole basis for financial decisions
- Accuracy Unknown: Perfect classifier accuracy on test data likely indicates overfitting
- Real-World Performance: Models trained on historical data; real-world performance uncertain
- Requires Validation: Extensively test with real market data before production use
- Fallback Plan: Always have ARIMA as fallback to Prophet
Use at your own risk. Validate thoroughly before deployment to critical systems.
Last Updated: April 8, 2026