javascriptdata / scikit.js

JavaScript package for predictive data analysis and machine learning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

save and load

1093919186 opened this issue · comments

Hi,

How do you save and then re-open a trained network?
It doesn't seem to be explained anywhere in the doc.

Thanks.

Hi @1093919186. ScikitJS does not have implemented neural network, I guess.

For saving and loading a trained "transformer" you can use toJson() and fromJson() methods.

`
// Initialize One-Hot-Encoder (whatever)
let OHE = new scikitjs.OneHotEncoder();

// Fit stage
OHE.fit(yourData);

// Save
let savedOHE = OHE.toJson()

// ...
// Your amazing code
// ...

// Load stage
// First initialize a new OHE
let newOHE = new scikitjs.OneHotEncoder();

// Then use .fromJson() method
newOHE = newOHE.fromJson(savedOHE);
`

Hi Alvgoro, I’m grateful for your sharing. By learning the source code, I have found this implementation method. There is another issue here issue, do you have a solution?
Thanks again.