Tutorials

This page includes practical information for volunteers who decided to attend the tutorial sessions. 

Machine learning and artificial intelligence in experiment and theory

Environment

The tutorial session will be conducted by Antonin Vacheret (LPC Caen) with the help of Kaciel Beraud (PhD LPC Caen). 

It is recommended to prepare virtual environment:

$ python3 -m venv ML

You can activate it by:

For Linux:
$ source ML/bin/activate

For Windows:
C:\> ML/Scripts/activate.bat

Create a text file named 'requirements.txt':

$ echo "jupyter
ipywidgets
ipykernel
numpy
pandas
tables
seaborn
matplotlib
torch
torchaudio
torchvision
lightning
tensorboard" > requirements.txt

Then you can install all the packages:

$ pip install -r requirements.txt

You can then install the virtual environment to Jupyter Notebook:

$ python3 -m ipykernel install --user --name=ML

If you can't install it in the standard path, you can use the following command instead:

$ python3 -m ipykernel install --sys-prefix --name=ML

And you have to tell jupyter where he can find the environment, you have to use the path given in the output of the previous command:

For Linux:
$ export JUPYTER_PATH=/path/to/kernel/share/jupyter/

For Windows:
C:\> $env:JUPYTER_PATH = "C:\path\to\kernel\share\jupyter\"

Then it's done! Just start jupyter notebook and select the ML one.

If you want to remove the virtual environment from jupyter then run:

$ jupyter kernelspec uninstall dataml

You can also list all the available environment installed by:

$ jupyter kernelspec list

Dataset 

The dataset for the Machine Learning tutorial is available here:

https://filesender.renater.fr/?s=download&token=54629bee-ff73-4a86-b8cd-6ed6d7837242

Bayesian methods to predict physics phenomena from observations and theories

The tutorial session will be conducted by Prof. Christian Forssen

This tutorial is designed for participants with little or no prior experience in Bayesian methods. The tutorial is hands-on: participants will work through practical examples directly in Jupyter notebooks during the session.

Participants are required to bring a laptop with the necessary software installed. Prior to attending the tutorial, participants must:

  1. Clone the Git repository for the book,
  2. Set up the specified Python environment, and
  3. Verify that at least one of the provided Jupyter notebooks runs successfully.

 

A step-by-step guide is provided in Appendix C of Learning from data for physicists. 

It is also encouraged that the participants study Part I of the book.

If you encounter difficulties with installation, please contact us.  

 

At the tutorial, you are encouraged to work in pairs on your preferred choice of exercise. The following is a list of recommendations. The hands-on exercises are the default suggestion. The analytical ones are interesting but mainly intended for those that want to see Bayes in action but do not want to spend time on python implementation, while the mini projects are significantly more advanced and less guided.

 

Recommended hands-on exercises:
(do a git pull before starting on these, or download the ipynb file for each exercise from the online book)

  1. Applying Bayesian inference for a simple model: Exercise 9.6. Fitting a straight line I
  2. Transforming variables and applying Bayesian inference for a classic model problem: Exercise 9.4. Radioactive lighthouse problem
  3. Employing MCMC for Bayesian inference: Exercise 9.9. 2D radioactive lighthouse location using MCMC

 

Purely analytical use of Bayesian rules of probability:
(no ipynb files needed for these)

  1.  Illustrative example of the base rate fallacy in science: Exercise 9.2. Standard medical example using Bayes
  2. Interactive widget for Bayesian updating on the coin tossing example: 6.3. Demo: Widgetized coin tossing

 

Less guided, and more advanced, mini projects:
(these are available in a separate github repository, which you will need to clone:https://github.com/cforssen/BayesianMethodsNP_at_PhyNuBe4.git)

  1. Bayesian Linear Regression: Parameter estimation for a toy model of an effective field theory
  2. Fast and rigorous: Effective field theory modeling of three-nucleon forces

 

Please do not hesitate to ask questions and initiate discussions!

Looking forward to the tutorial!

 

Quantum computing

The tutorial session will be conducted by Denis Lacroix with the precious help of Ashutosh Singh (Postdoc IJCLab) and Rémi Bocquet (PhD CEA DAM). 

This tutorial is designed for participants who are not quantum computing experts. Examples will be made using the package qiskit (provided by the IBM company). 
The participants will have their own laptops with some packages already installed 
on their laptop prior to coming to the tutorial.

Installing a dedicated environment using conda  (optional but highly recommended)

Information to install conda can be found here 

Ideally, the installation can be made using conda and jupyter notebook that allows to create a dedicated environment. If you are using conda, you can create the environment here called "Tuto-QC" using the following commands 

 conda create -n Tuto-QC python=3.11  
 source activate Tuto-QC

or 

conda activate  Tuto-QC

Installing jupyter/matplotlib  (necessary)
 pip install jupyter 
 pip install notebook
 pip install jupyterlab
 pip install matplotlib

Once install, jupyter notebook or jupyter lab can be launched simply by typing jupyter notebook or  jupyter lab

 

Installing qiskit (necessary)

To install qiskit, if the environment "Tuto-QC" is activated (see above), type:

 pip install qiskit
 pip install qiskit-aer matplotlib numpy
 pip install pylatexenc

 
Then test that the command

from qiskit import QuantumCircuit

runs successfully in python command line or in a jupyter notebook. 

 

 

The requirements for package versions are:

Requirements :
Recommended Python version: 3.10+
qiskit==2.4.0
qiskit-aer>=0.17
jupyterlab>=4.0
notebook>=7.0
ipykernel>=6.0
matplotlib>=3.8
numpy>=1.26
scipy>=1.13
Versions can be for instance tested using (as command line)
python --version
jupyter --version
...

If you encounter difficulties with installation, please contact us.  

Looking forward to the tutorial !