Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My math experiences I had at school are not very advanced and I'm struggling with a calculation right now...

I'm programming an image Search script for my company where you can find all pictures we bought off several shops, like Shuttersdock, Istockphoto, Fotolia and so on, and I'd like to base it on a ranked search function...

I'd need a formula to rank each image based on 3 numbers...

I got the hit rate (hits/search tags), the usage (how often it's used) and the days since it was used the last time...

Now I'd need to calculate the level. :/

I tried several things but ended up in chaos ^^

The higher the level the better the pic...

So we have the hit ratio and the days of the last usage increasing the level and the usage decreasing

My last try was with a usage ranking (lastUsage*(usage/100)) I don't know how I ended up there :/ and then (hitrate*usageRanking)

I hope I could explain my problem understandably...

I'm kinda stuck here and I don't know how to try it at all.

I hope you guys can help me. :)


share|cite|improve this question
One can build thousands of rankings based on those criteria. If all of them are of equal importance to you or your company, try making three separate rankings for lastusage, usage and hitrate, and then simply take the (geometric/arithmetic) mean of those rankings. – TMM Feb 29 '12 at 13:13
i dont really know what you mean :/ i need all of them together as one criteria to sort the pictures the database found for the entered searchtags like sports,ball,soccer,goal and it finds pics with those tags but not just sorted on the amount of tag hits.. more sort them based on the hits,the usage and the last usage so that graphic designers start to use other pics and not just their favorites they can remember :) We have about 10000 images so they could find many things if they'd want to click through all those folders this is why i try to build the search engine database ... – pwittke Feb 29 '12 at 14:33
What I mean is try making one ranking (say a score between 1-10) for lastusage, one for usage and one for hitrate. Then to make an overall score, just add up the scores and divide by 3. ("Divide and conquer"...) – TMM Feb 29 '12 at 14:41
okay thanks! Ill try it now :D – pwittke Feb 29 '12 at 14:57
ohh well there is one problem... there is no rule for the usage and last usage so i dont know how to put them to a score, because its not like we're not allowed to use it 10 times or sth our designers can use them as often as they want but I want to suggest other pictures, wich are less used instead of the most popular... so its more like i want to sort the unpopular hits first any idea ? ohh and if its used 40 times but the last time 3 months ago for example its still a good suggestion instead of one with 20 usages and the last was yesterday ... :/ – pwittke Feb 29 '12 at 14:59

Okay so I tried around the last week and thought I got it, but then i played around with random numbers to see how it reacts and it was frustrating... -.-'

Its not working as I expect it to...

here's my calculation so far

searchtags = 5 // sum of entered keywords
hits = 3 // number of hits for this picture
hitquote = hits/searchtags
used = 21 //times
average = 33 // average usage of a picture
lastusage = 19 // last used X days ago

usageRanking = (lastusage*(usage/average))
level = hitquote*usageranking

i dont know how to set this correctly :/

I need the used to decrease the level the higher it goes and the lastusage to increase the level the higher it goes...

to put it dynamic i added the average and i have the possibility to read the average of the lastusage out of the database if its needed...

any Idea how to do it ?


share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.