Note that there are some explanatory texts on larger screens.

plurals
  1. POHaving trouble understanding neural networks
    text
    copied!<p>I am trying to use a neural network to solve a problem. I learned about them from the Machine Learning course offered on Coursera, and was happy to find that FANN is a Ruby implementation of neural networks, so I didn't have to re-invent the airplane.</p> <p>However, I'm not really understanding why FANN is giving me such strange output. Based on what I learned from the class, </p> <p>I have a set of training data that's results of matches. The player is given a number, their opponent is given a number, and the result is 1 for a win and 0 for a loss. The data is a little noisy because of upsets, but not terribly so. My goal is to find which rating gaps are more prone to upsets - for instance, my intuition tells me that lower-rated matches tend to entail more upsets because the ratings are less accurate.</p> <p>So I got a training set of about 100 examples. Each example is (rating, delta) => 1/0. So it's a classification problem, but not really one that I think lends itself to a logistic regression-type chart, and a neural network seemed more correct.</p> <p>My code begins </p> <pre><code>training_data = RubyFann::TrainData.new(:inputs =&gt; inputs, :desired_outputs =&gt; outputs) </code></pre> <p>I then set up the neural network with</p> <pre><code>network = RubyFann::Standard.new( :num_inputs=&gt;2, :hidden_neurons=&gt;[8, 8, 8, 8], :num_outputs=&gt;1) </code></pre> <p>In the class, I learned that a reasonably default is to have each hidden layer with the same number of units. Since I don't really know how to work this or what I'm doing yet, I went with the default.</p> <pre><code>network.train_on_data(training_data, 1000, 1, 0.15) </code></pre> <p>And then finally, I went through a set of sample input ratings in increments and, at each increment, increased delta until the result switched from being > 0.5 to &lt; 0.5, which I took to be about 0 and about 1, although really they were more like 0.45 and 0.55.</p> <p>When I ran this once, it gave me 0 for every input. I ran it again twice with the same data and got a decreasing trend of negative numbers and an increasing trend of positive numbers, completely opposite predictions.</p> <p>I thought maybe I wasn't including enough features, so I added (<code>rating**2</code> and <code>delta**2</code>). Unfortunately, then I started getting either my starting delta or my maximum delta for every input every time. </p> <p>I don't really understand why I'm getting such divergent results or what Ruby-FANN is telling me, partly because I don't understand the library but also, I suspect, because I just started learning about neural networks and am missing something big and obvious. Do I not have enough training data, do I need to include more features, what is the problem and how can I either fix it or learn how to do things better?</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