nok / sklearn-porter

Transpile trained scikit-learn estimators to C, Java, JavaScript and others.
BSD 3-Clause "New" or "Revised" License
1.28k stars 170 forks source link

A bug : When the version of sklearn contains character sequences like "rc1, rc2", the Porter class cannot be created. #67

Open earlsuke opened 4 years ago

earlsuke commented 4 years ago

Hello, thanks for maintaining this library. I found a bug related with sklearn's version string. When the version of sklearn contains character sequences like "rc1, rc2", the ValueError blocks to generate the Porter class. So, I fixed it and will send you a PR. Please, review it.

benjaminhkaiser commented 4 years ago

To anyone else encountering this issue in the meantime (before a patch is pushed), just override the __version__ attribute of sklearn to drop the character sequences.

I'm using version 0.22.2.post1, so before I create a Porter, I include:

import sklearn   
sklearn.__version__ = "0.22.2"