You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to run Porter to transform my RandomForestClassifier to JavaScript. I ran into an unexpected "error invalid literal for int() with base 10: 'post1'". Then I thought, let's try the demo from the README of sklearn-porter. The result remained the same. Can anyone tell me if this is a mistake by sklearn-porter or where my real problem might lie?
/opt/conda/lib/python3.7/site-packages/sklearn_porter/Porter.py in init(self, estimator, language, method, **kwargs)
59 from sklearn import version as sklearn_ver
60 sklearn_ver = str(sklearn_ver).split('.')
---> 61 sklearn_ver = [int(v) for v in sklearn_ver]
62 major, minor = sklearn_ver[0], sklearn_ver[1]
63 patch = sklearn_ver[2] if len(sklearn_ver) >= 3 else 0
/opt/conda/lib/python3.7/site-packages/sklearn_porter/Porter.py in (.0)
59 from sklearn import version as sklearn_ver
60 sklearn_ver = str(sklearn_ver).split('.')
---> 61 sklearn_ver = [int(v) for v in sklearn_ver]
62 major, minor = sklearn_ver[0], sklearn_ver[1]
63 patch = sklearn_ver[2] if len(sklearn_ver) >= 3 else 0
ValueError: invalid literal for int() with base 10: 'post1'
Demo Code
from sklearn.datasets import load_iris
from sklearn.tree import tree
from sklearn_porter import Porter
Hello,
I tried to run Porter to transform my RandomForestClassifier to JavaScript. I ran into an unexpected "error invalid literal for int() with base 10: 'post1'". Then I thought, let's try the demo from the README of sklearn-porter. The result remained the same. Can anyone tell me if this is a mistake by sklearn-porter or where my real problem might lie?
Error Message
ValueError Traceback (most recent call last)
in
10
11 # Export:
---> 12 porter = Porter(clf, language='java')
13 output = porter.export(embed_data=True)
14 print(output)
/opt/conda/lib/python3.7/site-packages/sklearn_porter/Porter.py in init(self, estimator, language, method, **kwargs)
59 from sklearn import version as sklearn_ver
60 sklearn_ver = str(sklearn_ver).split('.')
---> 61 sklearn_ver = [int(v) for v in sklearn_ver]
62 major, minor = sklearn_ver[0], sklearn_ver[1]
63 patch = sklearn_ver[2] if len(sklearn_ver) >= 3 else 0
/opt/conda/lib/python3.7/site-packages/sklearn_porter/Porter.py in (.0)
59 from sklearn import version as sklearn_ver
60 sklearn_ver = str(sklearn_ver).split('.')
---> 61 sklearn_ver = [int(v) for v in sklearn_ver]
62 major, minor = sklearn_ver[0], sklearn_ver[1]
63 patch = sklearn_ver[2] if len(sklearn_ver) >= 3 else 0
ValueError: invalid literal for int() with base 10: 'post1'
Demo Code
from sklearn.datasets import load_iris
from sklearn.tree import tree
from sklearn_porter import Porter
Load data and train the classifier:
samples = load_iris()
X, y = samples.data, samples.target
clf = tree.DecisionTreeClassifier()
clf.fit(X, y)
Export:
porter = Porter(clf, language='java')
output = porter.export(embed_data=True)
print(output)
The text was updated successfully, but these errors were encountered: