# APOAI 2026 Cosmic Probe: Star–Galaxy–Quasar Classification from SDSS Photometry

Note: This task will be evaluated in an environment based on the `ioai3.6` image. Participants should select `ioai3.6` as the training image.

## 1. Background

Modern wide-field sky surveys generate enormous amounts of imaging and photometric data every night. The fifth-generation Sloan Digital Sky Survey (SDSS-V) has released over $4.6\times10^6$ spectroscopically confirmed celestial objects, providing an irreplaceable data resource for studying the large-scale structure of the Universe, galaxy evolution, and the activity of supermassive black holes.

However, spectroscopic follow-up is both expensive and time-consuming, meaning that only a tiny fraction of the billions of detected sources can receive a definitive classification label. Machine learning provides a practical way to address this gap: by training classification models on objects with reliable spectroscopic labels, astronomers can efficiently sift through survey images to identify high-value targets—especially rare quasars—thus dramatically increasing the scientific return of expensive telescope time.

This challenge is inspired by recent ArXiv research on automated classification of SDSS sources using machine learning (see references below). You will act as a **“digital astronomer”** and build a model that uses photometric magnitudes in five optical bands to classify each object into one of three categories: **STAR**, **GALAXY**, or **QSO** (quasar).

Quasars are distant active galactic nuclei powered by rapidly accreting supermassive black holes; they are key probes of the early Universe. Yet they constitute only about $18.8\%$ of the dataset and are easily confused with stars or compact galaxies. **The sole evaluation metric is the $F_2$ score**, which emphasizes recall—**missing quasars is considered more costly than producing a limited number of false positives**.

## 2. Task Description

- Contestants are required to:

  - Understand and preprocess the SDSS photometric catalog data;
  - Design and train a classification model;
  - Use the five-band model magnitudes ($u, g, r, i, z$) as input features;
  - Predict one class for each object: `GALAXY`, `STAR`, or `QSO`.
- **Final ranking is based solely on the $F_2$ score achieved on the B test set**.

## 3. Dataset

The data are derived from **SDSS Data Release 17** public catalogs, using the `PhotoPrimary` view joined with the `SpecObj` spectral table to select objects with spectroscopic classes `GALAXY`, `STAR`, or `QSO`. The total number of records is $60000$, randomly partitioned into the following CSV files.

#### 3.1 File Descriptions

| Filename       | Number of Samples | Description                                                  |
| :------------- | :---------------- | :----------------------------------------------------------- |
| `train.csv`    | $30000$           | Training set, containing both features and labels            |
| `valdata.csv`  | $15000$           | Public A set as validation set, containing only features (no labels) |
| `testdata.csv` | $15000$           | Private B set as test set, containing only features (no labels) |
| `val.csv`      | $15000$           | Ground truth labels for the validation set, used for calculating score in Leaderboard A |
| `test.csv`     | $15000$           | Ground truth for test set, used for calculating score in Leaderboard B |

The contestants can only download `train.csv` from /bohr/train-ac7m/v2/.

#### 3.2 CSV Format

All CSV files are comma-separated, UTF-8 encoded, and include a header row.

**Columns in `train.csv`:**

| Column       | Data Type | Description                                     |
| :----------- | :-------- | :---------------------------------------------- |
| `objid`      | integer   | Unique SDSS object identifier (64-bit integer)  |
| `ra`         | float     | Right Ascension (degrees)                       |
| `dec`        | float     | Declination (degrees)                           |
| `modelMag_u` | float     | $u$-band model magnitude                        |
| `modelMag_g` | float     | $g$-band model magnitude                        |
| `modelMag_r` | float     | $r$-band model magnitude                        |
| `modelMag_i` | float     | $i$-band model magnitude                        |
| `modelMag_z` | float     | $z$-band model magnitude                        |
| `type`       | string    | Spectroscopic class: `GALAXY`, `STAR`, or `QSO` |

**Columns in `valdata.csv` and `testdata.csv`:**

| Column       | Data Type | Description                   |
| :----------- | :-------- | :---------------------------- |
| `objid`      | integer   | Unique SDSS object identifier |
| `ra`         | float     | Right Ascension (degrees)     |
| `dec`        | float     | Declination (degrees)         |
| `modelMag_u` | float     | $u$-band model magnitude      |
| `modelMag_g` | float     | $g$-band model magnitude      |
| `modelMag_r` | float     | $r$-band model magnitude      |
| `modelMag_i` | float     | $i$-band model magnitude      |
| `modelMag_z` | float     | $z$-band model magnitude      |

