Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions tutorials/roofit/roofit/rf615_simulation_based_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
## \date July 2024
## \author Robin Syring

import ROOT
import numpy as np
import ROOT
from sklearn.neural_network import MLPClassifier

# The samples used for training the classifier in this tutorial / rescale for more accuracy
Expand All @@ -45,8 +45,7 @@


# Morphing as a baseline
def morphing(setting):

def morphing(setting, workspace):
# Define binning for morphing
grid = ROOT.RooMomentMorphFuncND.Grid(ROOT.RooBinning(4, 0.0, 4.0))
x_var.setBins(50)
Expand Down Expand Up @@ -199,7 +198,7 @@ def learned_likelihood_ratio(x, mu):
ROOT.SetOwnership(nllr_learned, True)

# Compute the morphed nll
morphing(ROOT.RooMomentMorphFuncND.Linear)
morphing(ROOT.RooMomentMorphFuncND.Linear, workspace)
nll_morph = workspace["morph"].createNLL(obs_data)
ROOT.SetOwnership(nll_morph, True)

Expand Down