GithubHelp home page GithubHelp logo

n3pdf / mcnntunes Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 25.38 MB

Tuning Monte Carlo generators with machine learning.

Home Page: https://mcnntunes.readthedocs.io/

License: GNU General Public License v3.0

Python 56.65% HTML 43.35%
monte-carlo-simulation machine-learning event-generator tuning-parameters

mcnntunes's Introduction

mcnntunes's People

Contributors

michaeldessena avatar mlazzarin avatar scarrazza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mcnntunes's Issues

AZ-like tune of Pythia 8

Following step 2 of issue #8 I recreated the MC runs for the AZ tune.

I used the following variation ranges for the tunable parameters:

PARAMETER MIN MAX
intrinsicKT 1 2.5
asMZisr 0.12 0.14
pT0isr 0.1 2.5

In the original paper they used 0.5 as lower bound for pt0isr, but when I did so during my thesis both Professor (third order) and Mcnntune suggested a lower value (but not Professor at fourth order).
I generated 256 runs, with half the errors of the previous datasets, and the resulting final tunes for Professor are:

Professor Our results (order 3) AZ (1406.3660) (order 4)
intrinsicKT 1.84 +- 0.04 1.71 +- 0.03
asMZisr 0.1236 +- 0.0002 0.1237 +- 0.0002
pt0isr left bound (0.1) 0.59 +- 0.08

The observables and the bin weights are the same in both cases. Unfortunately, the prediction for pt0isr is getting lower and lower, and I don't now if this makes sense. Lineplot shows this behaviour:
params_chi2_plots
With the previous dataset with pt0isr min value of 0.5, there was a minimum in 0.54 (but only with fourth order interpolation). It was compatible with the AZ tune, but now it seems just a local minimum.

Then I performed the same tune with Mcnntune (without hyper optimization, but using the best configuration found in my thesis):

Professor Direct model Inverse model Inverse model (DA)
intrinsicKT 1.76 1.79 +- 0.08 1.81 +- 0.06
asMZisr 0.1238 0.1233 +- 0.0004 0.1231 +- 0.0003
pt0isr 0.3 (nearly flat chi2) 0.4 +- 0.4 0 +- 0.3

While the other parameters make somehow sense (even though they are not identical) both models struggle with pt0isr. The direct model presents a nearly flat chi2 near the minimum
chi2_2
while the inverse model prediction has a very high error.

(now I'm doing some hyperparameter tuning to see what happens)

Paper roadmap

Steps to perform in order to publish a paper:

  • Verify code perform "industrialization step".
  • Generate MC runs for a complete final tune
  • Validate the results by checking:
    • model performance
    • correlations
    • uncertainties

Monte Carlo campaign

This step is required in order to build a consistent dataset of MC distributions and parameter values for a reference tune performed with standard tools, e.g. Professor, and the for the future machine learning techniques which may require cross-validation implementation.

This step requires the implementation of:

  • configuration cards for the MC run (pythia)
  • storage of the events in this repository or in a git lfs repository depending on how large the dataset is.
  • validate the results with plots (e.g. using yoda)

Potential bug in the analysis of the correlation matrix of CMA-ES

In the minimization step, after the execution of the CMA-ES algorithm, the covariance matrix is decomposed in eigenvalues and eigenvectors, and then a 1-sigma eigenvector basis is computed by adding the eigenvectors times the square root of the eigenvalues to the best parameters.

https://github.com/scarrazza/mcnntunes/blob/16c73bda6fdcc3d72eac19f54671ab521d703228/src/mcnntunelib/app.py#L312-L327

I've noticed that cov is computed with the unscaled std best_std:
https://github.com/scarrazza/mcnntunes/blob/16c73bda6fdcc3d72eac19f54671ab521d703228/src/mcnntunelib/app.py#L298-L300
while the 1-sigma eigenvector basis is computed by using result[0], which I think is scaled.
Then, we unscale the basis (line 327), so result[0] gets mapped to best_x. However, the contribution of the covariance matrix is unscaled twice, isn't it?

In other words, I think that we should replace result[0] with best_x in line 324 and remove the unscale function call in line 327.

@scarrazza could you take a look and see whether I'm right or I didn't understood these lines?

All of this is in the master branch.

First release requirements

In order to make this repo public we have to:

  • 1 implement tests for all functionalities, e.g. running examples, or running pytest
  • 2 implement github actions to perform tests automatically
  • 3 add pycoverage and make sure the code is fully tested.
  • 4 add a sphinx documentation for later publication in read the docs.
  • 5 create github action for release that creates a pip package and uploads artifacts to pypi.
  • 6 when the code is public, create a Zenodo entry
  • 7 optional, create a conda package

We can follow the structure of Qibo, @mlazzarin could you please have a look / first try?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.