TorchLean API

NN.Verification.Robustness.MarginCert

Margin Certificate Checker #

Reusable checker for per-example logit-margin certificates (robust_margin_cert_v0_1).

The checker reads exported output bounds and recomputes the strict top-label margin:

logits_hi[j] < logits_lo[label] for every j ≠ label.

Certificate format tag expected at the top level of margin certificate JSON files.

Instances For

    Running counters for nominal and certified accuracy reports.

    • total :

      Number of examples checked.

    • nominalOk :

      Number of examples whose optional nominal prediction equals the label.

    • certifiedOk :

      Number of examples certified by the margin predicate.

    Instances For

      Add one (nominalOk, certifiedOk) outcome to the report counters.

      Instances For

        Check one JSON example object and return (nominalOk, certifiedOk).

        Instances For

          Check a robust_margin_cert_v0_1 JSON certificate file.

          If timing = true, prints per-example timings every timingEvery examples.

          Instances For

            Check a margin certificate file with timing disabled.

            Instances For

              Parsed CLI flags for a margin-certificate run.

              • path : String

                Certificate JSON path.

              • timing : Bool

                Print per-example checker timings.

              • timingEvery :

                Print every timingEvery examples when timing is enabled; 0 disables periodic lines.

              Instances For

                Parse shared margin-certificate CLI flags.

                Instances For

                  Run the checker with a caller-provided default certificate path.

                  Instances For