export_cobol
from compileml.export import export_cobol
Render the artifact's score, band and calibrated PD as a COBOL program.
The generated program reads features from WORKING-STORAGE (integration
point: MOVE caller values in, or adapt to a LINKAGE SECTION), then leaves
F-LATENT-INT (display-scale score), FINAL-BAND and F-PD-PPM
(calibrated PD, parts per million) populated.
With driver_rows (a list of feature rows), the program becomes a
parity harness instead: it scores every row and DISPLAYs
latent_int band pd_ppm one row per line — compile it, run it, and diff
the output against the Python runtime. CI does exactly that under GnuCOBOL.
With explain=True the program also computes exact attribution and
leaves the top top_k adverse and favorable reasons in
REASON-NEG-CODE(i) / REASON-NEG-IMPACT(i) and
REASON-POS-CODE(i) / REASON-POS-IMPACT(i), with
REASON-NEG-COUNT and REASON-POS-COUNT saying how many are filled.
Codes and display-scale integer impacts match
decide(..., explain=True) exactly; message text stays with the
institution's letter templates. top_k defaults to the artifact's own.
The driver harness then also prints each reason.
Raises:
ExportError: EXPLAIN_NOT_EXACT or REASON_CODE_NOT_ASCII —
see :class:`ExportError`.
Parameters#
| Name | Type | Default | Kind |
|---|---|---|---|
| artifact | dict | required | positional |
| program_id | str | 'CMLSCORE' | keyword-only |
| driver_rows | list | None | None | keyword-only |
| explain | bool | False | keyword-only |
| top_k | int | None | None | keyword-only |
Returns#
str
Raises#
- ExportError
- ValueError
Read from the function body and the private helpers it calls, not inferred. A function that raises nothing has no section here.
Example#
from compileml.export import export_cobol cob = export_cobol(artifact, program_id="SCORER")