Giter Site home page Giter Site logo

deepjet's Introduction

DeepJet: Repository for training and evaluation of deep neural networks for Jet identification

This package depends on DeepJetCore 3.X (https://github.com/DL4Jets/DeepJetCore). (but it should still work for DJC2)

Usage

After logging in and setting up the DeepJetCore singularity environment, please source the DeepJet environment (please cd to the directory first!).

cd <your working dir>/DeepJet
source env.sh

The preparation for the training consists of the following steps

  • define the data structure for the training. The DeepJet datastructure is found in the modules directory as the class TrainData_DF. DeepCSV is found as the class TrainData_DeepCSV

  • convert the root file to the data strucure for training using DeepJetCore tools. The class argument should be TrainData_DF for DeepJet and TrainData_DeepCSV for DeepCSV:

      convertFromSource.py -i /path/to/the/root/ntuple/list_of_root_files.txt -o /output/path/that/needs/some/disk/space -c TrainData_DF
    

    This step can take a while.

  • prepare the training file and the model. Please refer to DeepJet/Train/train_DeepFlavour.py for training of DeepJet and DeepJet/Train/train_DeepCSV.py for DeepCSV.

Training

Since the training can take a while, it is advised to open a screen session, such that it does not die at logout.

ssh lxplus.cern.ch
<note the machine you are on, e.g. lxplus058>
screen
ssh lxplus7

Then source the environment, and proceed with the training. Detach the screen session with ctr+a d. You can go back to the session by logging in to the machine the session is running on (e.g. lxplus58):

ssh lxplus.cern.ch
ssh lxplus058
screen -r

Please close the session when the training is finished

the training is launched in the following way:

python3 train_DeepFlavour.py /path/to/the/output/of/convert/dataCollection.djcdc <output dir of your choice>

Evaluation

After the training has finished, the performance can be evaluated.

predict.py <output dir of training>/KERAS_model.h5  <output dir of training>/trainsamples.dc <dir with test sample stored as rootfiles>/filelist.txt <output directory>

This creates output trees with the prediction scores as well as truth information and some kinematic variables.

deepjet's People

Contributors

alexdemoor avatar astakia avatar emilbols avatar gouskos avatar hajohajo avatar hqucms avatar jkiesele avatar kirschen avatar swapneelm avatar tmoxter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

deepjet's Issues

Issues with new uproot version

The Conversion script in the DeepJetCore-repository fails with a TypeError when executed with the TrainData_DeepCSV module and very likely also with the DeepFlavour module.

The stack trace:

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/share/DJC/DeepJetCore/DataCollection.py", line 427, in writeData_async
    td.writeFromSourceFile(tmpinput, self.weighterobjects, istraining = not self.istestdata, outname=newpath)
  File "/usr/share/DJC/DeepJetCore/TrainData.py", line 105, in writeFromSourceFile
    self.readFromSourceFile(filename, weighterobjects, istraining)
  File "/usr/share/DJC/DeepJetCore/TrainData.py", line 81, in readFromSourceFile
    x,y,w = self.convertFromSourceFile(filename, weighterobjects, istraining,  **kwargs)
  File "/afs/cern.ch/work/n/neich/private/BTV-HLT-training-tools/DeepJet/modules/datastructures/TrainData_deepFlavour.py", line 448, in convertFromSourceFile
    truth = reduceTruth(truth_arrays)
  File "/afs/cern.ch/work/n/neich/private/BTV-HLT-training-tools/DeepJet/modules/datastructures/TrainData_deepFlavour.py", line 428, in reduceTruth
    return np.vstack((b+lepb,bb+gbb,c+cc+gcc,uds+g)).transpose()
  File "<__array_function__ internals>", line 6, in vstack
TypeError: no implementation found for 'numpy.vstack' on types that implement __array_function__: [<class 'awkward.highlevel.Array'>]

This issue is not present, when using uproot version 3 instead of the newest version uproot 4.

A possible hotfix for that could be changing imports

import uproot
...

to

import uproot3 as uproot
...

For the module.

module object not callable while tring to convert root file to training format

https://github.com/SwapneelM/DeepJet/blob/master/README.md
the instructions for preprocessing the root file into training format
convertFromRoot.py -i /path/to/the/root/ntuple/list_of_root_files.txt -o /output/path/that/needs/some/disk/space -c TrainData_myclass

I used the following command
convertFromRoot.py -i /eos/user/e/ebols/HLT/DeepNTuple_1p1MJets_changedDeepCSVVtxDef.root -o /afs/cern.ch/work/r/runiyal/DeepJet -c TrainDataDeepJet

which gave me the following error

(deepjetpkg) [runiyal@lxplus027 DeepJet]$ convertFromRoot.py -i /eos/user/e/ebols/HLT/DeepNTuple_1p1MJets_changedDeepCSVVtxDef.root -o /afs/cern.ch/work/r/runiyal/DeepJet -c TrainDataDeepJet
Using TensorFlow backend.
INFO:root:infile = /eos/user/e/ebols/HLT/DeepNTuple_1p1MJets_changedDeepCSVVtxDef.root
INFO:root:outPath = /afs/cern.ch/work/r/runiyal/DeepJet
Traceback (most recent call last):
File "/afs/cern.ch/work/r/runiyal/miniconda3/envs/deepjetpkg/bin/convertFromRoot.py", line 4, in
import('pkg_resources').run_script('DeepJetCore==1.0.0', 'convertFromRoot.py')
File "/afs/cern.ch/work/r/runiyal/miniconda3/envs/deepjetpkg/lib/python2.7/site-packages/pkg_resources/init.py", line 658, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/afs/cern.ch/work/r/runiyal/miniconda3/envs/deepjetpkg/lib/python2.7/site-packages/pkg_resources/init.py", line 1438, in run_script
exec(code, namespace, namespace)
File "/afs/cern.ch/work/r/runiyal/miniconda3/envs/deepjetpkg/lib/python2.7/site-packages/DeepJetCore-1.0.0-py2.7-linux-x86_64.egg/EGG-INFO/scripts/convertFromRoot.py", line 118, in
infile, traind(class_args) if class_args else traind(), outPath,
TypeError: 'module' object is not callable

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.