# Can I transform ML model learned on KNIME to pkl file?

**URL:** <https://forum.knime.com/t/can-i-transform-ml-model-learned-on-knime-to-pkl-file/81144>\
**Category:** KNIME Analytics Platform\
**Tags:** machine-learning, python\
**Created:** [July 17, 2024, 5:25am UTC](https://forum.knime.com/t/can-i-transform-ml-model-learned-on-knime-to-pkl-file/81144 "2024-07-17T05:25:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ParkJunYong](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/p/e36b37/32.png) [@ParkJunYong](https://forum.knime.com/u/ParkJunYong)\
**Post date:** [July 17, 2024, 5:25am UTC](https://forum.knime.com/t/can-i-transform-ml-model-learned-on-knime-to-pkl-file/81144/1 "2024-07-17T05:25:45Z")

</div>

I would like to use the ML model learned in KNIME AP and extracted as a pickle file outside of KNIME AP. Is it possible to extract the ml model into a pickle file and use it in another Python script outside of KNIME AP?

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [July 17, 2024, 6:10am UTC](https://forum.knime.com/t/can-i-transform-ml-model-learned-on-knime-to-pkl-file/81144/2 "2024-07-17T06:10:06Z")

</div>

@ParkJunYong you can pickle models from the python nodes

> **[Simple example to make a random forest model with new Python Scrip in KNIME...](https://hub.knime.com/mlauber71/spaces/Public/kn_example_python_iris_2022~HIFbIx26objNVR40/current-state)**
>
> Simple example to make a random forest model with new Python Scrip in KNIME 4.6 using the iris dataset. Saving and reusing the model with Pickle Also creating …

The other model types to use with external programs are H2O.ai MOJO (I would recommend that it works across programs like R and Python and operating systems)

> **[mlauber71/Public – automl](https://hub.knime.com/mlauber71/spaces/Public/automl~I2Q4vqUYtgPfCYX9/)**
>
> A large collection of KNIME workflows for version up to 4.7. In the /forum/ subfolder are some examples for questions from the forum from 2021 and before – contains 17 items

Next one would be PMML which has been built for this but faces challenges when using it in real life.

> [@Error when importing KNIME's Model file in Jupyter](https://forum.knime.com/t/error-when-importing-knimes-model-file-in-jupyter/70699/4):
>
> @JaeHwanChoi the model writer will zip a given model to store it. Underneath there has to be a model that the package that you used can read([KNIME ML to Python - #2 by mlauber71](https://forum.knime.com/t/knime-ml-to-python/44220/2) ). If you want to use it with Jupyter notebooks this has to work in both environments. You could try and store a model just as pickel and use knime as interface for some python models. Here are examples from several versions of knime and python: There are other frameworks you could use. Knime started to generic…

---

<div class="post-metadata">

**Author:** ![ParkJunYong](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/p/e36b37/32.png) [@ParkJunYong](https://forum.knime.com/u/ParkJunYong)\
**Post date:** [July 17, 2024, 7:34am UTC](https://forum.knime.com/t/can-i-transform-ml-model-learned-on-knime-to-pkl-file/81144/3 "2024-07-17T07:34:32Z")

</div>

Thank you for advice. I confirmed that I can save model to MOJO when I use h2o for ML.  
And, I want to make sure that I can’t transform PMML to pickle right now. Is it right?

---

<div class="post-metadata">

**Author:** ![mlauber71](https://forum-cdn.knime.com/user_avatar/forum.knime.com/mlauber71/32/73590_2.png) [@mlauber71](https://forum.knime.com/u/mlauber71)\
**Post date:** [July 17, 2024, 8:03am UTC](https://forum.knime.com/t/can-i-transform-ml-model-learned-on-knime-to-pkl-file/81144/4 "2024-07-17T08:03:32Z")

</div>

> [@ParkJunYong](#):
>
> transform PMML to pickle right now. Is it right?

[PMML](https://en.wikipedia.org/wiki/Predictive_Model_Markup_Language) is a standard format of its own. [Pickle](https://docs.python.org/3/library/pickle.html) is not a specific format for models but a sort of general storage option for Python objects (including models). So you can use it to bring all sorts of data and objects to (another) Python instance which sometime sometimes also might be a security concern, since often virus scanners are not able to look into the structure. So only use this if you trust the source.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [October 15, 2024, 8:04am UTC](https://forum.knime.com/t/can-i-transform-ml-model-learned-on-knime-to-pkl-file/81144/5 "2024-10-15T08:04:01Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
