creating histogram with ~280,000+ floats

This is a discussion on creating histogram with ~280,000+ floats within the C Programming forums, part of the General Programming Boards category; I need to create a histogram of an image (512x512) of floating point numbers, then find the most recurring number ...

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    13

    creating histogram with ~280,000+ floats

    I need to create a histogram of an image (512x512) of floating point numbers, then find the most recurring number or range in this case. I was wondering if there was a better way than trial and error for picking the number of bins for separating the values into i.e. my original idea was using 1/8 the original number of bins to separate into. If I do the before mention, I'm wondering if maybe I have too many bins or not enough.

    Thoughts?
    Thanks in advance

  2. #2
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    The optimal bin size will really depend on the data you are analyzing and what you want to get out of it. Like they say, "98% of statistics are made up on the spot". There are many methods out there for selection of bin size, try google.

    Once you figure out which method you want to use I am sure everyone here will be happy to help you with any code that you posted.

    P.S. Another option might be to actually read the textbook you got assigned for your class.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,305
    I've created histogram displays for data in both PC and embedded software. We decided that the histogram tends to be most useful when there are between 8 and 15 columns. So what I do is have a fixed set of possible bar widths (1, 2, 5, 10, 20, 25, 50 etc) and then calculate the range (max-min), then pick the lowest value from the table that would give you no more than 15 bars. If the range is 134 for example, it would pick a bar width of 10, and the bars would start at multiples of 10 as well.

    However if you're really after the mode and aren't displaying a histogram, then you just need a bin for each value and find the bin with the most in it afterwards.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  4. #4
    Registered User
    Join Date
    Oct 2010
    Posts
    13
    Quote Originally Posted by AndrewHunter View Post
    The optimal bin size will really depend on the data you are analyzing and what you want to get out of it. Like they say, "98% of statistics are made up on the spot". There are many methods out there for selection of bin size, try google.

    Once you figure out which method you want to use I am sure everyone here will be happy to help you with any code that you posted.

    P.S. Another option might be to actually read the textbook you got assigned for your class.
    I shall refer to the Google search results.

    P.S. This isn't for a class.

    Quote Originally Posted by iMalc View Post
    However if you're really after the mode and aren't displaying a histogram, then you just need a bin for each value and find the bin with the most in it afterwards.
    The values are really small, and I'm not sure the number of unique values are so I would rather stick to filling a bin with a range of values.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Histogram help
    By Fixxxer in forum C Programming
    Replies: 4
    Last Post: 11-12-2010, 01:15 AM
  2. a histogram program
    By makonikor in forum C Programming
    Replies: 33
    Last Post: 04-17-2010, 01:17 AM
  3. histogram
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 04-04-2007, 12:25 PM
  4. Histogram
    By fjf314 in forum C++ Programming
    Replies: 1
    Last Post: 01-15-2004, 10:39 PM
  5. Max & Min value and refine histogram
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 07-20-2002, 08:04 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21