I am new when it comes to neural networks. I fought ruby-fann and ai4r all day, and, unfortunately, I have nothing to show this, so I thought that I would come to Qaru and ask knowledgeable people.
I have a set of samples - every day has one data point, but they do not match the clear pattern that I could figure out (I tried a couple of regressions). However, I think it would be neat to see if there is any way to predict data going to the future only from a date, and I thought a neural network would be a good way to generate a function that could hope to express this connection.
Dates are DateTime objects, and data points are decimal numbers, such as 7.68. I converted DateTime objects to float, and then dividing by 10,000,000,000 to get a number from 0 to 1, and I divided the decimal numbers by 1000 to get a number from 0 to 1. I have over a thousand samples ... here's how Short exposure looks like:
[ ["2012-03-15", "7.68"], ["2012-03-14", "4.221"], ["2012-03-13", "12.212"], ["2012-03-12", "42.1"] ]
What the conversion looks like:
[ [0.13317696, 0.000768], [0.13316832, 0.0004221], [0.13315968, 0.0012212], [0.13315104, 0.00421] ]
I would like this transformation not to be necessary, but I'm distracted. The problem is that both ai4r and ruby-fann return a single constant number, usually something in the middle of the range of patterns when I run them. Here is the code for ruby-fann:
@fann = RubyFann::Standard.new(:num_inputs=>1, :hidden_neurons=>[3, 3], :num_outputs=>1) training_data = RubyFann::TrainData.new(:inputs => formatted_data.collect{|d| [d.first]}, :desired_outputs => formatted_data.collect{|d| [d.last]}) @fann.train_on_data(training_data, 1000, 1, 0.0001) @fann.run([DateTime.now.to_f / 10000000000.0])
And for ai4r:
@ai4r = Ai4r::NeuralNetwork::Backpropagation.new([1, 3, 3, 1]) 1000.times do formatted_data.each do |data| @ai4r.train(data.first, data.last) end end @ai4r.eval([DateTime.now.to_f / 10000000000.0])
I feel like I'm missing something really basic here. I know this is a rather open-ended question, but if anyone can help me figure out how I am teaching my neural networks incorrectly, I would really appreciate it!