Skip to content

Latest commit

Β 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NASA Kepler Exoplanet Classification Project

A machine learning project for classifying Kepler Objects of Interest (KOI) using multiple approaches including deep learning (GP+CNN pipeline), traditional ML (Random Forest, XGBoost), and neural networks.

🎯 Project Overview

This project aims to identify potential exoplanets from NASA's Kepler mission data by analyzing light curves and extracted features. The project implements a complete ML pipeline from Gaussian Process denoising to deep learning classification.

Key Features

  • GP Denoising: Gaussian Process regression for light curve preprocessing
  • TLS Search: Transit Least Squares for period detection
  • Deep Learning: CNN-based classification pipeline (GP+CNN)
  • Traditional ML: Random Forest, XGBoost with GPU acceleration
  • Neural Networks: Multiple architectures (MLP, 1D-CNN, GP+CNN)
  • Comprehensive Benchmarking: CPU vs GPU performance comparison

πŸ“Š Dataset

Input Data Files (in data/)

  1. tsfresh_features.csv (21.6 MB)

    • Time-series features extracted using TSFresh library
    • Contains ~3,500 samples with extracted statistical features
    • Used for traditional ML models (Random Forest, XGBoost, MLP)
  2. q1_q17_dr25_koi.csv

    • Kepler Objects of Interest catalog (Quarters 1-17, Data Release 25)
    • Contains KOI metadata: period, t0, duration, disposition
    • Fields: kepid, kepoi_name, kepler_name, koi_disposition, koi_pdisposition

Data Preprocessing

  • Remove columns with single unique values
  • Filter out samples with infinity values
  • Fill NaN values with zero or column mean
  • StandardScaler normalization
  • Train/Val/Test split: varies by model (typically 90%/5%/5%)

πŸ—οΈ Project Structure

model/
β”œβ”€β”€ app/                          # Application modules
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   └── cnn1d.py             # Two-Branch 1D-CNN implementation
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   └── fold.py              # Phase folding & view construction
β”‚   β”œβ”€β”€ trainers/
β”‚   β”‚   β”œβ”€β”€ cnn1d_trainer.py     # Training loop for CNN
β”‚   β”‚   └── utils.py             # Utility functions
β”‚   β”œβ”€β”€ calibration/
β”‚   β”‚   └── calibrate.py         # Model calibration utilities
β”‚   β”œβ”€β”€ denoise/                 # GP denoising modules
β”‚   β”œβ”€β”€ search/                  # TLS period search
β”‚   └── validation/              # Validation utilities
β”œβ”€β”€ notebooks/                    # Jupyter notebooks
β”‚   β”œβ”€β”€ 03b_cnn_train.ipynb      # CNN training
β”‚   └── 04_newdata_inference.ipynb # Inference pipeline
β”œβ”€β”€ scripts/                      # Executable scripts
β”‚   β”œβ”€β”€ benchmarks/              # Performance benchmarking
β”‚   β”‚   β”œβ”€β”€ complete_gpcnn_benchmark.py    # Complete GP+CNN benchmark
β”‚   β”‚   β”œβ”€β”€ ultraoptimized_benchmark.py    # Ultra-optimized comparison
β”‚   β”‚   β”œβ”€β”€ ultraoptimized_cpu_models.py   # CPU-optimized models
β”‚   β”‚   β”œβ”€β”€ ultraoptimized_gpu_models.py   # GPU-optimized models
β”‚   β”‚   └── visualize_gpcnn_comparison.py  # Visualization tools
β”‚   └── legacy/                  # Legacy training scripts
β”‚       β”œβ”€β”€ koi_project_nn.py    # Simple neural network (MLP)
β”‚       β”œβ”€β”€ train_rf_v1.py       # Random Forest classifier
β”‚       └── xgboost_koi.py       # XGBoost classifier
β”œβ”€β”€ data/                         # Data files (gitignored if large)
β”‚   β”œβ”€β”€ tsfresh_features.csv     # Extracted features
β”‚   └── q1_q17_dr25_koi.csv      # KOI catalog
β”œβ”€β”€ reports/                      # Generated reports & results
β”‚   β”œβ”€β”€ figures/                 # Plots and visualizations (PDF/PNG)
β”‚   β”œβ”€β”€ results/                 # Model results (JSON)
β”‚   β”œβ”€β”€ FINAL_GPU_BENCHMARK_REPORT.txt
β”‚   β”œβ”€β”€ FINAL_GPU_RESULTS_REPORT.md
β”‚   β”œβ”€β”€ GP_CNN_COMPLETE_ANALYSIS.md
β”‚   └── ULTRA_OPTIMIZATION_FINAL_REPORT.md
β”œβ”€β”€ SPECS/                        # Technical specifications
β”‚   β”œβ”€β”€ 1D_CNN_SPEC.md           # CNN architecture spec
β”‚   β”œβ”€β”€ PIPELINE_SPEC.md         # Full pipeline specification
β”‚   └── INTEGRATION_PLAN.md      # Integration guidelines
β”œβ”€β”€ prompts/                      # Development workflow prompts
β”‚   └── claude-commands.md       # Claude Code automation
β”œβ”€β”€ docs/                         # Documentation
β”œβ”€β”€ patches/                      # Code patches for upgrades
β”œβ”€β”€ .claude/                      # Claude Code configuration
β”œβ”€β”€ CLAUDE.md                     # Development guide
β”œβ”€β”€ CITATIONS.md                  # References
β”œβ”€β”€ README_UPGRADE.md             # Upgrade instructions
β”œβ”€β”€ requirements.txt              # Python dependencies
└── README.md                     # This file

