# Classification of Space Objects — solution

*English translation by SOTA – AI Community of the Russian original. Organisers who would like this translation removed can email sota.ai.community@gmail.com.*

## Solution

This task demonstrates the use of artificial intelligence methods in a real scientific field, astronomy, where the volume of data makes automatic classification indispensable. Participants have to go through the standard pipeline of a data scientist. Below is a description of the key stages of a solution, based on a successful strategy.

Key stages of the solution:

1. **Exploratory data analysis (EDA)**: analysing the distribution of the target variable (class imbalance), checking for missing values, analysing correlations between features.
2. **Data preprocessing**: filling in missing values (e.g. with the median or with algorithms), encoding categorical features (e.g. quality_flag), scaling numerical features; at this stage it is useful to create new features, such as colour indices (u_g, g_r, r_i, i_z), which can improve the quality of the model.
3. **Handling the imbalance**: the class exoplanet_candidate is rare; to improve its prediction, imbalance-handling techniques can be applied: class weighting, SMOTE or other oversampling/undersampling methods.
4. **Choosing and training a model**: suitable baseline algorithms are those that can work with categorical features and scale well to a large number of features, such as RandomForestClassifier or GradientBoostingClassifier (e.g. CatBoost or LightGBM); for more sophisticated solutions, model ensembles or neural networks can be used.
5. **Cross-validation and fine-tuning**: it is important to evaluate the model with cross-validation in order to avoid overfitting. To improve the result, hyperparameters (number of iterations, tree depth, learning rate) can be tuned with GridSearchCV or Optuna.
6. **Analysis of the model and its errors**: plotting feature importances (top features: parallax, u_g, g_r) and analysing the model's errors help to interpret how it works and to find directions for improvement.
7. **Producing the prediction**: after training the final model on all the data, make a prediction for the test set and format the result in strict accordance with the required submission.csv format.

Features of a successful solution:

- High-quality data preparation, with new features created.
- Use of algorithms that work efficiently with categorical features "out of the box".
- A systematic approach to improving the model through experiments and validation.
- Error analysis and interpretation of how the model works.

The solution demonstrates the full cycle of work on an ML task, from data preparation to the final prediction. The baseline code example (baseline) is provided in the file baseline.ipynb and serves as a starting point for participants.

## Answer

The correct solution is a file submission.csv generated by the participant which, when checked on the hidden test set, achieves the highest value of the macro F1-score metric. The baseline model (CatBoost) achieves macro F1 ≈ 0.75; advanced solutions achieve 0.95 and above.

An example of the author's solution (macro F1 = 0.95) is provided as a Jupyter Notebook and is available at: https://disk.360.yandex.ru/d/kqheJ2YYgyPZVw.
