sasctl.pzmm.pickle_model#
- class sasctl.pzmm.pickle_model.PickleModel[source]#
Bases:
object
Methods
pickle_trained_model
(model_prefix[, ...])Write trained model to a binary pickle file, H2O MOJO file, or a binary string object.
- classmethod pickle_trained_model(model_prefix: str, trained_model: Any | None = None, pickle_path: str | Path | None = None, is_h2o_model: bool = False, is_binary_model: bool = False, is_binary_string: bool = False, mlflow_details: dict | None = None) dict | str | None [source]#
Write trained model to a binary pickle file, H2O MOJO file, or a binary string object.
- The following files are generated by this function:
- Parameters:
- model_prefixstr or Path
Variable name for the model to be displayed in SAS Open Model Manager (i.e. hmeqClassTree + [Score.py || .pickle]).
- trained_modelmodel object
The trained model to be exported.
- pickle_pathstr, optional
File location for the output pickle file. The default value is None.
- is_h2o_modelbool, optional
Sets whether the model file is an H2O.ai MOJO file. If set as True, the MOJO file will be gzipped before uploading to SAS Model Manager. The default value is False.
- is_binary_modelbool, optional
Sets whether the H2O model provided is a binary model or a MOJO model. The default value is False.
- is_binary_stringbool, optional
Sets whether the model is to be set as a binary string instead of a pickle file. The default value is False.
- mlflow_detailsdict, optional
Model details from an MLFlow model. This dictionary is created by the readMLModelFile function. The default value is None.
- Returns:
- binary_stringbinary str
When the is_binary_string flag is set to True, return a binary string representation of the model instead of a pickle or MOJO file.
- dict
Dictionary containing a key-value pair representing the file name and pickle dump respectively if pickle_path is None. This is not valid for H2O.ai models.