# Clustering

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

All-Russian School Olympiad in Informatics 2025–2026, Regional Stage, Grades 9–11<br>
“Artificial Intelligence” profile, Tour 2, 19 January 2026<br>
Task B

**Points for the task:** 100<br>
**Answer submission format:** uploading an answer file in .csv format<br>
**Number of attempts:** 20<br>
**Submission that counts:** the last one

## Statement

On his way to the regional stage of the All-Russian School Olympiad in AI, Misha found a USB flash drive on a key ring with the words “methodological commission” written on it. The flash drive turned out to contain a table file named `data.csv`. Since Misha found no target variable in the csv file, he rightly concluded that this must be a clustering task. However, Misha could not find any information about the number of clusters anywhere. Help Misha work out the number of clusters and cluster the data correctly.

## Input format

The following files are attached to the task:

- `data.csv` - contains the object–feature matrix (each row of the table is an object, each column is a feature). The column `id` is the object identifier. The other columns are features.
- `baseline.ipynb` - a notebook with a baseline solution to the task.
- `submission.csv` - an example of the solution that you need to submit to the testing system.

## Output format

You need to submit, as your submission, the file `submission.csv` containing two columns:

- `id` - the identifier of the object from `data.csv`.
- `cluster` - the cluster you predicted for the object (a positive integer).

## Scoring

You can get up to 100 points for this task.

The data are split into a public and a private part. When you submit submission.csv, you are shown the result on the public part. After the contest ends, your result will be recalculated on the private part.

After the end of the stage, your metric will be converted to a 100-point scale according to the following rule:

- the result of the **baseline solution** (ARI=0.0) is worth **0 points**;
- the result of the **author's solution** (ARI=0.9814) is worth **100 points**;
- results between these two points are distributed linearly.

## Answer evaluation metric

This task uses the metric **ARI (Adjusted Rand Index)**. The more pairs of objects Misha assigns to clusters correctly (for example, if the two objects are in different clusters and Misha also puts them in different clusters, OR the two objects are in the same cluster and Misha also puts them in the same cluster), the higher this metric. $ARI$ takes the value 0 for a random partition into clusters and the value 1 for a perfectly correct partition, and it can take negative values for a poor partition that is worse than random.

Example of computing the **ARI** metric in *Python*:

```python
from sklearn.metrics import adjusted_rand_score

labels_true = [0, 0, 1, 1, 2, 2]
labels_pred = [1, 1, 0, 0, 2, 2]

ari = adjusted_rand_score(labels_true, labels_pred)
print("ARI =", ari)
```
