# Predicting Students' Future: The Secret of the Lost Code

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

*Source: the Final Round of the Georgian National AI Olympiad, organised by the Georgian Artificial Intelligence Association (GAIA), 25 May 2025, hosted on the Bohrium platform: [original statement](https://www.bohrium.com/competitions/3072370612). The statement file on Bohrium is named `e_en.md`, but its text is in Georgian.*


## 🧠 Story:

Imagine that you are young data scientists at the Georgian Institute for Education Research (GIER). For years the institute has been working on important projects, and one of the most important of them is predicting students' academic paths. The aim of this project is to identify in good time the students who need help and to reduce the risk of their dropping out.

Years ago, three different, legendary research groups at the institute created unique but narrowly specialised models based on artificial intelligence. Each model answered a different, specific question:

* **The "Alpha" model:** particularly good at distinguishing whether a student will successfully graduate from university (**Graduate**) or drop out (**Dropout**).
* **The "Beta" model:** its strength is distinguishing whether a student will complete their studies (**Graduate**) or remain an active student (**Enrolled**) in the following period.
* **The "Gamma" model:** this model focuses on predicting whether a student will drop out (**Dropout**) or continue in active status (**Enrolled**).

These models were revolutionary in their time, but unfortunately the research groups broke up, the detailed documentation was lost and the original code cannot be fully restored. The institute now needs a single, holistic system that can accurately predict one of the three possible statuses (**Graduate**, **Dropout**, **Enrolled**) for any student.


## 🎯 Your mission:

You have been given working versions of these three "inherited" models and part of the training data. Your task is to develop a mechanism that relies on the predictions of the "Alpha", "Beta" and "Gamma" models and, on their basis, reaches a final, single decision about each student's future status. Focus on how the "wisdom" of these three specialised modules can be combined and used in a single system.


## ⚙️ Formal task:

Build a final classification system that takes a student's data and uses the outputs of the three pre-existing binary classifiers (Alpha: Graduate/Dropout, Beta: Graduate/Enrolled, Gamma: Dropout/Enrolled) to classify the student's final status into three categories: Graduate, Dropout, Enrolled.


## ⚠️ Important constraint:

Your final decision mechanism `must` use `the predictions of these three given models` as part of the decision-making process. It is `not allowed` to build a single, final classifier that uses `only the original data` and completely `ignores` the information provided by these three specialised modules (their predictions/probabilities). Your task is precisely the `smart integration` of the existing modules' predictions, `not their complete replacement` by a new, independent model that would be based `only` on the original data. Think about how the opinions of these three different "experts" can be taken into account to reach the final conclusion.


## 📁 Provided materials and data:

You are given the following files:

* `train_data.csv`: this file contains training data about students, with the following columns: `Tuition fees up to date`, `Age at enrollment`, `Mother's qualification`, `Curricular units 1st sem (enrolled)`, `Curricular units 1st sem (without evaluations)`, `Curricular units 2nd sem (grade)`. The target variable (`Target`) is also given; it denotes the student's actual final status: Graduate, Dropout or Enrolled. You can use these data to develop and test your integration strategy.
* `test_data.csv`: this file contains the data of the students (the same columns, except `Target`) for whom you must make the final prediction. Row indexing in the file starts at 0.
* `models.pickle`: this file contains a Python dictionary in which the three pre-trained, specialised logistic regression models ("Alpha", "Beta", "Gamma") mentioned in the story are stored. The dictionary's key is a pair of classes in the form of a tuple, which shows which two classes the corresponding model can distinguish, for example: `('Graduate', 'Dropout')`. The dictionary's value is the corresponding scikit-learn `LogisticRegression` model (e.g. `LogisticRegression(random_state=42)`). You must use these models to obtain predictions on their corresponding pairs of classes.


## 📦 Deliverables:

* This Jupyter Notebook, with the code of your complete solution, which describes the integration mechanism you developed and `automatically creates the predictions file after a full run of the notebook ("Run all")`.
* `predictions.json`: a JSON file containing your system's predictions for each student given in `test_data.csv`.
   * The file's key must be the index of the corresponding row in the `test_data.csv` file (as a string, e.g. `"0"`, `"1"`, `"2"`, ...).
   * The file's value must be the class your system predicts for this student: Graduate, Dropout or Enrolled (as a string).


   Example of the contents of a `predictions.json` file:
   ```json
   {
     "0": "Graduate",
     "1": "Dropout",
     "2": "Enrolled",
     "3": "Graduate",
     ...
   }
   ```


## 🏆 Evaluation:
Please note that in this task the maximum F1 score of our team's solution is 0.75. For each submission you will receive the F1 score of your answers. The final result for this task is calculated as follows: `Max`(0.75, the maximum score among the students' submissions) is taken as 100 points, and your individual score is calculated using an exponential formula.


Good luck with solving the secret of the lost code and predicting students' future!


## Starter code
Below are the instructions for loading the initial data and creating the final output. In the last part, please change only the part where you store the answers in the Dict; do not change the saving step, and above all do not change the file name, otherwise you will receive 0 points.


```python
import pandas as pd
import pickle

# Note that here you must insert the path that you will see in the Bohrium notebook
with open("models.pickle", 'rb') as f:
   models = pickle.load(f)

# Note that here you must insert the path that you will see in the Bohrium notebook
training_data = pd.read_csv("train_data.csv")
training_data



# Note that here you must insert the path that you will see in the Bohrium notebook
test_x = pd.read_csv("test_data.csv")
test_x


# Your code
# ...
# ...




import json

# You may also change the parameters of this function; the main thing is that at the end you #create submission.json following the approach written here
def create_predictions_json(test_data):
   """
   Creates submission.json file. Currently outputs 'Graduate' for all students.
   TODO: Replace hardcoded 'Graduate' with actual model predictions.
   Do not modify the JSON saving part at the end.
   """
   predictions = {}
   for idx in range(len(test_data)):
       # TODO: Add prediction logic here using Alpha, Beta, Gamma models
       final_prediction = "Graduate"  # Replace with actual prediction
      
       predictions[str(idx)] = final_prediction


   # DO NOT MODIFY
   with open('submission.json', 'w') as f:
       json.dump(predictions, f, indent=4)


   print(f"Predictions saved to submission.json with {len(predictions)} entries")


create_predictions_json(test_x)
```
