sasctl.utils.pyml2ds package#

Submodules#

sasctl.utils.pyml2ds.pyml2ds module#

Translate a gradient boosting model and write SAS scoring code to file.

Supported models are: xgboost, lightgbm and pmml gradient boosting.

Parameters#

in_filestr or bytes or file-like

Pickled object to translate. String is assumed to be a path to a picked file, file-like is assumed to be an open file handle to a pickle object, and bytes is assumed to be the raw pickled bytes.

out_var_namestr (optional)

Output variable name.

Returns#

str

A SAS Data Step program implementing the model.

Examples#

Generate SAS code from an XGBoost model.

>>> from xgboost.sklearn import XGBRegressor
>>> xgb = XGBRegressor()
>>> xgb.fit(X, y)
>>> pkl = pickle.dumps(xgb)
>>> sas_code = pyml2ds(pkl)

Warning

This method is experimental and may be modified or removed without warning.