MuhammadJamal1144/wind-power-forecast
0
Wind Power Forecasting FastAPI App
This project is a machine learning-based application for forecasting wind power generation. It serves a predictive model through a FastAPI backend and provides a simple web interface for interaction.
Features
- Multiple Models: Utilizes an ensemble of models including XGBoost, LightGBM, CatBoost, and LSTM for robust predictions.
- FastAPI Backend: High-performance, easy-to-use API framework.
- Web Interface: Simple HTML/JS frontend to input features and view predictions.
- Real-time Prediction: Returns power output estimates in Kilowatts (KW).
Prerequisites
- Python 3.8+
- pip
Installation
- Clone the repository:
git clone https://github.com/muhammadjamal1155/wind-power-forecasting-notebook.git
cd wind-power-forecasting-notebook- Create a virtual environment (recommended):
python -m venv venv
# Windows
.\venv\Scripts\activate
# macOS/Linux
source venv/bin/activate- Install dependencies:
pip install -r requirements.txtUsage
- Start the server:
uvicorn app:app --reload --port 8000- Access the application: Open your browser and navigate to
http://127.0.0.1:8000.
- API Documentation: The interactive API docs are available at
http://127.0.0.1:8000/docs.
Project Structure
app.py: Main FastAPI application entry point.models/: Directory containing trained model files (.pkl,.cbm,.keras) and scalers.templates/: Containsindex.htmlfor the frontend.requirements.txt: List of Python dependencies.
Inputs
The model accepts the following features for prediction:
- Wind Speed (m/s)
- Theoretical Power Curve (KWh)
- Wind Direction (°)
- Time features (Hour, Day of Week)
- Lag features (Power, Wind Speed)
- Rolling Mean features
Prediction Determinism
By default, /predict_smart now runs in stateless mode so the same input returns the same output.
- Default:
STATEFUL_FEATURE_HISTORY=0(deterministic requests) - Optional: set
STATEFUL_FEATURE_HISTORY=1to enable cross-request lag history behavior
