All modulesS1 · Setup and what AI is▾
The first session has two halves. First we make it clear what artificial intelligence actually means, so you know what we're talking about all year. Then we do the logistics: a place to write code and a place to send answers. The setup part sounds boring, but most of the silly points lost at the first stage come from here: an environment that won't start, a badly formatted submission file, a missing library. Do it once, properly, and you're done with it.
What AI is and where it's used
Artificial intelligence is the idea of building a program that solves problems without you writing, step by step, the rule for every case. Instead of telling it "if this, do that", you show it many examples and let it find the rule on its own. That part, learning from examples, is called machine learning, and it's almost everything you do at the olympiad.
One example makes it clear. To tell a spam email from a normal one with hand-written rules, you'd write hundreds of "if it contains word X". With machine learning, you give it a few thousand emails already marked spam or not, and the model learns on its own which combinations of words predict spam. You don't give it the rule, you pull the rule out of the data.
- Classification: you put a label on something (spam or not, which digit is in an image, what a scan shows).
- Regression: you predict a number (the price of a house, tomorrow's temperature).
- Grouping: you find structure in data with no labels (which customers are similar).
What Python is and why it's the one
Python is the standard language for writing AI code. Not because it's the fastest, but because the libraries you want are already written: NumPy for numeric work, Pandas for tables, scikit-learn for classic models, PyTorch for neural networks. At the olympiad everything is written in Python, so that's where you start.
A library is code someone else wrote, that you import and use. Instead of writing the sorting algorithm or matrix multiplication yourself, you call the right function. Most of your work will be wiring these libraries together correctly.
Get your environment ready
A virtual environment is a separate box for one project's libraries, so they don't clash with others. You create it once and always work inside it. The steps below give you a clean environment with everything you need to start.
- 01Open a terminal in your working folder.
- 02Create the environment: python3.11 -m venv .venv
- 03Activate it: source .venv/bin/activate (on Windows: .venv\Scripts\activate).
- 04Install the tools: pip install numpy pandas matplotlib scikit-learn jupyterlab
- 05Start Jupyter: jupyter lab
Check right away that everything imports without errors. If something breaks, fix it now, at home, with internet, not in the contest room where you have neither the net nor the time.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
print("numpy", np.__version__)
print("pandas", pd.__version__)
print("all good")Offline documentation
At the contest, most stages are offline: no internet, no Stack Overflow, no asking a model. The only thing you can look at is the local documentation, meaning the libraries' help files saved on your machine.
Get into the habit early of searching the offline docs. In Jupyter, you put a question mark after a function and it shows you what it does and what arguments it takes. That's the reflex that saves you precious minutes.
pd.read_csv? # open the help for read_csv
np.mean? # what it does, what arguments it takesYour first submission, the full loop
MLCompete (platform.olimpiada-ai.ro) is the platform you train on all year. Nitro AI Judge (judge.nitro-ai.org) is another one, for hackathon-style NLP problems. Make accounts on both now.
A competition works like this: you download a dataset, train a model, produce a file with your predictions for the test data, upload it, and get a score on a leaderboard. The point of your first submission isn't the score. It's to see the whole loop at least once.
- 01Enter a training competition and read which metric is scored.
- 02Download the data and open the sample submission file, so you see exactly which columns and format it wants.
- 03Produce a file in the same format, even with random answers.
- 04Upload it and look at the score.
- AI at the olympiad means machine learning: the model learns the rule from examples, you don't write it.
- Python plus a few libraries do everything: NumPy, Pandas, scikit-learn, PyTorch.
- The environment and the offline docs are prepared at home, not on contest day.
- The contest loop: data in, a predictions file out, a score on the board.
- The submission format is a scoring condition, not a detail.