我正在尝试使用 javascript 中的神经网络来预测一些数据。为此,我发现convnetjs似乎很容易使用。
在示例中,他们使用了一种称为 MagicNet 的东西,因此您无需了解 NN 即可使用它。这是使用示例:
// toy data: two data points, one of class 0 and other of class 1
var train_data = [new convnetjs.Vol([1.3, 0.5]), new convnetjs.Vol([0.1, 0.7])];
var train_labels = [0, 1];
// create a magic net
var magicNet = new convnetjs.MagicNet(train_data, train_labels);
magicNet.onFinishBatch(finishedBatch); // set a callback a finished evaluation of a batch of networks
// start training MagicNet. Every call trains all candidates in current batch on one example
setInterval(function(){ magicNet.step() }, 0});
// once at least one batch of candidates is evaluated on all folds we can do prediction!
function finishedBatch() {
// prediction example. xout is Vol of scores
// there is also predict_soft(), which returns the full score volume for all labels
var some_test_vol = new convnetjs.Vol([0.1, 0.2]);
var predicted_label = magicNet.predict(some_test_vol);
}
我不明白的是:他们创建训练数据[new convnetjs.Vol([1.3, 0.5]), new convnetjs.Vol([0.1, 0.7])]
,然后使用 2 个标签。这些标签是数组的每个位置还是这些位置的子数组的每个元素一个?
这是一个视觉示例:
是像[new 0, new 1]
还是像[new convnetjs.Vol([0, 1]), new convnetjs.Vol([0, 1])]
?