Gossamer Forum
Home : General : Perl Programming :

Mathematical problem with count tags, finding a better average value

Quote Reply
Mathematical problem with count tags, finding a better average value
I just start "tagging" for my Lsql. With this i have a mathematical problem. Say i want to show the 30 most used tags for all links,
Say i have five different sizes to show them.

For now as quick and dirty i do:

if count_links < 10 use css1
elseif count_links < 20 use css2
...
else use css5

But while the number of count_links is growong daily i will have 30 tags with more than x links very soon. This means i have to change the values (10,20 ...) from time to time.
So i think about another solution. For exampel i can say with an example of 3 tags:

tag1: count = 80
tag2: count = 50
tag3: count = 20

Then calculate: 80+50+20 = 150; 150 / 3 = 50; 50/2 = 25

so i can say:

if count_links < 25 use css1
elseif count_links < 50 use css2
elseif count_links < 75 use css3
...
else use css5

For this i always take 25% of the average link_count.


But if i have something like this:

tag1: count = 500
tag2: count = 50
tag3: count= 40

Then i will have a problem, because one value is far away from the average value of the rest.

I cant remember my studies in statistics, but i am shure that there is a way to calculate the average value better.

I hope somebody understands my problem, know an answer and will giv it to me.
Thank you.

Last edited by:

Robert: Dec 31, 2007, 3:19 AM