Skip to content

CLI Reference

Complete reference for all Pilz command-line commands.

Commands Overview

flowchart TD A[pilz] --> B[train] A --> C[eval] A --> D[infer] A --> F[create-dc] A --> G[convert] B --> B1[Train models] C --> C1[Evaluate + metrics] D --> D1[Predictions only] F --> F1[Generate DataCard] G --> G1[Migrate legacy trees] style A fill:#e0f0ff style B fill:#ccffcc style C fill:#ffff99 style D fill:#ffff99 style F fill:#ccffcc style G fill:#ccffcc

Global Options

Every command accepts the standard Typer options:

Option Description
--help Show the help message and exit
--install-completion Install completion for the current shell
--show-completion Show completion for the current shell, to copy it or customize the installation

train

Train Pilz models for every target value in the datacard.

pilz train --datacard <file.yaml> --trainsettings <file.yaml>

Options

Option Description
--datacard Path to DataCard YAML file
--trainsettings Path to TrainSettings YAML file

Example

pilz train --datacard iris_dc.yaml --trainsettings train.yaml

eval

Evaluate trained models and generate ROC plots and metrics.

pilz eval --datacard <file.yaml> --evalsettings <file.yaml>

Options

Option Description
--datacard Path to DataCard YAML file
--evalsettings Path to EvalSettings YAML file

Example

pilz eval --datacard iris_dc.yaml --evalsettings eval.yaml

Output Files

eval writes scores and plots. It does not emit SQL rules or predictions as SQL.

  • {target}_roc.html - ROC curve per target value; always written unless infer is used
  • all_roc.html - Combined ROC curves; only when not using infer
  • multi_class_result.html - Per-class accuracy; only for multi-class targets (len(target.values) > 1) and not using infer
  • {out_file} - Prediction scores (CSV/Parquet); only when the out_file setting is set

infer

Apply trained models to new data and write the predictions.

pilz infer --datacard <file.yaml> --evalsettings <file.yaml>

Unlike eval, no plots or accuracy metrics are produced, only the predicted scores (and, for multi-class targets, the predicted label). No HTML files are written; {out_file} is written when the out_file setting is set.

Options

Option Description
--datacard Path to DataCard YAML file
--evalsettings Path to EvalSettings YAML file

Example

pilz infer --datacard iris_dc.yaml --evalsettings eval.yaml

Use Cases

  • Fast prediction on new data
  • Batch scoring in production
  • When you only need scores, not metrics

create-dc

Interactively generate a datacard YAML from a source data file.

pilz create-dc --src <path> --out <file.yaml>

Options

Option Description
--src Path to the source data file (CSV or Parquet)
--out Path where the generated datacard YAML is written (prompted if omitted)

Example

pilz create-dc --src data.csv --out datacard.yaml

Interactive Prompts

  1. Prompts for the target column until a valid column name is entered
  2. Derives each feature's type and statistical automatically from the column dtype (no user prompt)
  3. Prompts once for a replacement missing_value for any column containing nulls or float NaN
  4. Prompts for "Infos about the dataset" and writes the answer as infos: {bla: <answer>}

convert

Rewrite legacy cut-string trees to the compact structured form.

pilz convert --src <folder> --out <folder>

Trees trained before the structured cond representation stored every leaf condition as rendered SQL text; fan-out trees could reach megabyte-sized leaves. This command parses each condition back into the structured cond form and writes the trees to out. Tree structure and leaf scores are unchanged, so eval results are identical — only evaluation becomes fast.

Options

Option Description
--src Path to the folder holding the trained trees (one sub-folder per target)
--out Path where the migrated trees are written (prompted if omitted)

Example

pilz convert --src iris_model --out iris_model_cond

Quick Reference

Command Purpose
pilz train --datacard X --trainsettings Y Train models
pilz eval --datacard X --evalsettings Y Evaluate with metrics
pilz infer --datacard X --evalsettings Y Fast predictions
pilz create-dc --src X --out Y Generate DataCard
pilz convert --src X --out Y Migrate legacy trees