{"cells": [{"cell_type": "markdown", "id": "78f74622", "metadata": {}, "source": ["# Use function when converting into ONNX\n", "\n", "Once a a scikit-learn model is converting into ONNX, there is no easy way to retrieve the original scikit-learn model. The following notebook explores an alternative way to convert a model into ONNX by using functions. In this new method, every piece of a pipeline becomes a function."]}, {"cell_type": "code", "execution_count": 1, "id": "29fac993", "metadata": {}, "outputs": [{"data": {"text/html": ["
\n", ""], "text/plain": ["Pipeline(steps=[('preprocessing', StandardScaler()),\n", " ('classifier',\n", " LogisticRegression(penalty='l1', solver='liblinear'))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('preprocessing', StandardScaler()),\n", " ('classifier',\n", " LogisticRegression(penalty='l1', solver='liblinear'))])
StandardScaler()
LogisticRegression(penalty='l1', solver='liblinear')
Pipeline(steps=[('preprocessing',\n", " ColumnTransformer(transformers=[('A', StandardScaler(),\n", " [0, 1]),\n", " ('B', MinMaxScaler(),\n", " [2, 3])])),\n", " ('classifier',\n", " LogisticRegression(penalty='l1', solver='liblinear'))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('preprocessing',\n", " ColumnTransformer(transformers=[('A', StandardScaler(),\n", " [0, 1]),\n", " ('B', MinMaxScaler(),\n", " [2, 3])])),\n", " ('classifier',\n", " LogisticRegression(penalty='l1', solver='liblinear'))])
ColumnTransformer(transformers=[('A', StandardScaler(), [0, 1]),\n", " ('B', MinMaxScaler(), [2, 3])])
[0, 1]
StandardScaler()
[2, 3]
MinMaxScaler()
LogisticRegression(penalty='l1', solver='liblinear')