Skip to content

SamridhiiiGupta/ExoHabitAI

Repository files navigation

ExoHabitAI Banner

🪐 E X O H A B I T A I

"Because the next Earth might already be out there — waiting to be found."


Python Flask Scikit-Learn XGBoost HTML5 Render


🌌 A full-stack machine learning system that predicts whether a distant exoplanet could harbor life —
powered by real astrophysical data, engineered features, and production-ready ML pipelines.



🌠 Mission Briefing

"There are more stars in the observable universe than grains of sand on Earth.
Among those stars orbit billions of planets. ExoHabitAI asks the question:
Which ones could be home?"

ExoHabitAI is not just a machine learning project — it is a scientific exploration tool.
It ingests raw exoplanet data, processes astrophysical signals, calculates Earth Similarity Indices, and deploys a trained ML model through a polished web dashboard to deliver habitability predictions in real-time.

This project bridges data science, astronomy, and software engineering — the way real-world AI systems are built.



🚀 Live Demo & Quick Access

Access Point Link
🌐 Live App b13-exohabitai-samridhigupta.onrender.com
🖥️ Local Dashboard http://127.0.0.1:5000 after running Flask
🟢 Health Check GET /
🔵 Model Info GET /model-info
🚀 Predict POST /predict
🏆 Top Rankings GET /rank
📓 Notebooks ./notebooks/


🌌 Live Demo Experience

🚀 Watch ExoHabitAI in action — real-time prediction system

🎥 Demo Video:
👉 ▶️ Click to Watch



🖥️ Frontend Experience

A futuristic AI-powered interface designed for seamless space exploration and intelligent habitability analysis.


🚀 1. Initial Landing Experience

Initial Homepage

↑ First impression of ExoHabitAI — immersive space UI with strong visual identity and entry point into the system.



🌌 2. Homepage — System Overview

Homepage

↑ Overview of the platform, showcasing AI-driven exoplanet research, data pipeline, and model performance.



🧠 3. Prediction Input & Top Ranked Planets

Prediction Input

↑ Users input planetary parameters and instantly explore the top 20 most habitable exoplanets ranked by the model.



📊 4. Prediction Result Dashboard

Prediction Result

↑ Detailed habitability report with probability score, parameter influence, and scientific insights.



🪐 5. About Page — Project Insight

About Page

↑ Explains the mission, methodology, and AI approach behind ExoHabitAI.



📈 6. Visualization Dashboard

Visualization Dashboard

↑ Advanced analytics dashboard with feature importance, distributions, model comparison, and data insights.



✨ Key Highlights

  • 🌠 Futuristic space-themed UI/UX
  • ⚡ Real-time AI habitability prediction
  • 📊 Interactive data visualizations
  • 🧪 Scientifically inspired feature engineering
  • 🚀 Smooth navigation across multiple modules

🧬 Machine Learning Pipeline

From raw stellar data to intelligent predictions — a five-stage mission

RAW DATA  ──►  PREPROCESSING  ──►  FEATURE ENGINEERING  ──►  MODEL TRAINING  ──►  PREDICTION
   🪐                🧹                    🧮                       🤖                  ✅

Stage 1 — Data Ingestion & Cleaning

  • Loaded the NASA Exoplanet Archive dataset with 30+ astrophysical features
  • Removed duplicate records and irrelevant columns
  • Standardized column naming and data types

Stage 2 — Missing Value Handling

  • Applied median imputation for numerical orbital features
  • Used domain-constrained bounds to cap outliers (e.g., stellar temperature ranges)
  • Visualized missingness patterns using heatmaps

Missing Values Heatmap ↑ Missing values heatmap — guiding imputation strategy


Stage 3 — Feature Engineering

  • Engineered the Earth Similarity Index (ESI) from radius, density, escape velocity, and surface temperature
  • Created orbital stability indicators
  • Normalized all features using StandardScaler

Stage 4 — Model Training & Selection

Trained and evaluated five models:

Model Accuracy ROC-AUC
Logistic Regression
Decision Tree
Random Forest
XGBoost
Tuned Random Forest ✅ Best Best

Replace with your actual metrics from final_model_metrics.csv

Stage 5 — Evaluation

  • Confusion matrices, ROC curves, and feature importance analyzed for every model
  • Final model serialized as exohabit_model.pkl


