AstroClassify is an interactive machine learning application that predicts whether a celestial object is a Galaxy, Star, or Quasar (QSO) using photometric observations from the Sloan Digital Sky Survey (SDSS).
The project demonstrates an end-to-end machine learning workflow including data preprocessing, exploratory data analysis, model training, evaluation, and deployment using Streamlit.
The data consists of 100,000 observations of space taken by the SDSS (Sloan Digital Sky Survey). Every observation is described by 17 feature columns and 1 class column which identifies it to be either a star, galaxy or quasar.
- obj_ID = Object Identifier, the unique value that identifies the object in the image catalog used by the CAS
- alpha = Right Ascension angle (at J2000 epoch)
- delta = Declination angle (at J2000 epoch)
- u = Ultraviolet filter in the photometric system
- g = Green filter in the photometric system
- r = Red filter in the photometric system
- i = Near Infrared filter in the photometric system
- z = Infrared filter in the photometric system
- run_ID = Run Number used to identify the specific scan
- rereun_ID = Rerun Number to specify how the image was processed
- cam_col = Camera column to identify the scanline within the run
- field_ID = Field number to identify each field
- spec_obj_ID = Unique ID used for optical spectroscopic objects (this means that 2 different observations with the same spec_obj_ID must share the output class)
- class = object class (galaxy, star or quasar object)
- redshift = redshift value based on the increase in wavelength
- plate = plate ID, identifies each plate in SDSS
- MJD = Modified Julian Date, used to indicate when a given piece of SDSS data was taken
- fiber_ID = fiber ID that identifies the fiber that pointed the light at the focal plane in each observation
fedesoriano. (January 2022). Stellar Classification Dataset - SDSS17. Access the dataset here.
precision recall f1-score support
GALAXY 0.98 0.92 0.95 11889
QSO 0.87 0.93 0.90 3792
STAR 0.90 1.00 0.95 4319
accuracy 0.94 20000
macro avg 0.92 0.95 0.93 20000
weighted avg 0.94 0.94 0.94 20000
precision recall f1-score support
GALAXY 0.97 0.97 0.97 11889
QSO 0.92 0.91 0.92 3792
STAR 1.00 1.00 1.00 4319
accuracy 0.97 20000
macro avg 0.96 0.96 0.96 20000
weighted avg 0.97 0.97 0.97 20000
precision recall f1-score support
GALAXY 0.98 0.99 0.98 11889
QSO 0.97 0.93 0.95 3792
STAR 1.00 1.00 1.00 4319
accuracy 0.98 20000
macro avg 0.98 0.97 0.98 20000
weighted avg 0.98 0.98 0.98 20000
Among the evaluated classifiers, the Random Forest model achieved the highest overall performance with 98% accuracy, making it the model deployed in the Streamlit application.
The AstroClassify application provides an intuitive interface to interact with the trained Random Forest classifier:
- Real-Time Predictions: Adjust the SDSS photometric magnitudes (u, g, r, i, z) and redshift using the sidebar to instantly generate new object classifications.
- Random Sample Testing: Load randomly selected observations from the test dataset to evaluate the model on unseen real-world examples with a single click.
- Spectral Energy Distribution (SED) Visualization: Explore an object's spectral profile through an interactive graph illustrating how its observed magnitude varies across the five SDSS photometric bands.
- Color-Color Scatter Plot Analysis: Visualize your selected object on astronomical color-color diagrams and compare its position with known Stars, Galaxies, and Quasars (QSOs) from the SDSS dataset.
- Model Confidence Scores: View the predicted class alongside its confidence probabilities, providing additional insight into the model's decision-making process.
├── assets/
│ └── logo.png
├── data/
│ ├── sample.csv
│ └── star_classification.csv
├── models/
│ └── celestial_model.pkl
├── app.py
├── requirements.txt
├── README.md
├── LICENSE
└── sdss_object_classification.ipynb
# Clone the repository
git clone https://github.com/rhthm/sdss-object-classification.git
# Navigate into the project directory
cd sdss-object-classification
# Install the required dependencies
pip install -r requirements.txt
# Launch the Streamlit web application
streamlit run app.pyThis project is licensed under the MIT License. See the LICENSE file for details.
Built by rhthm.