Validating the Target Function

Checking your function before training the scenario

⚠️

Check This First!

This article refers to BaseModel accessed via Docker container. Please refer to Snowflake Native App section if you are using BaseModel as SF GUI application.


Writing a target function can become slightly complicated at times, especially when we need to include multiple conditions or customize time windows. In such cases, it is recommended to quickly validate the function output to ensure it runs without errors and returns exactly the target its author intended, before executing the entire downstream task of scenario modeling.

BaseModel verify_target() function does exactly that:

  • In case of errors, it will raise one of the following types:
    • TypeError: if return types are incorrect or inconsistent.
    • ValueError: if percentage_nones_allowed evaluation returns None.
    • RuntimeError: if running the target function fails.
  • If the validation proceeds without errors, the function will return an example target.

Parameters

  • database_type : str
    required
    Target function to evaluate.

  • fm_checkpoint_path : str | Path
    required
    Path to FM checkpoint.

  • task : Task
    _required

    Task for which the target function will be applied.

  • data_params_overrides : DataParams
    optional, default: None
    Overrides for data parameters.

  • num_percentage_entities : int
    optional, default: 1
    Percentage of all entites to validate target_fn against.

  • percentage_nones_allowed : int
    optional, default: 90
    Allowed percentage of invalid targets.

  • log_every_n_steps : int
    optional, default: None
    Whether to print a log ever log_every_n_stepsn evaluated entities.

  • limit : int
    optional, default: None
    If set, validation will stop after processing limit entities.