https://github.com/nicolaspanel/node-svm with small changes