> **Note**: The test files **do not contain** the `type` column. Participants must predict the class for each object.

#### 3.3 Class Labels

| Label    | Meaning | Scientific Description                                                            |
| :------- | :------ | :-------------------------------------------------------------------------------- |
| `GALAXY` | Galaxy  | A gravitationally bound system of billions of stars                               |
| `STAR`   | Star    | A luminous plasma sphere within the Milky Way, powered by nuclear fusion          |
| `QSO`    | Quasar  | A distant active galactic nucleus with a supermassive black hole accreting matter |

Both training and test splits preserve the original class proportions, making this a typical **imbalanced multi-class classification** problem.

## 4. Score

The sole evaluation metric is the **$F_2$ score (F2 Score)** , which is a weighted harmonic mean of precision and recall where recall has a higher influence than precision; specifically, the recall term is weighted by $\beta^2 = 4$ when $\beta = 2$.:

$$
F_2 = (1+2^2) \cdot \frac{\text{Precision} \cdot \text{Recall}}{(2^2 \cdot \text{Precision}) + \text{Recall}}
= 5 \cdot \frac{\text{Precision} \cdot \text{Recall}}{4 \cdot \text{Precision} + \text{Recall}}
$$

The $F_2$ score emphasizes recall, meaning the model should the model should prioritize detecting true instances, especially rare `QSO` objects, even at the cost of some additional false positives. In real astronomical surveys, missing a high-redshift quasar could mean losing a rare window into the early Universe.

**Computation**: A confusion matrix is constructed for all test samples. Precision and recall are computed for each class (`GALAXY`, `STAR`, `QSO`), and the per-class $F_2$ scores are aggregated using a **weighted average**, where the weights are the number of true instances of each class in the test set.

## 5. Submission

Participants must generate prediction files for `valdata.csv` and `testdata.csv`, named `submission_val.csv` and `submission_test.csv` respectively.

Each prediction file must contain exactly two columns:

| Column  | Data Type | Description                                              |
| :------ | :-------- | :------------------------------------------------------- |
| `objid` | integer   | Must match the `objid` in the original test file exactly |
| `type`  | string    | Predicted class, one of `GALAXY`, `STAR`, or `QSO`       |

Example submission snippet:

```csv
objid,type
1237645879551000764,GALAXY
1237645879551066262,STAR
1237645879562862699,QSO
```

> **Note**: The rows in the prediction file must follow the same order as the corresponding test file. The number of rows must equal the number of test samples; otherwise the submission will be invalid.

You can check the [baseline.ipynb](https://www.bohrium.com/notebooks/22552357682) for a simple baseline model that uses a random forest classifier and learn the submission format required.

## 6. Restrictions

- Pretrained model weights are not allowed, including weights pretrained on ImageNet or any other external dataset;
- External large language model APIs, such as GPT or Claude, may not be used for prediction, feature generation, data labeling, or model ensembling;
- Notebook execution time: single training run $\le$ 20 minutes with CPU.

## 7. References

The dataset originates from SDSS-V Data Release 17. The following ArXiv papers provide background on the data and classification tasks:

- **Paper**: Abdurro'uf, et al. (2022). _The Seventeenth Data Release of the Sloan Digital Sky Surveys: Complete Release of MaNGA, MaStar, and APOGEE-2 Data_. _The Astrophysical Journal Supplement Series_, 259(2), 35.
  (The PDF of this paper is included in the competition zip archive.)
  
- **Classification reference**: Clarke, A. O., et al. (2020). _Identifying galaxies, quasars, and stars with machine learning: A new catalogue of classifications for 111 million SDSS sources without spectra_. _Astronomy & Astrophysics_, 639, A84.

Contestants may consult these papers to understand the scientific context. Contestants may read these papers for background, but they may not directly use pretrained models, released weights, or external code repositories associated with these works. The PDFs of these two papers are included in the train dataset at /bohr/train-ac7m/v2/.

## 8. Baseline and Reference Scores

The baseline score on Leaderboard B is: 0.6660

The reference score achieved by the scientific committee on Leaderboard B is: 0.8181

## 9. Acknowledgement

We thank Chen Yuxun from  Xiamen Shuangshi Middle School of Fujian for providing this topic.

The data are derived from SDSS Data Release 17 public catalogs (Abdurro'uf et al., 2022).
