Generating 60 random samples that sum to 1, each subject to a unique lower and upper limit

4 views (last 30 days)
I am looking for a method to generate uniform(ish) random samples for 60 variables that sum to 1, with each variable being subject to a unique lower and upper limit.
On the MATLAB file exchange, I found a algorithm capable of this, called randFixedLinearCombination. However, it is limited to ~20-25 dimensions before the hypercube array size becomes too large.
I should note that the samples generated does not have to be perfectly uniform, as they will be used for generating data for training a machine learning model. If necessary, one possible compromise would be to group the variables into e.g. 6 groups, with each group of 10 variables having the same lower and upper limits. I do not know if this approach would simplify the problem, just a comment.
Bruno Luong
Bruno Luong on 19 Jan 2023
I think 60 dimension is quite hard. randFixedLinearCombination is based on decomposing the convex set in non-overlapping simplex, randfixedsum muts raise to the power the # od dimension some to compute te conditioning probability. Both will have difficulty to handle dimension up to 60.

Sign in to comment.

Answers (1)

Jan on 19 Jan 2023
% [x,v] = randfixedsum(n,m,s,a,b)
% This generates an n by m array x, each of whose m columns
% contains n random values lying in the interval [a,b], but
% subject to the condition that their sum be equal to s.
Jan on 19 Jan 2023
@Bruno Luong, @RaFa: Thanks. I misunderstood "with each variable being subject to a unique lower and upper limit." If all variables have different limits, the tool is not matching. Sorry.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!