How muvva-adityavardhan/forest-fire-prediction works
Project type and purpose
• This is a full-stack, web-based Machine Learning application for forest-fire prediction.
• Backend: Python + Flask serving a prediction service.
• Frontend: HTML/CSS templates for user input and result display.
• ML pipeline: data preprocessing → model training notebooks → model artifacts (Random Forest, KNN, Decision Tree) → prediction.
File structure
• Top-level files:
– data (2003.csv … 2021.csv) – raw time-series dataset
– Jupyter notebooks (ForestFires.ipynb, etc.) – exploratory analysis & model training
– app.py – Flask application entry point (routes + controller logic)
– model scripts (model.py, knn_model.py, decisiontree_model.py) – model-wrapping code
– serialized artifacts (rf_model.pkl, knn_model.pkl, dt_model.pkl, scaler.pkl)
– requirements.txt – dependencies
• Directories:
– templates/ – HTML files (index.html, manual.html, map.html, result.html) → view layer
– static/ – CSS/JS/images → presentation assets
• No microservices; follows an MVC-style pattern within a single Flask service.
README for additional insights
• Confirms Random Forest classifier (accuracy 99.84%) built on VPD and environmental variables.
• Web interface for manual VPD & location entry; real-time prediction.
• Future scope indicates potential satellite imagery or API-driven real-time data.
a. Main components:
1. User Browser (UI)
2. Static Assets Server (CSS, JS, images)
3. Flask Web Application
– Route Handlers (Controllers)
– Model Loading Service
– Prediction Engine
4. Model Artifacts Storage (Pickle files + Scaler)
5. Data Store (CSV files or external DB if extended)
6. (Optional) Model Training Pipeline (Jupyter Notebooks, Data Preprocessor, Model Trainer)
7. External Services (future: Satellite Imagery API, Weather API)
b. Relationships & data flow:
– User requests page → Flask serves HTML + static assets
– User submits VPD & location → HTTP POST to Flask route
– Flask controller loads scaler & model from artifact store (once or cached)
– Input data → Preprocessor → Model.predict() → result
– Controller renders result.html (or map.html) with prediction
c. Architectural patterns / design principles:
– MVC:
• Model = serialized ML artifacts + preprocessing logic
• View = Jinja templates in templates/ + static files
• Controller = Flask routes in app.py
– Separation of concerns: data ingestion/training vs. inference service
– Single-process, single-service fashion; can evolve into microservices (e.g., separateInference API)
d. Key technologies & frameworks:
– Python + Flask for web server
– scikit-learn for ML models
– pandas/numpy for data processing
– joblib/pickle for model serialization
– HTML/CSS (templates & static) for frontend