Generating 60 random samples that sum to 1, each subject to a unique lower and upper limit
2 ビュー (過去 30 日間)
古いコメントを表示
0
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.
2 件のコメント
Jan
2023 年 1 月 19 日
"I should note that the samples generated does not have to be perfectly uniform" - of course, otherwise they could not have a fixed sum.
Bruno Luong
2023 年 1 月 19 日
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.
採用された回答
RaFa
2023 年 9 月 8 日
編集済み: RaFa
2023 年 9 月 8 日
1 件のコメント
Bruno Luong
2023 年 9 月 8 日
But this way of generation does not give uniform distribution and does not work for general case.
This would work for only versy specfic case of the configuration you describe.
So this meets your need, but does not really asnwer the question you asked in January.
その他の回答 (1 件)
Jan
2023 年 1 月 19 日
Isn't this a job for: https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum ?
% [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.
3 件のコメント
Jan
2023 年 1 月 19 日
@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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!