Guest User

site_ranking_v1

a guest
Apr 5th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.87 KB | None | 0 0
  1. // A few notes:
  2. //
  3. // This is in pseudocode, and I'm using ** as the exponentiation function
  4. // here. I'm only including a subset of the data you have available, the stuff
  5. // that I think is probably most interesting for ranking. Most of the
  6. // functions are pretty straightforward, you should be able to add your own
  7. // without too much trouble.
  8. //
  9. // Most of these are exponential functions that define a rate raised to
  10. // the power of some input value. This will produce your standard exponential
  11. // graph. If you want to move the graph along the X axis (i.e., make your
  12. // peak values happen sooner or later), then add to or subtract from the
  13. // exponent. If you want to move the graph up and down along the Y axis
  14. // (i.e., define greater or smaller minimum values), then simply add to or
  15. // subtract from the result.
  16.  
  17. // Let's get started.
  18.  
  19. // Tunable knobs.
  20. // Each tunable has a description in the function that uses it below.
  21.  
  22. ipb_rate = 1.2;
  23. dslu_rate = 1.4;
  24. dsc_rate = 1.01;
  25. avg_hits = 2000;
  26. sh_rate = .3;
  27. shltp_rate = .4;
  28. email_penalty = .8;
  29.  
  30.  
  31. // Site's overall starting score.
  32. //
  33. // This just needs to be any nonzero positive value. Larger starting
  34. // values will result in a larger range of ranking scores.
  35.  
  36. score = 1;
  37.  
  38.  
  39. // How big the index.html is, in bytes.
  40. // ipb_rate is your tuning value here. Set it to any non-zero positive
  41. // value. Higher values make the size of the index.html file more
  42. // important.
  43. //
  44. // I've divided index_page_bytes here by 1024 to penalize sites that
  45. // have index pages smaller than 1K, and to keep the exponent from
  46. // getting too ridiculously large.
  47.  
  48. score = score * (ipb_rate ** (index_page_bytes/1024));
  49.  
  50.  
  51. // When site was updated
  52. // dslu_rate is your tuning value here. days_since_last_update is being
  53. // used as a denominator to invert the result of the function (i.e.,
  54. // the more days since it was last updated, the smaller the resulting
  55. // score is). Sites that have been updated less than 5 days ago get a boost.
  56.  
  57. score = score * (dslu_rate ** (5/days_since_last_update));
  58.  
  59.  
  60. // When site was created
  61. // dsc_rate is your tuning value here. Use a small dsc_rate value to give
  62. // older sites a nice boost in rankings without penalizing newer sites.
  63.  
  64. score = score * (dsc_rate ** days_since_creation);
  65.  
  66.  
  67. // How many hits the site has gotten
  68. // sh_rate is your tuning value here. I'm including another value here,
  69. // avg_hits, to establish a sort of baseline -- sites with higher than
  70. // average hits get a boost, sites with smaller than average hits get a
  71. // small penalty. If you don't know your avg_hits value, just treat it as
  72. // a tunable parameter and pick a value that seems reasonable.
  73. //
  74. // I've also switched the order of the base and the exponent here, since
  75. // we should expect that (site_hits / avg_hits) could get large.
  76.  
  77. score = score * ((site_hits / avg_hits) ** sh_rate);
  78.  
  79.  
  80. // How many hits the site has gotten in the last (time period)
  81. // shltp_rate (site-hits-last-time-period rate) is your tuning value here.
  82. // I think this would be a good additional parameter, if you can do it.
  83. // This will help to measure the trending popularity of newer sites,
  84. // and should be given a good boost.
  85.  
  86. score = score * (site_hits_last_24h ** shltp_rate);
  87.  
  88.  
  89. // Whether the site provided an email on creation or not
  90. //
  91. // I assume here you want to heavily penalize sites that didn't supply an
  92. // email address. email_penalty can be any value from .01 to .99; larger
  93. // values result in a bigger penalty for not having an email address.
  94. //
  95. // Let's say your email_penalty is .8; if a site has an email address, then
  96. // its score will be multiplied by 1.2, a relatively slight upward adjustment.
  97. // But, if your site doesn't have an email address, its score will be
  98. // multiplied by 0.2 -- a severe downward adjustment.
  99.  
  100. score = score * ((site_has_email_addr ? 1 : 0) + (1 - email_penalty));
  101.  
  102.  
  103. // Done.
Advertisement
Add Comment
Please, Sign In to add comment