Skip to content

B — Gradient plumbing: route free params to sensitivity_params/sensitivity_ic (bind-by-id + condition chain-rule) #448

Description

@wshlavacek

Part of #385 (cut 1, step 2 of A→B→C). Depends on #447. Pure mapping — no objective math.

What

Given an edition-2 fit, compute, per experiment, the bngsim sensitivity request and the
per-free-parameter chain-rule factor that converts a native sensitivity column into the derivative
w.r.t. the free parameter.

The mapping (edition-2)

  • Bind by id (ADR-0034). A parameter: free parameter (ADR-0043) binds to the model entity of
    the same id, the same contract set_param already uses (net_model.py:203-218). A free parameter
    that matches no model id (e.g. a free σ) is not a sensitivity request — it carries no model
    column (its gradient is assembled in C — Gradient plumbing: Gaussian gradient + residual-Jacobian assembly, convention pin, native→sampling transform, FD-check #449 / layer D). This is the existing unmatched-param path
    (warning, not error — ADR-0034).

  • Param vs IC. Route a free parameter that binds to a kinetic/global parameter to
    sensitivity_params; one that binds to a species initial value (_parse_net_species_initializers,
    net_model.py:159) to sensitivity_ic. Cut-1 must-have is sensitivity_params; IC routing is the
    secondary branch.

  • Per-condition perturbation = local derivative. A condition: is a MutationSet on the base
    model (ADR-0028, config.py:1198); each Mutation carries operation{=,+,-,*,/}
    (pset.py:1714, ops at pset.py:1741-1749). For free parameter p perturbed in an experiment's
    condition:

    • p = cp is pinned to a constant in that experiment ⇒ factor 0 (drop p's column).
    • p * c → factor c; p / c → factor 1/c; p + c / p - c → factor 1.

    An unperturbed free parameter has factor 1. The factor multiplies that parameter's native
    sensitivity column when C — Gradient plumbing: Gaussian gradient + residual-Jacobian assembly, convention pin, native→sampling transform, FD-check #449 assembles the per-experiment Jacobian.

Deliverables

Out of scope

Consuming the factors / building the objective Jacobian → #449. Pre-equilibration conditions
(layer J). Comparison-difference constraints (layer I).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions