API Reference

cli: run

Command line interface run

monad.run

Trains the foundation model in one of two ways:

  • Run both training stages in a joint pipeline using the --pretrain argument.

    python -m monad.run 
    --pretrain 
    --config-path "path/to/config.yml" 
    --features-path "path/to/store/pretrain/artifacts" 
    --overwrite
  • Run training in separate stages, which may be helpful—for example—in a dual-environment setup. In this case, you will execute run two times with arguments: --fit and --fm.

    python -m monad.run \
    --fit \
    --config-path "path/to/config.yml" \
    --features-path "path/to/store/pretrain/artifacts" \
    --overwrite
    
    python -m monad.run \
    --fm \
    --features-path "path/to/store/pretrain/artifacts" \
    --overwrite
Mode Keywords

--pretrain: First validates the configuration, then automatically runs both training stages: it fits the behavioral representation, and finally trains the foundation model using the output from the fitting step.


--fit: Fit behavioral representation. This stage analyzes the data and builds the feature representation needed for model training.


--fm: Train foundation model based on fitted behavioral representation. Please note that config-path should no longer be provided; BaseModel will use the configuration file stored at the fitting stage.


Parameters

The table below summarizes the availability of command-line parameters across different execution contexts. Each argument is exclusive to the command(s) listed in its row .

Parameter

Available with

--output-path: pathlib.Path
Required Path to YAML configuration file.

--pretrain,
--fit

--config-path: pathlib.Path
Required
Path to YAML configuration file.

--pretrain,
--fit

--storage-config-path: pathlib.Path
File system configuration.

--pretrain,
--fit, --fm

--resume: store_true
If used, training will be resumed from the last checkpoint if such exists, an error
will be thrown otherwise.

--pretrain,
--fit, --fm

--overwrite: store_true
If used, any previous training results will be overwritten. Otherwise, if resume is
not set and checkpoints from previous training are present, error will be raised.

--pretrain,
--fit, --fm

--nan-threshold: float
Default: 0.9
Maximum fraction of missing values allowed in a column to process.

--pretrain,
--fit

--recency-sketch-timespan-days: int
Default: RECENCY_SKETCH_TIMESPAN_DAYS_DEFAULT
If set, defines the window in days for recency-based sketches. Recency sketches
store information about how far in the past the interactions took place.

--pretrain, --fm

--use-last-basket-sketches: argparse.BooleanOptionalAction
Default: True
Use --use-last-basket-sketches to include a sketch of the most recent events
as an additional input. Use --no-use-last-basket-sketches to do not include
a sketch of the most recent events as an additional input.

--pretrain, --fm