openlayer.validators.model_validators.ModelValidator#
- class openlayer.validators.model_validators.ModelValidator(model_config_file_path, use_runner=False, model_package_dir=None, sample_data=None)#
Validates the model package’s structure and files.
- Parameters
- model_config_file_path: str
Path to the model config file.
- model_package_dirstr
Path to the model package directory.
- sample_datapd.DataFrame
Sample data to be used for the model validation.
Examples
Let’s say we have the prepared the model package and have some sample data expected by the model in a pandas DataFrame.
To ensure the model package is in the format the Openlayer platform expects to use the
openlayer.OpenlayerClient.add_model()
method, we can use theModelValidator
class as follows:,>>> from openlayer.validators import model_validators >>> >>> model_validator = model_validators.ModelValidator( ... model_config_file_path="/path/to/model/config/file", ... model_package_dir="/path/to/model/package", ... sample_data=df, ... ) >>> model_validator.validate()
Methods
validate:
Runs all model validations.