Skip to content

zain-cs/Earthquake-Alert-Prediction-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

🌋 Earthquake Alert Prediction System

A machine learning project that predicts earthquake alert levels (green, yellow, orange, red) using Random Forest Classifier based on seismic features.

📊 Project Overview

This project analyzes earthquake data and predicts alert severity levels using key seismic parameters. The model helps in early warning systems by classifying earthquakes into different alert categories based on their characteristics.

✨ Features

  • Random Forest Classification: Robust ensemble learning method for alert prediction
  • Feature Importance Analysis: Identifies which seismic factors most influence alert levels
  • Multi-class Classification: Predicts multiple alert levels (green, yellow, orange, red)
  • Interactive Predictions: Test the model with custom earthquake parameters
  • Visualization: Clear charts showing feature importance

🔧 Technologies Used

  • Python 3.x
  • pandas - Data manipulation and analysis
  • numpy - Numerical computing
  • scikit-learn - Machine learning algorithms
  • matplotlib - Data visualization
  • Google Colab - Cloud-based development environment

📋 Prerequisites

pip install pandas numpy scikit-learn matplotlib

🚀 Getting Started

1. Clone the Repository

git clone https://github.com/zain-cs/earthquake-alert-predictor.git
cd earthquake-alert-predictor

2. Prepare Your Dataset

Your CSV file should contain the following columns:

  • magnitude - Earthquake magnitude
  • depth - Depth in kilometers
  • cdi - Community Decimal Intensity
  • mmi - Modified Mercalli Intensity
  • sig - Significance value
  • alert - Alert level (green, yellow, orange, red)

3. Run the Model

Open the notebook in Google Colab or run the Python script:

python earthquake_predictor.py

Upload your earthquake dataset when prompted.

📈 Model Performance

The Random Forest Classifier provides:

  • Accuracy Score: Shows overall prediction accuracy
  • Confusion Matrix: Detailed breakdown of predictions vs actual values
  • Classification Report: Precision, recall, and F1-score for each alert level
  • Feature Importance: Ranking of which features matter most

🎯 Usage Example

Predict alert level for a new earthquake:

# Example earthquake parameters
new_earthquake = {
    'magnitude': 6.5,
    'depth': 20,      # km
    'cdi': 5.0,
    'mmi': 4.5,
    'sig': 120
}

# Model predicts: "yellow" or "orange" depending on trained data

📊 Dataset Structure

Column Description Example
magnitude Richter scale measurement 6.5
depth Depth in kilometers 20
cdi Community Decimal Intensity 5.0
mmi Modified Mercalli Intensity 4.5
sig Significance score 120
alert Alert level (target) yellow

🔬 Model Parameters

  • n_estimators: 100 trees in the forest
  • max_depth: None (trees grow to full depth)
  • random_state: 42 (for reproducibility)
  • test_size: 20% of data reserved for testing

📁 Project Structure

earthquake-alert-predictor/
│
├── earthquake_predictor.py    # Main prediction script
├── README.md                   # Project documentation
├── requirements.txt            # Python dependencies
└── data/                       # Sample datasets (optional)

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

👨‍💻 Author

Zain

🙏 Acknowledgments

  • Earthquake data from USGS (United States Geological Survey)
  • scikit-learn documentation and community
  • Random Forest algorithm by Leo Breiman

📞 Contact

For questions or suggestions, please open an issue on GitHub or reach out through my profile.


⭐ If you find this project helpful, please consider giving it a star!

About

A machine learning model that predicts earthquake alert levels (green, yellow, orange, red) using Random Forest based on seismic features. Includes feature importance analysis, visualizations, and interactive predictions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors