Closed JiayiHong closed 2 years ago
I will answer here about libsvm. Please open another issue in the OPLS repo for your second question: https://github.com/mljs/pls
With libsvm, models are stored by using svm.serializeModel()
and reloaded with SVM.load(serializedModel)
Please refer to the repo Readme which has some documentation
Thank you so much for your help! svm.serializeModel()
works well!
Hello!
I am wondering whether I could save and load a libsvm model with nodeJS? I have trained a libsvm model online:
let svm = new SVM(options); svm.train(trainingSet, targetSet);
I could see that from the svm that only few properties exist:"{\"options\":{\"kernel\":\"1\",\"degree\":3},\"model\":....,\"problem\":...}"
I tried to save the model into a json file and load the model from it so that every user could access the model. However, since I only stored the svm model:const model = JSON.stringify(svm); exportJsonFile("svm", model);
When I load the model, I cannot do the prediction because libsvm cannot detect the model.Also, I tried to load OPLS model with
PLS.OPLS.load(obj)
but it has an error like below:OPLS.js:355 Uncaught (in promise) TypeError: model.wOrth.transpose is not a function in OPLS.js:355
.Could you please give me some instructions about how to achieve this? Thanks in advance!