📊 Visual Insights

The data tells a story — here's how we listened

Model Comparison

Model Comparison ↑ Side-by-side accuracy and AUC comparison across all trained models


Feature Importance

Feature Importance ↑ Top predictive features driving habitability classification


Confusion Matrices

Final Selected Model Tuned XGBoost
Final Model CM XGBoost CM
Confusion Matrix — Best Model Confusion Matrix — Tuned XGBoost

ROC Curves

Random Forest Logistic Regression
RF ROC LR ROC
Random Forest ROC Curve Logistic Regression ROC Curve


⚙️ Backend & API

The engine room — where predictions are born

Architecture

Frontend (HTML/JS)
       │
       ▼
  Flask API  (app_deploy.py · port 5000)
       │
       ├──── GET  /              →  Health Check
       ├──── GET  /model-info    →  Model Metadata
       ├──── POST /predict       →  Habitability Prediction
       └──── GET  /rank          →  Top 10 Habitable Planets
       │
       ▼
  Feature Preprocessing  (utils.py)
       │
       ▼
  exohabit_model.pkl  ──►  Prediction Output

🟢 Endpoint 1 — Health Check

GET / — Confirms the backend API is running.

// Response
{
  "message": "ExoHabitAI Backend API Running",
  "status": "success"
}

Health Check Endpoint GET 127.0.0.1:5000 — API health confirmed live in browser



🔵 Endpoint 2 — Model Information

GET /model-info — Returns model metadata and features used.

// Response
{
  "features_used": [
    "planet_radius",
    "planet_mass",
    "orbital_period"
  ],
  "model_name": "ExoHabitAI",
  "version": "1.0"
}

Model Info Endpoint GET 127.0.0.1:5000/model-info — model metadata returned



🚀 Endpoint 3 — Habitability Prediction

POST /predict — Predicts habitability of an exoplanet from input features.

# Tested via backend/test_api.py
python backend/test_api.py
// Response
{
  "habitability_probability": 0.9995276927947998,
  "prediction": 1,
  "status": "success"
}

prediction: 1Habitable · prediction: 0 → Non-Habitable

Prediction API Terminal test_api.py output — 99.95% habitability probability returned



🏆 Endpoint 4 — Habitability Ranking

GET /rank — Returns the Top 10 most habitable exoplanets from the dataset, ranked by habitability probability and supporting metrics including ESI score, equilibrium temperature, orbital stability factor, and stellar compatibility index.

// Response (truncated)
{
  "count": 10,
  "status": "success",
  "top_planets": [
    {
      "Equilibrium_Temp": 753.2,
      "Habitability_Probability": 0.9999881,
      "Habitability_Score_Index": 0.2260783639999819,
      "Orbital_Period": 18.2734,
      "Orbital_Stability_Factor": 0.40665921750518514,
      "Planet_Density": 3.53,
      "Planet_Mass": 8.7,
      "Planet_Name": "TOI-134564 b",
      "Planet_Radius": 2.469,
      "Stellar_Compatibility_Index": 0.8883289840950909,
      "Stellar_Metallicity": 0.0,
      "Stellar_Temp": 5048.0,
      "Target_Habitable": 1
    }
    // ... 9 more planets
  ]
}

Rank Endpoint Output GET /rank — Top 10 habitable exoplanet candidates with full metrics



🧪 Features at a Glance

Feature Description
🔭 Habitability Prediction Binary classification — prediction: 1 (Habitable) or 0 (Non-Habitable) via POST /predict
🌍 ESI Calculation Earth Similarity Index computed from planetary radius, density, escape velocity, and surface temperature
🤖 Multiple ML Models Logistic Regression, Decision Tree, Random Forest, XGBoost — best model selected and deployed
📊 Rich Visualizations Confusion matrices, ROC curves, feature importance charts, missing-value heatmaps
🖥️ Interactive Dashboard Space-themed frontend with real-time prediction UI at frontend/dashboard.html
🟢 Health Check API GET / — confirms backend is live
🔵 Model Info API GET /model-info — returns model name, version, and features used
🚀 Prediction API POST /predict — returns habitability_probability (0–1) and binary prediction
🏆 Ranking API GET /rank — returns Top 10 habitable exoplanet candidates with full metrics
📦 Deployment Ready Configured for Render via render.yaml — live at onrender.com


