scikit-learn-ts icon indicating copy to clipboard operation
scikit-learn-ts copied to clipboard

Fit persistence

Open glutamate opened this issue 1 year ago • 0 comments

Hi, this project looks incredible. Every time I compare sklearn with JS ML libraries, the python equivalents are much faster and more robust. I am looking to integrate sklearn with Saltcorn, an open-source no-code builder I wrote.

Is there a way to persist model fits? in python i can pickle a fit, save to database or file, and pickle.loads when it is time to make a prediction. Example:

# fit
clf = Pipeline(steps=[('preprocessor', ...),
                      ('classifier', LinearRegression())])

clf.fit(df_x, df_y)

str1=pickle.dumps(clf)

# load and predict
clf2 = pickle.loads(str1)
pred=clf2.predict(pandas.DataFrame.from_dict(...))

Is there a way to get the underlying python object as a blob or as JSON ? and to construct the JS object again?

glutamate avatar May 02 '23 16:05 glutamate