Everyone has seen on the sites a system of rating articles and materials. Many even did it themselves, but not everyone made a rating of people on the site.
In this article I will tell you how to make a high-quality rating system for users of your resource.
First, I will draw a line for you of different rating algorithms:
I - Users receive only "+"Main advantages:
- There are no problems.
- Minimum load on the site and base.
Disadvantages:
- one person, one point.
- Personal authority on the site / forum does not cost anything. You are one unit and that's it.
II - Users get "+" and "-"There are few big differences from the previous system. Added another field in the database.
Main advantages:
- There are no problems.
- Minimum load on the site and base.
Disadvantages:
- one person, one point.
- Personal authority on the site / forum does not cost anything. You are one unit and that's it.
')
III - hyperbole from @ klim-danilovklim-danilovYes, this is a rather interesting idea but for the evaluation of the material. But not users.
Main advantages:
- “The weight of each plus or minus is constantly reduced by half, in chronological order.
That is, the first user puts plus with a weight of +50 points, the next one puts plus with a weight of +25 points, minus -50 points, minus -25, minus -12.5 points ”
Disadvantages:
- Each subsequent voice already has less weight.
- The system is not finished yet.
IV - statistical averageOne of the most common systems. The basis is the total amount of voters and the total score divided by each other.
Main advantages:
- The system has long been tested and works.
- Not high resource costs.
Disadvantages:
- The user is entitled to vote from minimum to maximum. And usually according to statistics, users put the lowest score or the highest.
- A system for evaluating material only.
V - floating systemThe principle is based on the change of karma in the direction of plus or minus.
Main advantages:
- Perhaps the best system for assessing users / material.
- Not high resource costs.
Disadvantages:
- And again. Your authority on the site / forum in the rating system is worth nothing.
Now I will do my bit.
Why reinvent the wheel was when there are already algorithms for assessing people?
- And the answer is simple, they are not correct when there is a conversation about the need to highlight the truly authoritative people in the resource.
The algorithm is based on the geometric shape of a "right triangle".
Yes, sometimes in geometry we can find quite unusual things.
Why was the triangle chosen?
The fact is that the height of the triangle can correspond to the rating of the user who puts the assessment.
The length of the triangle rated which is rated. And the hypotenuse is just that difference between user authorities.
Now we will start the most interesting.
$a = 254;
Maybe someone will ask. And why did not use the formula $ result = ($ a * 2) / $ b ;?
This formula does not work adequately when $ a is less than $ b by more than 2 times.
Within a couple of months I will finish writing the project (I will write about this after a closed beta test).
The algorithm will be tested on a real project where it is critically necessary.
Total:
After thousands of tests with $ a = rand (0.99999); $ b = rand (0.99999);
I came to a couple of bugs:
1st - divide by 0.
Fixed if ($ b <= 0) {$ b = 1; }
2nd - when the receiving user has 1 point, and receives from the user with 1000, then the volume of the resulting one becomes 2000
Fixed if ($ result> $ b / 2) {$ result = (int) round ($ b / 2); } The maximum can be increased by 50%.
The Code-Igniter benchmark did not yield load results (0.0000).
Thanks to all. Look for inspiration in everything you see.