From: "Michael Dinowitz" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, May 18, 2004 3:08 PM
Subject: ad weights
> Here's a fun task. I'm building pay per click ads for HoF (in place of
banner
> ads and yes, the list ads are coming off). One thing is that I need to
give each
> ad a weight in relation to another to show how often it should come up.
I've
> thought of a few ideas and wanted to hear what others think.
> Basically, there's a table of ads that's dumped into an application
array for
> caching. The question is, how to dump the ads in order to give 'high
paying' ads
> more show than 'low paying' (or free) ads.
> This is one idea:
> When this table is dumped into an application array, a position in the
array is
> given for each ad for each dollar (or part) it has.
> .01 is 1 position.
> $1 is 1 position.
> $1.01 is 2 positions.
> This is rather simple and works well for small amounts of ads, but when
you get
> a lot, it fails.
> ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104 items. The
big
> paying ad has a greater chance of being seen in relation to any other
ad, but is
> buried under all the low paying ads.
> Another idea is to have sub arrays for each price grouping. In this
example, the
> chances of a $5 text ad coming up is far greater than a $1 ad and if a
$5 comes
> up, then it'll be one of several $5 ads. This may work and I'm building
it now.
> Critique?
You've got two problems. First, how to represent the data so that you can
easily (and quikly) grab an ad according to some weighting scheme.
Secondly, coming up with the weighting scheme itself.
Don't use an approach where you populate an array, list or table with some
number of duplicate records relative to a weighting. This gets kinda
silly. If you had just two ads, for instance, the first of which you want
to come up 100 times as often as the other, you end up with 101 records
that represent just two entities.
Here's one approach: Assuming the weights you store are relative, you
generate two numbers for each ad.
Say you start with the following in your database:
Ad_ID Weight
----- -------
1 75
2 1
3 25
4 10
5 5
Your generated data structure would look like
Ad_ID Range_Beg Range_End
----- --------- ---------
1 1 75
2 76 76
3 77 101
4 102 111
5 112 116
To pull up a random ad according to its weight, generate a random number
between 1 and 116 and see which record "owns" the number. If you stored
the above as a cached query, then you could use a query of a query to grab
one.
SELECT Ad_ID
FROM cached_ad_qry
WHERE #RandRange(1, 116)# BETWEEN Range_Beg AND Range_End
As far as the weighting scheme itself goes...
The biggest question is probably whether you want the weighting to be
directly proportional to the price paid. For example:
Ad_ID Price Weight
----- ----- -------
1 $5.00 500
2 $0.01 1
3 $0.25 25
4 $0.10 10
5 $0.05 5
If you _don't_ want to weight proportionately to the price, you'll need to
come up with a way to shift the weighting, but you still probably want to
base it on pricing. You might do something like
Ad Price Range Weight
-------------- -------
$0.00 1
$0.01 - $0.02 2
$0.03 - $0.10 3
$0.11 - $0.50 5
$0.51 - $0.99 10
$1.00 - $1.99 18
$2.00 - $4.99 30
$5.00+ 50
or
Ad Price Range Weight
-------------- -------
$0.00 1
$0.01 - $0.99 1.75 * (price * 100)
$1.00 - $2.00 1.50 * (price * 100)
$2.01 - $3.00 1.25 * (price * 100)
$3.00+ 1.00 * (price * 100)
I have no idea how either of these particular weighting schemes would work
out for you, but it should give you some ideas.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

