ads.model.transformer package

Submodules

ads.model.transformer.onnx_transformer module

class ads.model.transformer.onnx_transformer.ONNXTransformer[source]

Bases: object

This is a transformer to convert X [pandas.Dataframe, pd.Series] data into Onnx readable dtypes and formats. It is Serializable, so it can be reloaded at another time.

Examples

>>> from ads.model.transformer.onnx_transformer import ONNXTransformer
>>> onnx_data_transformer = ONNXTransformer()
>>> train_transformed = onnx_data_transformer.fit_transform(train.X, {"column_name1": "impute_value1", "column_name2": "impute_value2"}})
>>> test_transformed = onnx_data_transformer.transform(test.X)
fit(X: DataFrame | Series | ndarray | list, impute_values: Dict | None = None)[source]

Fits the OnnxTransformer on the dataset :param X: The Dataframe for the training data :type X: Union[pandas.DataFrame, pandas.Series, np.ndarray, list]

Returns:

Self – The fitted estimator

Return type:

ads.Model

fit_transform(X: DataFrame | Series, impute_values: Dict | None = None)[source]

Fits, then transforms the data :param X: The Dataframe for the training data :type X: Union[pandas.DataFrame, pandas.Series]

Returns:

The transformed X data

Return type:

Union[pandas.DataFrame, pandas.Series]

static load(filename, **kwargs)[source]

Loads the Onnx model to disk :param filename: The filename location for where the model should be loaded :type filename: Str

Returns:

onnx_transformer – The loaded model

Return type:

ONNXTransformer

save(filename, **kwargs)[source]

Saves the Onnx model to disk :param filename: The filename location for where the model should be saved :type filename: Str

Returns:

filename – The filename where the model was saved

Return type:

Str

transform(X: DataFrame | Series | ndarray | list)[source]

Transforms the data for the OnnxTransformer.

Parameters:

X (Union[pandas.DataFrame, pandas.Series, np.ndarray, list]) – The Dataframe for the training data

Returns:

The transformed X data

Return type:

Union[pandas.DataFrame, pandas.Series, np.ndarray, list]

Module contents