Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use port or save functions #89

Open
GMSL1706 opened this issue Jun 9, 2022 · 3 comments
Open

Can't use port or save functions #89

GMSL1706 opened this issue Jun 9, 2022 · 3 comments

Comments

@GMSL1706
Copy link

GMSL1706 commented Jun 9, 2022

Here are my versions :
The scikit-learn 0.21.3
Python 3.7.13

And here is my code. I used the same example as in the notebook.

# 1. Load data and train a dummy classifier:
X, y = load_iris(return_X_y=True)
clf = tree.DecisionTreeClassifier()
clf.fit(X, y)

I tried this code:

# 2. Port or transpile an estimator:
est = Estimator(clf, language='java', template='combined')
output = est.port()
print(output)

This is my error:

---------------------------------------------------------------------------
TemplateNotFound                          Traceback (most recent call last)
[<ipython-input-38-6d9e6b3013b2>](https://localhost:8080/#) in <module>()
      1 # 2. Port or transpile an estimator:
      2 est = Estimator(clf, language='java', template='combined')
----> 3 output = est.port()
      4 print(output)

5 frames
[/usr/local/lib/python3.7/dist-packages/jinja2/loaders.py](https://localhost:8080/#) in get_source(self, environment, template)
    305             source = self.mapping[template]
    306             return source, None, lambda: source == self.mapping.get(template)
--> 307         raise TemplateNotFound(template)
    308 
    309     def list_templates(self):

TemplateNotFound: combined.class

Can someone help me ?

@nok
Copy link
Owner

nok commented Jun 12, 2022

Hello @GMSL1706 ,

which version of sklearn-porter did you install?

The notebook uses the latest state on the main branch which isn't released yet. So, can you please upgrade the package?

pip install https://github.com/nok/sklearn-porter/zipball/main

Kind regards,
Darius

@GMSL1706
Copy link
Author

Hi Darius,

I used this code pip install https://github.com/nok/sklearn-porter/zipball/main to install sklearn-porter but it looks like it was not installed correctly. See below (I used google colab):

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
yellowbrick 1.4 requires scikit-learn>=1.0.0, but you have scikit-learn 0.21.3 which is incompatible.
imbalanced-learn 0.8.1 requires scikit-learn>=0.24, but you have scikit-learn 0.21.3 which is incompatible.
Successfully installed loguru-0.6.0 scikit-learn-0.21.3 sklearn-porter-1.0.0

Help!

@vladBaciu
Copy link

Seems that I have the same issue with version 1.0.0 and sklearn version 0.21.0. Did you find any solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants