Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7737825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:06:19+00:00 2026-06-01T08:06:19+00:00

I’m a total beginner when it comes to neural networks. I’ve been wrestling with

  • 0

I’m a total beginner when it comes to neural networks. I’ve been wrestling with ruby-fann and ai4r all day and unfortunately I don’t have anything to show for it, so I figured I would come onto Stack Overflow and ask the knowledgeable people here.

I have a set of samples — each day has one data point, but they don’t fit any clear pattern that I’ve been able to figure out (I tried a couple regressions). Still, I think it would be neat to see if there was any way to predict the data going into the future just from the date, and I thought a neural network would be a good way to generate a function that could hope to express that relationship.

The dates are DateTime objects and the data points are decimal numbers, like 7.68. I’ve been converting the DateTime objects to floats and then dividing by 10,000,000,000 to get a number between 0 and 1, and I’ve been dividing the decimal numbers by 1,000 to also get a number between 0 and 1. I have over a thousand samples… here’s what a short excerpt looks like:

[
  ["2012-03-15", "7.68"],
  ["2012-03-14", "4.221"],
  ["2012-03-13", "12.212"],
  ["2012-03-12", "42.1"]
]

Which when transformed looks like this:

[
  [0.13317696, 0.000768],
  [0.13316832, 0.0004221],
  [0.13315968, 0.0012212],
  [0.13315104, 0.00421]
]

I kind of wish this transformation weren’t necessary, but I digress. The problem is that both ai4r and ruby-fann return one constant number, generally something in the middle of the range of the samples, when I run them. Here’s 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]) # Always something random, and always the same number no matter what date I request it for

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]) # A different result frmo above, but always seemingly random and the same for any requested date

I feel like I’m missing something really basic here. I know this is a rather open-ended question but if anyone could help me figure out how I’m improperly teaching my neural networks, I’d really appreciate it!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:06:20+00:00Added an answer on June 1, 2026 at 8:06 am

    alfa has a good point in his comment, an alternative ways of using the NN might be more appropriate.

    It depends on the problem, but if the day’s value is even partly a function of
    the previous days’ values, treating this as a time series might yield better
    results.

    You would then instead teach the NN to produce the day’s value as a function
    of a window of, say, the previous ten days values; you could also keep the date
    parameter as a real input scale between [0, 1] as you believe it has a significant effect
    on the day’s value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.