An interactive web application built using Python and Streamlit to forecast Electric Vehicle (EV) adoption trends across selected U.S. counties using machine learning.
- Forecasts future EV adoption trends using a Random Forest Regressor trained on historical EV registration data.
- Allows users to select and compare up to three counties simultaneously.
- Automatically handles missing or insufficient data to maintain a smooth user experience.
- Visualizes historical and predicted EV adoption trends using interactive comparative line charts.
Source: U.S. EV Registration Data
Data Type: County-level EV population statistics
Time Range: Historical EV counts across multiple years
The dataset was cleaned and preprocessed before training the forecasting model.
The forecasting pipeline consists of the following steps:
- Removed missing or inconsistent entries
- Organized EV counts by county and year
Generated statistical features to capture temporal patterns:
- Lag features
- Rolling means
- Percentage change
- Growth slope indicators
These features help the model understand historical adoption trends.
A Random Forest Regressor was trained on the engineered features to learn non-linear patterns in EV adoption trends.
The trained model predicts future EV adoption counts based on historical growth patterns.
The Streamlit interface allows users to:
- Select counties for comparison
- Visualize historical EV growth
- Display future forecasted adoption trends
Interactive charts make it easier to compare EV adoption across regions.
- Python
- Pandas
- Scikit-learn
- Matplotlib
- Streamlit
- Random Forest Regressor
- Lag features
- Rolling statistics
- Trend-based transformations
Clone this repo and run:
streamlit run app.py