Hello,
I am trying to make a simple classification using SVM with the following snippet:
const SVM = require('ml-svm');
const X = [[-1, -1], [-2, -1], [1, 1], [2, 1]];
const y = [1, 1, 2, 2];
const model = new SVM({
C: 1.0,
tol: 0.0001,
});
model.train(X, y);
model.predict([[-0.8, -1]]);
// => sometimes -1 (wrong), sometimes 1 (correct)
I don't understand why it sometimes predict -1, which is not even an available class...
It happens randomly so I thought it may be related to whether or not the algorithm converged?
I really hope to use this library as it runs in React Native using plain JS (which libsvm doesn't)! :(
Do you know what could be the problem?
Thank you!
Hello,
I am trying to make a simple classification using SVM with the following snippet:
I don't understand why it sometimes predict -1, which is not even an available class...
It happens randomly so I thought it may be related to whether or not the algorithm converged?
I really hope to use this library as it runs in React Native using plain JS (which libsvm doesn't)! :(
Do you know what could be the problem?
Thank you!