πŸš€ Quick Start

1. Installation

pip install -r requirements.txt

Key dependencies:

  • torch - Deep learning framework
  • numpy, pandas - Data processing
  • scikit-learn - Traditional ML
  • xgboost - Gradient boosting
  • transitleastsquares - Period detection
  • celerite2 or starry_process - GP denoising (optional)

2. Running Benchmarks

Complete GP+CNN Benchmark

python scripts/benchmarks/complete_gpcnn_benchmark.py

Runs comprehensive benchmark including:

  • GP+CNN pipeline
  • Neural Networks (Simple MLP, Heavy NN)
  • XGBoost (GPU & CPU)
  • Random Forest (CPU)

Ultra-Optimized Models

python scripts/benchmarks/ultraoptimized_benchmark.py

Tests 2025 best practices:

  • GPU optimizations (cuDNN, TF32, Mixed Precision)
  • CPU optimizations (Intel MKL, OpenMP)
  • Comparison across all model types

Visualization

python scripts/benchmarks/visualize_gpcnn_comparison.py

Generates comparison plots and reports.

3. Legacy Models

Simple Neural Network (MLP)

python scripts/legacy/koi_project_nn.py
  • 3-layer MLP: 256β†’64β†’1
  • BatchNorm + GELU activation
  • AdamW optimizer (lr=3e-5)

Random Forest

python scripts/legacy/train_rf_v1.py
  • Optimized: depth=8, n_estimators=200
  • Grid search with cross-validation

XGBoost

python scripts/legacy/xgboost_koi.py
  • Gradient boosting with tree-based learning

🎯 Model Architectures

1. GP+CNN Pipeline (Recommended)

Pipeline:

  1. GP Denoising: Remove systematics using Gaussian Process regression
  2. TLS Search: Detect periods with Transit Least Squares
  3. CNN Classification: Deep learning on denoised light curves

Architecture:

  • GP simulator: Linear(input) β†’ 1024 β†’ 2048
  • CNN layers: Conv1D blocks with BatchNorm
  • Classifier: FC layers with LayerNorm and GELU
  • Optimizations: Mixed precision (AMP), GPU acceleration

