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

Reusing instances of MLPClassifier / MLPRegressor #33

Closed jonashoechst closed 5 years ago

jonashoechst commented 6 years ago

Since I had to do more than one classification job at a time I was looking for a way to reuse the the instantiated classes. When wiping double[] network both can simply be reused.

The additions being commutative, I decided to put the bias addition in front of the inner for-loop as a sort of initialization.

Note: This pull request doesn't change the behavior on standalone executions, but enables reusing instances when using the transpiled source files in other projects.

nok commented 5 years ago

Hello @jonashoechst ,

thanks! I checked it out in the branch pr/33, tested and merged the changes to the next patch release release/0.7.3 (https://github.com/nok/sklearn-porter/commit/672e0188b47e3b7624c6b9cba2e66ef3dc9145a1).

Regards, Darius