开发者

C# Sorting Based on Rating [Updated to Clarify]

开发者 https://www.devze.com 2023-01-11 04:27 出处:网络
I\'m doing some machine learning stuff and I want to take some ra开发者_如何转开发ndom samples and determine if a human agrees with the computer.To do this a user just votes up or down on a given item

I'm doing some machine learning stuff and I want to take some ra开发者_如何转开发ndom samples and determine if a human agrees with the computer. To do this a user just votes up or down on a given item. Then I want to be able to sort by the items with the highest rating. I want to use something more complicated than simply up-down to get good results.

I've looked into the Wilson Interval Score and it seems like a decent solution, but I'm wondering if there are other alternatives.

I'm going to be using C# 4.0 if that matters.

Edit: Added below example;

Lets suppose I have 3 items and multiple people have voted on them according to the table:

Item    Up    Down
1       6       1
2       60      11
3       100     40

In this example I would like Item 3 to be listed first, item 2 second and 3 third. This is a rough approximation of my expectations.

Item 3 has the most responses and highest relative approval. Item 2 has more responses than Item 1 despite having a lower percentage approval.

I'm trying to list the items in terms of some sort of relative metric and algrotithm without using something like percent approval or net score; something more complicated.


You can impliment the IComparable interface for you class. Impliment the CompareTo(T other) method. Create a case where this obj is less than the other obj and return -1. If they are the same, return 0. If this obj is greater than the other obj return 1.

When you sort a collection using the .Sort() method, it will use your rules.

Is this what you are looking for?

0

精彩评论

暂无评论...
验证码 换一张
取 消