From: "Mauricio Fernández" Date: 2003-04-20T16:05:25+09:00 Subject: Re: Biased weighted random? On Sat, Apr 19, 2003 at 05:33:39AM +0900, Chris Pine wrote: [...] > targets = normalize([2,1,1]) > weights = targets.dup > probs = realProbVector(weights) > > 50.times do > weights.each_with_index do |x,idx| > weights[idx] += targets[idx] - probs[idx] > end > weights = normalize(weights) > probs = realProbVector(weights) > end I have been thinking about this for a while and even though I understand the subjacent idea, I am not sure this is guaranteed to work at all. I have the feeling the problem cannot be solved generally with just the weights vector (which generate a single transition matrix according to the algorithm in realProbVector), and I would expect some cases to be solvable only with the whole transition matrix (*). Cannot really prove the latter, but it is obvious that this way (weights only) we're giving away several degrees of freedom that could come handy later :) (*) One would expect in such cases that the weights never converge or directly diverge to huge numbers, as Hal experienced. But I don't think I can actually prove that the family of solutions generated w/ a transition matrix is bigger than that w/ only the weights, unless I find one example :-) -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Windows without the X is like making love without a partner. -- MaDsen Wikholm, mwikholm@at8.abo.fi