Hands-on session — γ/hadron discrimination with ML
✏️ Preparing for the Random Forest + CNN hands-on
You have two ways to follow this hands-on. Pick the one you prefer:
- Google Colab — runs in the browser. Nothing to install. Recommended if your computer is slow or short on disk space.
- Local conda environment — runs on your machine. More flexible. Works on Linux, Mac, and Windows in exactly the same way.
No GPU is needed. The whole notebook runs on a normal CPU laptop in under five minutes. If you happen to have a CUDA-enabled GPU and a CUDA-built PyTorch, it will be used automatically — but it makes no practical difference.
The materials live in this GitHub repository:
github.com/antopag/lucchin-handson
Google Colab
The fastest way to start. One click. Open this URL in your browser:
colab.research.google.com/github/antopag/lucchin-handson/blob/main/notebook.ipynb
The notebook opens directly in Colab, ready to run.
Once it's open, the first cell clones the repository inside the Colab runtime, so you have access to the data files and helper scripts:
!git clone https://github.com/antopag/lucchin-handson.git
%cd lucchin-handson
Run it, then keep going cell by cell.
All the packages you need (NumPy, pandas, matplotlib, scikit-learn, PyTorch, astropy) are already pre-installed on Colab, so you have nothing else to install.
Note. Colab sessions are temporary. If you want to keep your results, download them or save them to your Google Drive before closing the tab.
Local installation with conda
If you prefer to run everything on your own machine, the cleanest way is to create a dedicated conda environment. The procedure below is identical on Linux, macOS, and Windows.
If you don't have conda yet, install Miniconda following the official instructions for your operating system.
Open a terminal and run:
conda create --name lucchin_ml python=3.13
conda activate lucchin_ml
pip install numpy pandas matplotlib scikit-learn torch astropy jupyterlab
That's it. All packages have pre-compiled binary wheels for Python 3.13 — no compiler required, no system dependencies, nothing to configure.
Then clone the repository and launch the notebook:
git clone https://github.com/antopag/lucchin-handson.git
cd lucchin-handson
jupyter lab notebook.ipynb
Remember to activate the environment (conda activate lucchin_ml) every time you reopen your terminal.
Quick reference for the day
When you arrive in the classroom, the three commands you need are:
conda activate lucchin_ml
cd lucchin-handson
jupyter lab notebook.ipynb