Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🌌 Northern Lights Prediction using Machine Learning

Predicting whether a Coronal Mass Ejection (CME) is potentially geoeffective using Machine Learning.


📽 Presentation

Project presentation:

Canva Presentation

📖 Project Overview

Two years ago, I travelled to Sweden hoping to see the Northern Lights—but I never did. That experience inspired this project.

Although auroras cannot be predicted months in advance, they are closely linked to solar activity. Certain Coronal Mass Ejections (CMEs) can interact with Earth's magnetic field and trigger geomagnetic storms, creating the conditions necessary for the Northern Lights.

The goal of this project is to build a Machine Learning model capable of predicting whether a CME is potentially geoeffective, helping identify the solar events most likely to produce auroral activity.

CME model_performance_presentation model_performance_before_after_smote confusion matrix

🎯 Objective

Develop a supervised Machine Learning classification model to predict whether a Coronal Mass Ejection (CME) is potentially geoeffective based on its physical characteristics.


📂 Dataset

Source:

  • NASA Space Weather Data (via Kaggle)

The dataset contains approximately two years of CME observations (2023–2025), including characteristics such as:

  • Speed
  • Width
  • Half angle
  • Source location
  • Latitude & Longitude
  • Measurement instruments
  • Observation dates
  • Additional categorical descriptors

Target variable:

  • potentially_geoeffective
    • True
    • False

🛠 Data Preprocessing

The following preprocessing steps were performed:

  • Data cleaning
  • Missing value verification
  • Removal of non-predictive features
  • Feature engineering
  • One-Hot Encoding for categorical variables
  • Train/Test split
  • Comparison of preprocessing techniques:
    • MinMaxScaler
    • StandardScaler
    • Normalizer

🤖 Machine Learning Models

Several classification algorithms were evaluated:

  • K-Nearest Neighbors (KNN)
  • Decision Tree
  • Bagging
  • Random Patches
  • Random Forest
  • AdaBoost
  • Gradient Boosting

Each model was evaluated using:

  • Accuracy
  • Precision
  • Recall
  • F1-score
  • Confusion Matrix

⚖️ Handling Class Imbalance

The dataset contained an imbalanced target distribution.

Three balancing strategies were compared:

  • SMOTE
  • Random Oversampling
  • Random Undersampling

🔧 Hyperparameter Tuning

The final model was optimized using:

  • GridSearchCV
  • Stratified K-Fold Cross Validation

📊 Feature Importance

Feature importance analysis showed that speed was by far the most influential predictor.

This suggests that, within this dataset, the velocity of a Coronal Mass Ejection contains most of the information required to identify potentially geoeffective events.


🏆 Results

The Gradient Boosting classifier consistently achieved the best overall performance.

Key findings include:

  • Excellent predictive performance across all evaluation metrics.
  • Gradient Boosting remained the strongest model after hyperparameter tuning.
  • Balancing techniques produced little additional improvement because the selected model already performed exceptionally well.
  • CME speed was identified as the dominant predictive feature.

💻 Technologies Used/Required

  • Python
  • Pandas
  • NumPy
  • Matplotlib
  • Scikit-learn
  • Jupyter Notebook

🚀 Future Work

Possible improvements include:

  • Testing the model on newly observed CME events.
  • Incorporating additional space weather variables.
  • Comparing performance with advanced models such as XGBoost and LightGBM.
  • Integrating the model into space weather forecasting systems.

Author

Sandra Fernández Pascual


Acknowledgements

This project was developed as part of the Ironhack Data Analytics Bootcamp and uses publicly available NASA space weather data distributed through Kaggle.

About

Predicting whether a Coronal Mass Ejection (CME) is potentially geoeffective using Machine Learning.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages