Skip to content

Save Model from GUI and use it in PythonΒ #5894

@jonathanhoss

Description

@jonathanhoss

Hello,
I want to save a model which is trained in the GUI and load it afterwards in Python to deploy it as a microservice.
I saved the model as .pkcls File and loaded it into Python. When I try to run the predict function, it gets an ValueError.
How can I access the preprocessing processes that is done in the GUI?
And How do I integrate the preprocessing in my python-script?

import pickle
import Orange
import numpy as np

with open('naive-bayers.pkcls', 'rb') as f:
    mp = pickle.load(f)
    
print(mp)

arguments = np.array([521, 24, 'female', 2, 'own', 'little','little', 3190, 18, 'radio/TV']).reshape(1, -1)

print(arguments)
>>> [['521' '24' 'female' '2' 'own' 'little' 'little' '3190' '18' 'radio/TV']]

print(mp.predict(arguments))
>>> ValueError: Unable to convert array of bytes/strings into decimal numbers with dtype='numeric'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions