kavinda0126/coral-reef-bleaching-prediction
๐ชธ Coral Reef Bleaching Risk Predictor
A machine learning web application that predicts coral reef bleaching risk using four trained classification models. Built as part of an ML assignment at SLIIT.
Overview
Coral bleaching occurs when ocean temperatures rise above normal levels, causing corals to expel their symbiotic algae and turn white. This app takes real-world oceanographic measurements as input and predicts whether a reef site is at risk of bleaching.
Dataset: Global Coral Bleaching Database 1980โ2020 (BCO-DMO)
Models
All four models vote on the final prediction. The consensus is determined by the number of models predicting bleaching:
- 4/4 votes โ CRITICAL
- 3/4 votes โ HIGH RISK
- 2/4 votes โ MODERATE
- 1/4 votes โ LOW RISK
- 0/4 votes โ SAFE
Input Features
Key bleaching risk indicators:
TSA_DHW > 8โ severe bleaching expectedTemperature_Mean > 30ยฐC+SSTA > 1.5โ high risk- Low turbidity + high DHW โ maximum risk
App Features
Single Prediction
Adjust ocean condition sliders to get an instant prediction from all 4 models with a probability bar chart and consensus gauge.
Sample Reef Sites
Load pre-configured data from 10 real-world reef locations including the Great Barrier Reef, Maldives, Red Sea, and Caribbean.
Batch Prediction
Run all 10 sample sites through all 4 models simultaneously and view results as a probability heatmap.
Model Info
View loaded model performance metrics (accuracy, F1, ROC-AUC) and feature counts.
Project Structure
โโโ app.py # Gradio web application
โโโ requirements.txt # Python dependencies
โโโ models/
โ โโโ lr/ # Logistic Regression artifacts
โ โ โโโ lr_model.pkl
โ โ โโโ lr_scaler.pkl
โ โ โโโ lr_features.pkl
โ โ โโโ lr_metadata.json
โ โโโ rf/ # Random Forest artifacts
โ โโโ xgb/ # XGBoost artifacts
โ โโโ svm/ # SVM artifacts
โโโ notebooks/ # Training notebooksLocal Setup
pip install -r requirements.txt
python app.pyTech Stack
- ML: scikit-learn, XGBoost
- UI: Gradio
- Data: pandas, numpy
- Visualization: matplotlib