📂 Project Structure


B13-EXOHABITAI/
│
├── 📁 assets/images/        # README screenshots & visuals
├── 📁 backend/              # Flask API
│   ├── app_deploy.py        # 4 endpoints: /, /model-info, /predict, /rank
│   ├── utils.py             # Feature preprocessing
│   └── best_model.pkl       # Serialized production model
│
├── 📁 data/
│   ├── raw/                 # NASA Exoplanet Archive snapshot (CSV)
│   ├── preprocessed/        # Cleaned & imputed dataset
│   └── processed/           # Feature-engineered + habitability-ranked output
│
├── 📁 frontend/
│   ├── index.html           # Landing page
│   └── dashboard.html       # Prediction UI
│
├── 📁 models/
│   └── exohabit_model.pkl   # Tuned Random Forest — final production model
│
├── 📁 notebooks/
│   ├── DataPreprocessingCodeFile.ipynb
│   ├── model_training.ipynb
│   └── ExoHabitAI_Project_Report.pdf
│
├── 📁 reports/              # Model evaluation outputs (19 PNGs + 2 CSVs)
│   ├── final_model_metrics.csv
│   ├── model_comparison.png
│   ├── feature_importance.png
│   └── [confusion matrices & ROC curves for all 5 models]
│
├── render.yaml              # Render deployment config
├── requirements.txt
└── README.md                # You are here 📍

↑ Full project directory — VS Code Explorer


🛠️ Tech Stack

Layer Technology
Language Python 3.10+
ML Framework Scikit-Learn, XGBoost
Data Processing Pandas, NumPy
Visualization Matplotlib, Seaborn
Backend / API Flask
Frontend HTML5, CSS3, JavaScript
Serialization Pickle (.pkl)
Deployment Render (render.yaml)
Notebooks Jupyter
Version Control Git & GitHub


🚀 Run It Locally — Launch Sequence

Prerequisites

Python 3.10+
pip
Git

Step 1 — Clone the Repository

git clone https://github.com/YOUR_USERNAME/B13-ExoHabitAI.git
cd B13-ExoHabitAI

Step 2 — Create Virtual Environment

python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate

Step 3 — Install Dependencies

pip install -r requirements.txt

Step 4 — Launch the Flask API

cd backend
python app_deploy.py

Step 5 — Open the Dashboard

Navigate to: http://localhost:5000

🟢 You're live. Enter exoplanet parameters and receive your first habitability prediction.



☁️ Deployment

ExoHabitAI is configured for Render deployment via render.yaml.

Deploy to Render

  1. Fork this repository
  2. Connect to Render and create a New Web Service
  3. Point it to your forked repo
  4. Render auto-detects render.yaml and configures the build
  5. Set environment variables if needed
  6. Click Deploy 🚀


📈 Future Improvements

The mission doesn't end here — it's just beginning

  • 🔭 Real-time NASA API Integration — pull live exoplanet data
  • 🧠 Deep Learning Models — LSTM/Transformer-based habitability scoring
  • 🌐 3D Planet Visualization — interactive Three.js exoplanet renderer
  • 📱 Mobile-Responsive UI — full cross-device support
  • 🔍 Explainability Layer — SHAP values for every prediction
  • 🗃️ Database Integration — store and compare historical predictions
  • 🛰️ Multi-Star System Support — binary star habitability zones


🤝 Contributing

Contributions, ideas, and pull requests are welcome.

# Fork → Branch → Commit → PR
git checkout -b feature/your-feature-name
git commit -m "feat: describe your change"
git push origin feature/your-feature-name

Please follow clean commit conventions and add docstrings to new functions.



📄 License

This project is licensed under the terms of the LICENSE file included in this repository.




🌌 "We are made of star stuff. And somewhere out there, another world might be too."


ExoHabitAI was built at the intersection of data science and wonder.
Every model trained, every feature engineered, every prediction made —
is one small step toward answering humanity's oldest question:

Are we alone?


Made with 🔭 by Samridhi Guptaexploring worlds beyond Earth, one dataset at a time.


GitHub

About

🪐 ML-powered exoplanet habitability predictor | Flask API + Interactive Dashboard | Tuned Random Forest | ESI Calculation | Deployed on Render

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors