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 a model be saved? #16

Closed
paulbrie opened this issue Nov 11, 2019 · 2 comments
Closed

Can a model be saved? #16

paulbrie opened this issue Nov 11, 2019 · 2 comments

Comments

@paulbrie
Copy link

Hi guys! Really cool work!!!

A question: can a model be saved and stored/serialized in a file for later usage?

Thanks,
Paul

@targos
Copy link
Member

targos commented Nov 11, 2019

Hello! Yes, a model should be serializable to JSON:

const classifier = new RandomForestClassifier(options);
classifier.train(trainingSet, predictions);
const serialized = JSON.stringify(classifier);

// later, in another process
const classifier = RandomForestClassifier.load(JSON.parse(serialized));
const result = classifier.predict(data);

@creativesites
Copy link

// later, in another process
const classifier = RandomForestClassifier.load(JSON.parse(serialized));
const result = classifier.predict(data);

Awesome work guys. Thank you!

@targos targos closed this as completed Jan 29, 2021
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