Preparing your model
To import your model and use it in a decision flow, first, you need to dump your trained model.
Let us assume that you have your trained (fitted) model in a variable model.
Now in your favorite python environment import pickle and dump the model as a file.
Example:
import pickle
with open(r'model.pkl' ,'wb') as f:
pickle.dump(model, f)
![](/static/img/import-model1.png)
Once you have the pickle file, it is ready for import.
Technical note:
When preparing your model, expect that Decisimo engine will be using this code to run your model:
prediction = model.predict_proba(data)
prediction = prediction.tolist()
return jsonify(prediction)
The data will be passed by the engine as an array of fields that you define – in the right order.
The return will be subsequently passed into the output, and you can use the results of your model in the next steps of your decision flow.
Importing your model
Decisimo will show you for import a screen where you need to define a few things – what python version you are using and which libraries shall be imported.
Next are input variables that will be passed for prediction. Specify them in the order that your model expects them and correctly define data types of the variables your model expects. If the data types do not match, the result will end in failure.
Next, define from which fields within a data object shall be used for your variables. During execution, those values will be converted to predefined data types and then passed to your model for prediction.
![](/static/img/import-model2.png)
Once you hit “save model”, the system will start preparing the environment for it. It may take a minute for it to be finished and ready for use.
![](/static/img/import-model3.png)
![](/static/img/import-model4.png)
Once the model is ready to use, you can test it by passing testing values and seeing whether the model works as expected.
![](/static/img/import-model5.png)