bytebard101/seismosense

By bytebard101

โ€ขUpdated 3 months ago

An ML classifier tool which predicts the alert status of earthquakes based on geographical data

Image
Languages & frameworks
Machine learning & AI
Data science
0

1.2K

bytebard101/seismosense repository overview

โ SeismoSense ๐ŸŒ

SeismoSense is an AI-powered earthquake alert prediction system that leverages machine learning to analyze seismic data and provide instant alert predictions. This project combines cutting-edge ML pipelines, SMOTE oversampling for imbalanced data, and a sleek, futuristic Flask frontend with animated confidence bars.

To check the GitHub repo, click hereโ 


โ ๐Ÿš€ Features

  • Predicts earthquake alert levels (green, orange, red, yellow) based on 5 key seismic features:
    • magnitude
    • depth
    • cdi (Community Disaster Index)
    • mmi (Modified Mercalli Intensity)
    • sig (Significance)
  • Multi-model training using:
    • XGBoost
    • Random Forest
    • SVC
    • KNN
    • Bagging Classifier
  • Built-in SMOTE oversampling inside the pipeline to handle class imbalance safely.
  • Cross-validation aware pipeline ensures no data leakage.
  • Animated progress-bar style confidence for predictions.
  • Modern, dark-themed UI inspired by UrbanEchoโ  and CosmoClassifierโ .

โ ๐Ÿ“ธ Screenshots

  1. Landing Page
    Screenshot Input

  2. Prediction Result with Confidence Bar
    Screenshot Result


โ ๐Ÿงฐ Installation

  1. Clone the repo and install dependencies:
git clone https://github.com/your-username/SeismoSense.git
cd SeismoSense
pip install -r requirements.txt
  1. Run the Flask app:
python app.py

Open your browser and navigate to http://127.0.0.1:5000โ  to start predicting earthquake alerts!


โ ๐Ÿณ Run the app directly via Dockerhub Image

A Dockerhub repositoryโ  is created where I have pushed the docker image which contains the entire Cosmoclassifier app.

The image is built on both ARM64 and AMD64 architectures, so that it can run on almost all major computers. You can run the app easily by using the Dockerhub Image. Here's how you can do it:

  1. Install Docker Desktopโ  and sign-in. Make sure the app is functioning properly.

  2. Open Terminal and run:

docker pull bytebard101/seismosense:latest
docker run --rm -p 5000:5000 bytebard101/seismosense:latest
  1. If your machine faces a port conflict, you will need to assign another port. Try to run this:
docker run --rm -p 5001:5000 bytebard101/seismosense:latest

If you followed Step 2 and the command ran successfully, then DO NOT follow this step.

  1. The app will be live at localhost:5000. Open your browser and navigate to http://127.0.0.1:5000โ  (or http://127.0.0.1:5001โ  if you followed Step 3).

Check Docker Documentationโ  to learn more about Docker and it's commands.


โ ๐Ÿ“Š Dataset Overview

SeismoSense uses the Earthquake Alert Prediction Dataset from Kaggle, contributed by Ahmed Mohamed Zaki.
Dataset linkโ 

โ Source & Purpose

The dataset compiles seismic measurements and historical alert levels, aiming to support predictive models for earthquake warning systems. It provides a real world challenge โ€” classification under class imbalance with geophysical features.

โ Features & Target
FeatureMeaning / Description
magnitudeMeasured strength (Richter or comparable scale)
depthHow deep the quake was beneath the surface
cdiCommunity Disaster Index (impact-based)
mmiModified Mercalli Intensity (felt intensity)
sigSignificance metric (statistical/energy measure)
  • Target (alert): The alert classification with four possible categories:
    • green
    • orange
    • red
    • yellow

The original mapping used in the repository is:

{'green': 0, 'orange': 1, 'red': 2, 'yellow': 3}

โ ๐Ÿง  Model Performance

The ML pipeline was trained on the Earthquake Alert Prediction Dataset using RandomizedSearchCV for hyperparameter tuning and SMOTE to handle class imbalance.

Classification Report on Test Set (260 samples):

LabelPrecisionRecallF1-ScoreSupport
0 (green)0.890.830.8665
1 (orange)0.880.980.9365
2 (red)0.980.940.9665
3 (yellow)0.860.850.8565
Accuracy0.90260
Macro Avg0.900.900.90260
Weighted Avg0.900.900.90260

โœ… Achieves 90% accuracy with balanced performance across all alert levels, showing robustness even on imbalanced data.


โ ๐Ÿ“ Repository Structure

SEISMOSENSE/
โ”œโ”€โ”€ dataset/
โ”‚ โ””โ”€โ”€ earthquake_data.csv   # Training dataset 
โ”œโ”€โ”€ models/
โ”‚ โ”œโ”€โ”€ estimator.pkl         # Trained ML pipeline
โ”‚ โ””โ”€โ”€ names.pkl             # Feature column names
โ”œโ”€โ”€ templates/
โ”‚ โ””โ”€โ”€ index.html            # Frontend code
โ”œโ”€โ”€ .dockerignore           # Excludes unnecessary files from Docker build
โ”œโ”€โ”€ .gitignore              # Ignores venv, pycache, logs, etc.
โ”œโ”€โ”€ app.py                  # Flask server
โ”œโ”€โ”€ Dockerfile              # Containerizes the app for deployment
โ”œโ”€โ”€ fit.py                  # ML training script 
โ”œโ”€โ”€ LICENSE                 # MIT License
โ”œโ”€โ”€ README.md               # Youโ€™re reading it
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ””โ”€โ”€ research.ipynb       # # Notebook used for testing, visualization and many more

โ โš™๏ธ Technology Stack

  • Python 3.13.7

  • Flask for frontend server

  • scikit-learn for ML tasks

  • imbalanced-learn for SMOTE implementation and pipeline

  • XGBoost, RandomForest, SVC, KNN, Bagging for model benchmarking

  • HTML/CSS for modern UI with animation

  • Docker for containerized deployment


โ ๐Ÿ”ฎ Future Improvements

  • Add real-time earthquake data ingestion for live predictions.

  • Build a map-based visualization showing predicted alert levels geographically.

  • Extend to batch prediction for CSV uploads.

  • Add user authentication and log predictions for research purposes.

Note: Due to the absence of front-end web development expertise and the absence of other contributors for the project, I was compelled to utilize AI tools (such as LLM services like ChatGPTโ„ข, Grokโ„ข, and GitHub Copilotโ„ข) to develop a sophisticated front-end for the web app. I am looking forward to human contribution on this project in order to scale it even further.


โ ๐Ÿ“„ License

This project is licensed under the MIT License โ€” feel free to use, modify, or extend for personal and research purposes.

โ ๐Ÿ˜ƒ Appreciation

Thank you for visting the repository. Iโ€™d be thrilled to hear those! You can find my contact info on my GitHub profileโ .

If you liked this project, please consider giving it a star ๐ŸŒŸ

Have a great day!

Tag summary

Content type

Image

Digest

sha256:81bccab36โ€ฆ

Size

643.4 MB

Last updated

3 months ago

docker pull bytebard101/seismosense