Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // A few notes:
- //
- // This is in pseudocode, and I'm using ** as the exponentiation function
- // here. I'm only including a subset of the data you have available, the stuff
- // that I think is probably most interesting for ranking. Most of the
- // functions are pretty straightforward, you should be able to add your own
- // without too much trouble.
- //
- // Most of these are exponential functions that define a rate raised to
- // the power of some input value. This will produce your standard exponential
- // graph. If you want to move the graph along the X axis (i.e., make your
- // peak values happen sooner or later), then add to or subtract from the
- // exponent. If you want to move the graph up and down along the Y axis
- // (i.e., define greater or smaller minimum values), then simply add to or
- // subtract from the result.
- // Let's get started.
- // Tunable knobs.
- // Each tunable has a description in the function that uses it below.
- ipb_rate = 1.2;
- dslu_rate = 1.4;
- dsc_rate = 1.01;
- avg_hits = 2000;
- sh_rate = .3;
- shltp_rate = .4;
- email_penalty = .8;
- // Site's overall starting score.
- //
- // This just needs to be any nonzero positive value. Larger starting
- // values will result in a larger range of ranking scores.
- score = 1;
- // How big the index.html is, in bytes.
- // ipb_rate is your tuning value here. Set it to any non-zero positive
- // value. Higher values make the size of the index.html file more
- // important.
- //
- // I've divided index_page_bytes here by 1024 to penalize sites that
- // have index pages smaller than 1K, and to keep the exponent from
- // getting too ridiculously large.
- score = score * (ipb_rate ** (index_page_bytes/1024));
- // When site was updated
- // dslu_rate is your tuning value here. days_since_last_update is being
- // used as a denominator to invert the result of the function (i.e.,
- // the more days since it was last updated, the smaller the resulting
- // score is). Sites that have been updated less than 5 days ago get a boost.
- score = score * (dslu_rate ** (5/days_since_last_update));
- // When site was created
- // dsc_rate is your tuning value here. Use a small dsc_rate value to give
- // older sites a nice boost in rankings without penalizing newer sites.
- score = score * (dsc_rate ** days_since_creation);
- // How many hits the site has gotten
- // sh_rate is your tuning value here. I'm including another value here,
- // avg_hits, to establish a sort of baseline -- sites with higher than
- // average hits get a boost, sites with smaller than average hits get a
- // small penalty. If you don't know your avg_hits value, just treat it as
- // a tunable parameter and pick a value that seems reasonable.
- //
- // I've also switched the order of the base and the exponent here, since
- // we should expect that (site_hits / avg_hits) could get large.
- score = score * ((site_hits / avg_hits) ** sh_rate);
- // How many hits the site has gotten in the last (time period)
- // shltp_rate (site-hits-last-time-period rate) is your tuning value here.
- // I think this would be a good additional parameter, if you can do it.
- // This will help to measure the trending popularity of newer sites,
- // and should be given a good boost.
- score = score * (site_hits_last_24h ** shltp_rate);
- // Whether the site provided an email on creation or not
- //
- // I assume here you want to heavily penalize sites that didn't supply an
- // email address. email_penalty can be any value from .01 to .99; larger
- // values result in a bigger penalty for not having an email address.
- //
- // Let's say your email_penalty is .8; if a site has an email address, then
- // its score will be multiplied by 1.2, a relatively slight upward adjustment.
- // But, if your site doesn't have an email address, its score will be
- // multiplied by 0.2 -- a severe downward adjustment.
- score = score * ((site_has_email_addr ? 1 : 0) + (1 - email_penalty));
- // Done.
Advertisement
Add Comment
Please, Sign In to add comment