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 7705989
In Process

The Archive Base Latest Questions

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

I’m looking for an elegant and efficient way to represent and store an arbitrary

  • 0

I’m looking for an elegant and efficient way to represent and store an arbitrary probability distribution constructed by explicit sampling.

The distribution is expected to have the following properties:

  • Samples are floating point values, but in principle can be thought to have resolution down to .001
  • Samples are drawn from an interval [-4000; 4000]
  • However, for any two samples a, b, |a - b| < 40
  • 90% of the time, it will have a sharp peak or several sharp peaks close to each other
  • 10% of the time, it will have a peak with an uneven plateau of width 0.5 to 5.

The usual representation — a histogram array — is undesirable mainly because of the trade-off between quantization/resolution and space. I imagine there must be a method of representation that adaptively varies the bin size depending on local “complexity”.

Space is of concern, because a higher-level grid-like data structure will contain thousands of cells, each containing at least one such probability representation. Easy serialization for disk or network transfer is desirable, but efficiency is not a priority.

Any help would be appreciated.

  • 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-01T00:00:10+00:00Added an answer on June 1, 2026 at 12:00 am

    Interesting problem. Here is a suggestion, which may be quite difficult do implement depending on how much mathematically inclined you are.

    Note that I trade space for speed, since what I suggest is likely to be quite heavy computationally (but this is to be tested against real data).

    First, use a functional approach. A probability distribution is a probability measure:

    struct Distribution
    {
        virtual ~Distribution() {};
        virtual double integrate(std::function<double(double)>) = 0;
    };
    

    This way, you abstract away from the samples that you produce, since you do not want to store them. Convince yourself that you can do pretty much anything with an “integrate” method.

    Of course, with the explicit samples, you do something like

    struct SampledDistribution
    {
        double integrate(std::function<double(double)> f)
        {
            double acc = 0;
            for (double x: samples) acc += f(samples);
            return acc / samples.size();
        }
    
        std::deque<double> samples;
    };
    

    Now, the storage part:

    The usual representation — a histogram array — is undesirable mainly
    because of the trade-off between quantization/resolution and space. I
    imagine there must be a method of representation that adaptively
    varies the bin size depending on local “complexity”.

    The traditional method is wavelets. You produce coefficients with calls to integrate, which you can serialize. You throw coefficients away if the variance of the integral estimator they produce is high.

    Then, to deserialize, you produce a Distribution object whose integrate method performs the integration against the wavelets. Integration can be performed with your favorite quadrature method. I stay deliberately vague here because the actual implementation depends on the wavelet family you choose (smooth, compactly supported, orthogonal or not, etc). You will need to dive into the litterature for details anyway.

    The point here is that you usually need only very few wavelets to represent a smooth function with few features (say a few peaks, and regularly shaped otherwise), unlike more “regular” finite elements (histograms are a particular kind of finite elements representation). The wavelet representation adapts itself to the features of the transformee, whatever their location or size. You can moreover decide how many coefficients to keep, and hence control the compression ratio.

    Also, the 0.001 figure is quite high a number: I suspect you’ll need only a handful of coefficients

    The tradeoff lies in which wavelet class you use: very smooth distributions will likely be well represented with smooth wavelets, but compactly supported wavelets may be easier to integrate against, etc. Experiment. Note that you don’t need “wavelet transform” packages here: only the explicit representation of wavelet functions, and quadrature routines (try Gauss-XXX procedures for reconstruction, or something high order).

    I’d favor wavelets which are defined in the Fourier domain (like Lemarie wavelets), since their value and derivatives at zero in Fourier space is known, this allows you to enforce the contraints on the distributions: probability measures must integrate to one, and you may happen to know the expected value or variance beforehand.

    Also, you may want to change variables to only deal with functions eg. on [0,1]. There is a copious litterature on wavelets on the interval.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from

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.