Note that there are some explanatory texts on larger screens.

plurals
  1. POpredicting class for new data using neuralnet
    text
    copied!<p>I'm trying to predict the class (0 or 1) for a test dataset using a neural network trained using the neuralnet package in R. </p> <p>The data I have looks as follows:</p> <p>For train:</p> <pre><code>x1 x2 x3 x4 y 0.557 0.6217009 0.4839 0.5606936 0 0.6549 0.6826347 0.4424 0.4117647 1 0.529 0.5744681 0.5017 0.4148148 1 0.6016771 0.5737052 0.3526971 0.3369565 1 0.6353945 0.6445013 0.5404255 0.464 1 0.5735294 0.6440678 0.4385965 0.5698925 1 0.5252 0.5900621 0.4412 0.448 0 0.7258687 0.7022059 0.5347222 0.4498645 1 </code></pre> <p>and more.</p> <p>The test set looks the exact same as the training data, just with different values (if need be I will post some samples).</p> <p>The code I use looks as follows:</p> <pre><code>&gt; library(neuralnet) &gt; nn &lt;- neuralnet(y ~ x1+x2+x3+x4, data=train, hidden=2, err.fct="ce", linear.output=FALSE) &gt; plot(nn) &gt; compute(nn, test) </code></pre> <p>The network trains and I can successfully plot the network, but compute doesn't work. When I run compute it gives me the following error:</p> <pre><code>Error in neurons[[i]] %*% weights[[i]] : non-conformable arguments </code></pre> <p>So basically I'm trying to train a neural network to successfully classify the new test data.</p> <p>Any help is appreciated.</p> <p>Edit:</p> <p>A sampling of the test object is:</p> <pre><code>x1 x2 x3 x4 y 0.5822 0.6591 0.6445013 0.464 1 0.4082 0.5388 0.5384616 0.4615385 0 0.4481 0.5438 0.6072289 0.5400844 1 0.4416 0.5034 0.5576923 0.3757576 1 0.5038 0.6878 0.7380952 0.5784314 1 0.4678 0.5219 0.5609756 0.3636364 1 0.5089 0.5775 0.6183844 0.5462555 1 0.4844 0.7117 0.6875 0.4823529 1 0.4098 0.711 0.6801471 0.4722222 1 </code></pre> <p>I've also tried it with the y column empty of any values.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload