All Questions
Tagged with distributions performance-tuning
32 questions
0
votes
0
answers
106
views
Optimizing a While Loop for High-Precision Computation in Mathematica
Edit: Clarifying the Core Issue
i=x;
While[Abs[p1 - p2] >= p1 tol,
p2 = p1;
p1 += s *= i (mkn + i)/((k1 - i) (n1 - i));
i--;
];
The core of my ...
2
votes
1
answer
123
views
Fastest way to approximate CDF in Mathematica
I need a very fast way to approximate the CDF of HypergeometricDistribution in Mathematica.
I need to evaluate it for very large ...
2
votes
0
answers
137
views
Insights on using the HypergeometricDistribution functions in Mathematica
I'm trying to calculate the upper confidence interval for the hypergeometric distribution in mathematica and I came up with this very simple code.
...
4
votes
1
answer
121
views
Best way to implement the "plus-distribution" for very long expressions?
I'm at my wits end here. Is there an efficient way to implement the following distribution into MMA:
$$\int_0^y dx \frac{f(x)-f(y)}{y-x}$$
where $f/1-x$ can be analytically integrated. The difficulty ...
0
votes
0
answers
31
views
SmoothKernelDistribution only uses 1 core
I have a huge amount of datasets, each containing many elements, and trying to convert it to PDF using SmoothKernelDistribution. I see that applying it to 1 dataset ...
4
votes
1
answer
235
views
How to quickly sample points from the given PDF data?
Consider some data (distr.dat). It is a tabulated PDF: x, y, z, PDF[x,y,z], where x is some parameter (and the integral of ...
1
vote
2
answers
133
views
What is the best (fastest and accurate) way to obtain PDF from the given dataset?
Consider some list of two coordinates, points, generated by some arbitrary function function1 (which is a pdf up to a ...
0
votes
0
answers
38
views
Slow SmoothKernelDistribution of WeightedData
Consider some data in the form
data = {{x,y,weight(x,y)},...};
I make
wd = WeightedData[data[[All,{1,2}]],data[[All,3]]];
I ...
4
votes
1
answer
74
views
Speeding up RandomVariate with custom probability distribution
I have the defined a custom distribution, which is a Gaussian where the exponent can be any real n greater than 0 (set to actually be >0.5 in use), i.e.
...
0
votes
1
answer
94
views
How to generate random value under the given distribution fast?
Consider a distribution
distr[EN_, Enu_, mN_] =
Exp[-(Sqrt[EN^2 + mN^2]/Enu)]*Sqrt[(Sqrt[Enu^2-mN^2]/2)^2 - EN^2] Sqrt[
EN^4 - (Enu/4)^4]
where mN is a free ...
5
votes
4
answers
274
views
Solving equation over TruncatedDistribution (FindRoot)
I'm trying to solve the following equation :
...
4
votes
1
answer
179
views
Determining Mean Path Length
I'm interested in working out the average path length in a square. Assume at a single point within the square, photons are released in every direction. I'm interested in determining the average path ...
1
vote
0
answers
41
views
Speed up exact distribution of the sum of the top $k$ statistics on a bounded discrete uniform distribution?
I came across a nice answer by Sasha (I believe a Wolfram engineer) on mathematics stack exchange regarding the distribution of the sum of the top $k$ order statistics. (This was an answer to an RPG ...
-1
votes
1
answer
138
views
How to improve `FindDistribution`? [closed]
Table[{n, FindDistribution[RandomSample[
Join @@ Table[ConstantArray[k, Binomial[n, k]], {k, 0, n}]
], TargetFunctions -> "Discrete"]}, {n, 15}] // TableForm
...
1
vote
0
answers
53
views
Can LearnDistribution Train and Generate Images Without Defaulting To 256x256?
In spite of anything I try it seems the ConformImages[] function nested in the LearnDistribution[] function resizes images to 256x256.
If I convert an image into its "Data" representation before ...
3
votes
3
answers
133
views
Efficient function for life duration probability?
Sent to me by a colleague asking me for assistance (the function as is breaks):
...
0
votes
2
answers
105
views
How to speed up this calculation regarding the normal distribution?
This calculation takes a very long time!
Why?
How can I improve it?
Thanks!
...
3
votes
1
answer
106
views
How can Distribution fitting be sped up?
The first line generates 1050 data points to fit. The second line fits this data to the same distribution. This takes about 100ms on my computer. Doing this with ...
7
votes
2
answers
2k
views
Can this code be changed to run faster?
I've worked for several days trying to get this code to run faster. The imported data is 15MB.
...
1
vote
0
answers
60
views
Why is this parallel notebook not maxing out the available memory and processors?
I've searched many questions about parallel processing here, and they are either specialized or over my head. I run the following parallel notebook on an 8 core EC2 instance. The average memory usage ...
4
votes
0
answers
76
views
Why is ProbabilityDistribution 100x slower than ExtremeValueDistribution?
The two distributions are the same, except the ProbabilityDistribution cuts out below x=0. The wolfram documentation on ProbabilityDistribution says nothing about speed. A search of this site gave no ...
3
votes
2
answers
90
views
Fix a vertex at a known location in SpatialGraphDistribution
I can very quickly generate random geometric graphs with
...
3
votes
1
answer
390
views
Sampling a Dirichlet Distribution efficiently
I'm sampling a DirichletDistribution like so:
...
3
votes
2
answers
222
views
Fast way to evaluate the PDF of a multivariable distribution
I'm trying to evaluate the PDF of a truncated multi-normal distribution.
My distribution has 8 dimensions and each value must be ≥ 0.
...
4
votes
1
answer
258
views
Performance of a bootstrap - time of computation not linear with number of iterations
I'm doing a bootstrap based on this thread with the following code (file.txt here):
...
2
votes
0
answers
115
views
Optimization of custom probability distibutions?
Consider the two tests:
Timing[Do[RandomVariate[NormalDistribution[0.5, 0.3]], {200}]]
{0.001188, Null}
...
7
votes
1
answer
583
views
How to get probabilities for multinomial & hypergeometric distribution ranges more quickly?
I often need to calculate the probability of a result from a multinomial distribution falling within some range, e.g., the maximum of the categories having an upper bound, or a lower bound for the ...
2
votes
2
answers
392
views
Performance in calculating maximum-likelihood- based estimates
My probability density function is a complicated one for which numerical estimation is necessary. Here my pdf:
...
1
vote
0
answers
155
views
18
votes
1
answer
2k
views
Speed up adding Poisson noise to an image
I'm simulating some images corrupted with Poisson noise, but I'm encountering a few problems with performance. According to the documentation on ImageEffect, one ...
4
votes
1
answer
182
views
Example from Mathematica documentation (ExtremeValueDistribution) seems to be evaluating "forever"
Bug introduced in 9.0.1 or earlier and persisting through 11.0.1 or later
I am referring to this example at the reference page for the extreme value distribution: http://reference.wolfram.com/...
22
votes
2
answers
2k
views
Efficient Generation of Random Variates from a Copula Distribution
I have a 7-asset portfolio for which I want to simulate daily log-deltas using a Student T copula. The marginal distributions are all either Stable or TsallisQGaussian. Using NMaximize, I have ...