var x = [[0.4, 0.5, 0.5, 0., 0., 0.], [0.5, 0.3, 0.5, 0., 0., 0.01], [0.4, 0.8, 0.5, 0., 0.1, 0.2], [1.4, 0.5, 0.5, 0., 0., 0.], [1.5, 0.3, 0.5, 0., 0., 0.], [0., 0.9, 1.5, 0., 0., 0.], [0., 0.7, 1.5, 0., 0., 0.], [0.5, 0.1, 0.9, 0., -1.8, 0.], [0.8, 0.8, 0.5, 0., 0., 0.], [0., 0.9, 0.5, 0.3, 0.5, 0.2], [0., 0., 0.5, 0.4, 0.5, 0.], [0., 0., 0.5, 0.5, 0.5, 0.], [0.3, 0.6, 0.7, 1.7, 1.3, -0.7], [0., 0., 0.5, 0.3, 0.5, 0.2], [0., 0., 0.5, 0.4, 0.5, 0.1], [0., 0., 0.5, 0.5, 0.5, 0.01], [0.2, 0.01, 0.5, 0., 0., 0.9], [0., 0., 0.5, 0.3, 0.5, -2.3], [0., 0., 0.5, 0.4, 0.5, 4], [0., 0., 0.5, 0.5, 0.5, -2]]; // Only binary classification here: Feature Y=-1->false, 1->true var y = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,1,1]; var model = ml.learn({ algorithm : ml.ML.SVM, x : x, y : y, C : 1, // default : 1.0. C in SVM. tol : 1e-4, // default : 1e-4. Higher tolerance --> Higher precision max_passes : 200, // default : 20. Higher max_passes --> Higher precision alpha_tol : 1e-5, // default : 1e-5. Higher alpha_tolerance --> Higher precision //kernel : { type: "polynomial", c: 1, d: 5} kernel : { type: "rbf", sigma:0.5 } }); print(toJSON(model).length+' Bytes') // print(model) a = [ [1.3, 1.7, 0.5, 0.5, 1.5, 0.4], [0.05, 0.1, 0.5, 0.7, 0.4, -1.4] ] print(ml.classify(model,x)); print(ml.classify(model,a));