Key Features:

  • Handles raw light curves (no manual feature engineering)
  • Multi-scale pattern recognition
  • GPU-optimized for fast training
  • Best for transit morphology analysis

2. Traditional ML Models

Random Forest:

  • Best for TSFresh features
  • No GPU required
  • Excellent interpretability
  • Achieves ~88% ROC-AUC

XGBoost:

  • GPU acceleration available
  • Fast training on large datasets
  • Good balance of speed and accuracy
  • Achieves ~87% ROC-AUC

3. Neural Networks

Simple MLP:

  • Lightweight baseline
  • Fast training
  • Good for feature-based data

Heavy NN:

  • 5-layer deep network
  • GPU-optimized
  • Mixed precision training

πŸ“ˆ Performance Benchmarks

Latest Results (from reports/)

Model ROC-AUC Accuracy Device Training Time GPU Util
Random Forest 0.881 81.6% CPU 14.2s N/A
XGBoost (GPU) 0.871 79.9% GPU 3.4s 84%
GP+CNN 0.734 62.9% GPU 25.8s 100%
Heavy NN 0.683 65.0% GPU 8.9s 7%
Simple MLP 0.667 61.8% GPU 2.1s 0%

Key Findings:

  • Random Forest (CPU) achieves best performance on TSFresh features
  • XGBoost shows excellent GPU utilization (84%) with 4x speedup
  • GP+CNN designed for raw light curves; underperforms on extracted features
  • Tree-based models excel on tabular data

GPU Optimizations Applied

GPU Models:

  • βœ… cuDNN benchmark mode
  • βœ… TF32 for Tensor Cores
  • βœ… Mixed Precision (AMP)
  • βœ… Pinned memory transfers
  • βœ… Non-blocking data loading
  • βœ… Batch size tuning (divisible by 8)

CPU Models:

  • βœ… Physical core allocation
  • βœ… MKL/OpenMP threading
  • βœ… Memory-aligned arrays
  • βœ… Intel Extension (if available)

πŸ”§ Development Workflow

Using Claude Code

This project includes automation for development with Claude:

  1. Setup: Read CLAUDE.md for guidelines
  2. Specs: Review detailed specifications in SPECS/
  3. Prompts: Execute workflows from prompts/claude-commands.md
  4. Benchmarks: Run scripts in scripts/benchmarks/ for performance testing

Adding New Models

  1. Implement in app/models/
  2. Add trainer in app/trainers/
  3. Create benchmark in scripts/benchmarks/
  4. Document performance in reports/

πŸ“Š Results & Reports

All benchmark results and reports are stored in reports/:

  • Figures: reports/figures/*.{png,pdf} - Visualizations
  • Results: reports/results/*.json - Numerical results
  • Reports: reports/*.md - Analysis and findings

πŸŽ“ Technical Background

Transit Method

Detect periodic dips in stellar brightness when an orbiting planet passes in front of the star.

Kepler Mission

NASA space telescope that monitored 150,000+ stars (2009-2018).

KOI Classification

Distinguish true planetary transits from false positives (eclipsing binaries, stellar variability).

πŸ“ Citation

If you use this code, please cite:

πŸ“„ License

This project analyzes public NASA Kepler mission data.

🀝 Contributing

  1. Review specifications in SPECS/
  2. Follow coding patterns in app/
  3. Add tests for new features
  4. Update documentation and benchmarks

Note: This project demonstrates a complete ML pipeline for exoplanet detection, from GP denoising to deep learning classification. The GP+CNN pipeline represents the modern approach for raw light curve analysis, while feature-based models (RF, XGBoost) provide strong baseline performance on extracted features.

About

NASA Kepler Exoplanet Detection using ML: GP denoising, TLS search, CNN classification. Benchmarks: Random Forest, XGBoost (GPU), GP+CNN pipeline. Complete end-to-end pipeline with comprehensive performance analysis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages