axisnorm, axisexp, axisbernstein poi models#131
Draft
pmlugato wants to merge 2 commits intoWMass:mainfrom
Draft
Conversation
…extened to --arg order...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
N.B. This is a draft as it will follow #130, and conform to new naming scheme and file structure introduced there.
Summary
Adds three new POI model classes (
AxisNormModel,AxisExpModel,AxisBernsteinModel) for per-cellsignal normalization and exponential or Bernstein polynomial (preliminary just 1st order) background parameterization, enables composing multiple POI models on a single fit via repeated
--poiModelflags,and fixes a bug in
CompositePOIModelthat froze parameters of sub-models withunconstrained POIs.
Changes
poi_model.pyAxisNormModel: new class. Assigns one independent normalization POI per(process, cell)where cells are defined by a caller-specified set of axeslooked up from
indata.channel_info. POI = x² reparameterization enforcesnon-negativity. All other channels and processes are left at 1.0.
AxisExpModel: new class. Assigns per-celllnAmpland per-groupslopePOIs producing
rnorm = exp(lnAmpl + slope·x)across the shape axis. Bothparameters are unconstrained reals (
allowNegativePOI=True); slope=0 (flatbackground) is an interior point so the Hessian is non-degenerate there. Slope
can optionally be shared across a coarser axis grouping via an optional 5th CLI
argument
slope_axes, reducing parameters and stabilizing the Hessian whenper-cell slopes are under-constrained.
CompositePOIModelbug fix: previously hardcodedallowNegativePOI=False,causing the fitter to apply x² to the entire combined parameter vector. This
silently froze sub-models with
allowNegativePOI=Trueat initialization (zerogradient via chain rule at x=0). Fixed by setting
allowNegativePOI=Trueonthe composite and applying the x² transform per-sub-model inside
compute()based on each sub-model's own flag. Also corrects
is_linearto require allsub-models to be linear rather than inheriting the composite flag.
AxisBernsteinModel: new class. Assigns two non-negative POIs(c₀, c₁)per
(process, cell)and producesrnorm(x_m) = c₀·(1−x_m) + c₁·x_m(first-order Bernstein polynomial) where
x_m ∈ [0,1]is the normalized mass bincenter. Non-negativity is enforced via the x² reparameterization
(
allowNegativePOI=False); defaultc₀=c₁=1gives a flat unit background atan interior point in parameter space. Structurally analogous to
AxisExpModelbut bounded and linear, with no slope-grouping option.
helpers.py: registersAxisNormModelandAxisExpModelin thebuilt-in model loader so they resolve without a dotted module path.
parsing.py--poiModelchanged from a singlenargs="+"argument toaction="append" nargs="+", allowing the flag to be repeated. Multiple models are automaticallycomposed via
CompositePOIModelinrabbit_fit.py.rabbit_fit.pyUpdated model instantiation to iterate over all
--poiModelspecs and wrapthem in
CompositePOIModelwhen more than one is provided.Usage example