[Tutor] Weighted Random numbers
Wesley J. Chun
Sat, 12 Feb 2000 15:44:00 -0800 (PST)
> Date: Sat, 12 Feb 2000 15:40:43 -0700
> From: Bill Anderson <firstname.lastname@example.org>
> (x-posted to comp.lang.python in the hopes of reaching a wider audience
> [esp re: NumPY]... hope nobody minds)
nah... they're Python-people! ;-)
> "Wesley J. Chun" wrote:
> > > Date: Fri, 11 Feb 2000 18:19:54 -0700
> > > From: Bill Anderson <email@example.com>
> > >
> > > I am working on a bannerad system in Python... I have most of
> > > it functional, but I need to be able to weight certain selections
> > the best way to do this is to choose from a weighted
> > list of 1 to 100 say, with each number representing a
> > percentage or proportion of the time an ad should be
> > chosen. each ad would get a "range" based on the %age
> > of the time it should show. the "odds" of all the
> > individual ads summed together should be 100.
> > for example, a heavily weight ad (from BigBucksAdAgency)
> > may get 50% and be given the segment from 1-50. another
> > ad, not as prominent may get 25%, so it gets 51-75. a
> > 3rd and 4th ad get 10% each, so 76-85, and 86-95, re-
> > spectively, and the 5th and final ad gets 5%, 96-100.
> That's a lot like what I was thinking. I as considering building a list
> of banners, with the weight being the number of times the ad was in the
> list. Then using whrandom, I'd select one.
> The only issue I see so far with the percentage method, is that it makes
> management more of a headache. In order to set weights, I would need a
> master page with all the banners, their weight percentage, and the
i think a separate thingy called an adserver would work best.
the adserver keeps inventory and manages all the ads, the
pages they should'can appear on, their weights, etc. don't
let your webserver handle this logic... it should just make
a single call to the adserver to get the ad and that's it;
the processing power should all go to Apache and your users.
> Hmmm ... some random unweighted-thoughts ...
> I think the difference in these two methods are in the type of
> In my method, the weight is against a non-weighted ad, that is, an ad
> with weight 1. An ad with weight 5 is 5x more likely to be seen than a
> standard ad. In your method, the weight is relative to the other ads. An
> ad with weight 5 will be seen 5% of the time. The difference is sublt,
> but important, IMHO.
i agree. again, this is just the first idea that popped out.
i'm sure some college professors and their minions are already
working on adservering algorithms by now!! (this is, of course
in addition to all the methods that have been used by traditional
media for the last XXX years.)
cyberweb.consulting :: silicon.valley, ca