AryanAstroNomad/exoplanet-classifier
1
๐ Exoplanet Classification ML Model
This project uses machine learning to classify exoplanets by:
- ๐ช Planet Type (Terrestrial, Super-Earth, Neptune-like, Gas Giant)
- ๐ฐ๏ธ Detection Method (Transit, Radial Velocity)
The model is trained on real data from NASA's Exoplanet Archive using Random Forest classifiers.
๐ Dataset
Features Used:
pl_rade: Planet radiuspl_bmasse: Planet masspl_orbper: Orbital periodpl_orbsmax: Orbital semi-major axisst_rad: Stellar radiusst_mass: Stellar massst_teff: Stellar effective temperature
๐ฏ Targets
- Planet Type (generated by function based on
pl_rade): < 1.25: Terrestrial1.25โ2: Super-Earth2โ6: Neptune-like> 6: Gas Giant
- Detection Method:
- Only methods with โฅ10 samples retained
- Balanced using SMOTE to avoid overfitting on "Transit"
๐ง Models
Both models use RandomForestClassifier from scikit-learn.
- Planet Type Classifier
- Detection Method Classifier
SMOTE is applied to the detection method classification to fix class imbalance.
๐พ Files Created
planet_type_model.pkldetection_method_model.pkl
These are saved using joblib and downloadable in Colab.
๐งช Sample Input
sample_input = {
'pl_rade': 3.8,
'pl_bmasse': 20.0,
'pl_orbper': 3.5,
'pl_orbsmax': 0.04,
'st_rad': 0.95,
'st_mass': 0.88,
'st_teff': 5200
}๐ How to Use
1. Install Dependencies
pip install pandas numpy scikit-learn imbalanced-learn joblib2. Load Models
import joblib
import pandas as pd
clf_type = joblib.load('planet_type_model.pkl')
clf_method = joblib.load('detection_method_model.pkl')3. Prepare Input & Predict
input_df = pd.DataFrame([sample_input])
planet_type = clf_type.predict(input_df)[0]
detection_method = clf_method.predict(input_df)[0]
print("Planet Type:", planet_type)
print("Detection Method:", detection_method)4. Optional: Get Probabilities
clf_method.predict_proba(input_df)โ Expected Prediction Errors
Even with high accuracy, the model may produce the following prediction errors due to data limitations or feature overlap:
๐ช Planet Type Prediction Errors
๐ฐ๏ธ Detection Method Prediction Errors
๐ Tips to Reduce Errors
- Include more distinctive features like planet inclination, eccentricity, or detection signal strength (if available).
- Use a multi-model ensemble (e.g., add logistic regression or XGBoost).
- Fine-tune SMOTE or try class-weighted models instead.
๐จโ๐ป Author
- Made by Aryan Hotwani
- Powered by NASA exoplanet data and scikit-learn
