Skip to content

Conversation

@guitargeek
Copy link
Contributor

See more details in the commit messages.

This is a followup to #8878, and the first commit silences a harmless error message that appeared after d5c3c58.

@phsft-bot
Copy link

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

Copy link
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just a small comment, otherwise looks fine to me !

bool takeGlobalObservablesFromData,
bool cloneConstraints,
RooWorkspace * workspace = nullptr);
RooWorkspace * workspace);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed ? It is a change in the interface for some potential users

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have avoided the bug that is fixed in this PR. And fortunately, this change doesn't break any existing code, because RooConstraintSum::createConstraintTerm was only introduced in this release development cycle!

@guitargeek guitargeek changed the title RF] Add rf317 tutorial about global observables in RooFit and fixes to bugs discovered when writing the tutorial [RF] Add rf317 tutorial about global observables in RooFit and fixes to bugs discovered when writing the tutorial Feb 2, 2022
In older releases this was not necessary, because the recursively called
`addParameters` was already filling a `RooArgSet`, so the duplicate
check happened there.

Now the deduplication is only done at the end when the parameters are
transferred from a RooArgList to a RooArgSet. That means the adding
should be done in silent more to not spam the message logger with
harmless "errors".
The `cloneConstraints` parameter was not passed correctly to
`RooConstraintSum::createConstraintTerm`, most likely because of a
rebase error in the past.

To avoid similar errors in the past, the signature of
`RooConstraintSum::createConstraintTerm` got changed to not have a
default value for the workspace pointer. In this way, interface
mismatches will be better caught at compile time.
@phsft-bot
Copy link

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

@guitargeek
Copy link
Contributor Author

Last force push was just to fix a typo in the first commit.

@phsft-bot
Copy link

Build failed on ROOT-performance-centos8-multicore/default.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

Copy link
Member

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I added quite some comments. Don't feel obliged to address all of them.

// the negative log-likelihood `l` given the per-event or per-bin
// observations `x`:
//
// l( x | p )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this notation confusing. I was going to suggest changing + to *, because I thought that l == likelihood. Maybe you use NLL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now I used L for likelihood all the way, use * and don't talk about negative logarithms.

// nuisance parameter that is constrained by an auxiliary measurement
// `lumi_obs` with uncertainty `lumi_obs_sigma`:
//
// l'(data | mu, lumi) = l(data | mu, lumi) * Gauss(lumi | lumi_obs, lumi_obs_sigma)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Traditionally, it's L( obs | pars), but you now did Gauss( par | obs, par). The Gaussian is symmetric, but it's not nice.
  2. Now l is a likelihood again ...
Suggested change
// l'(data | mu, lumi) = l(data | mu, lumi) * Gauss(lumi | lumi_obs, lumi_obs_sigma)
// l'(data | mu, lumi) = l(data | mu, lumi) * Gauss(lumi_obs | lumi, lumi_obs_sigma)

//
// Since a Gaussian is symmetric in `lumi` and `lumi_obs`, we can
// reformulate the likelihood to make it apparent that `lumi_obs` is a
// global observables:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// global observables:
// global observable:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why this would need to be reformulated. Remove this, and directly show the L( obs | par)?

The new tutorial explains:

  * the concept of global observables
  * the related command arguments to `RooAbsPdf::fitTo`
  * how to store global observable values in data
The RooFit convention for constraint terms is to have the constrained
parameter also as the mean parameter of the constraint Gaussian, while a
so-called global observable (a constant) is put in place of the
pdf observable.
@phsft-bot
Copy link

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link

Build failed on ROOT-performance-centos8-multicore/default.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

@guitargeek guitargeek changed the title [RF] Add rf317 tutorial about global observables in RooFit and fixes to bugs discovered when writing the tutorial [RF] Add rf613 tutorial about global observables in RooFit and fixes to bugs discovered when writing the tutorial Feb 2, 2022
@guitargeek
Copy link
Contributor Author

Hi @hageboeck, thanks a lot for your comments! I have addressed all of them, thanks for helping out to get this much needed tutorial for global observables into a good shape 👍

I'll merge now so that this still makes it into the release, but please let me know if you want me to follow up on something.

@guitargeek guitargeek merged commit fb0984c into root-project:master Feb 3, 2022
@guitargeek guitargeek deleted the roofit_docs_1 branch February 3, 2022 00:30
@phsft-bot
Copy link

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2022-02-03T01:55:05.323Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1070 (message):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants