简体   繁体   English

基于评级的C#排序[已更新澄清]

[英]C# Sorting Based on Rating [Updated to Clarify]

I'm doing some machine learning stuff and I want to take some random 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. 我研究了Wilson区间得分 ,这似乎是一个不错的解决方案,但我想知道是否还有其他选择。

I'm going to be using C# 4.0 if that matters. 如果这很重要,我将使用C#4.0。

Edit: Added below example; 编辑:添加以下示例;

Lets suppose I have 3 items and multiple people have voted on them according to the table: 假设我有3个项目,并且有多个人根据该表对其进行了投票:

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. 在此示例中,我希望项目3列在第一位,项目2其次,列在第三位。 This is a rough approximation of my expectations. 这是我的期望的近似值。

Item 3 has the most responses and highest relative approval. 项目3的回应最多,相对认可度最高。 Item 2 has more responses than Item 1 despite having a lower percentage approval. 尽管批准的百分比较低,但项目2的响应比项目1的多。

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. 您可以为您的类隐含IComparable接口。 Impliment the CompareTo(T other) method. 隐含CompareTo(T other)方法。 Create a case where this obj is less than the other obj and return -1. 创建此obj小于另一个obj的情况,并返回-1。 If they are the same, return 0. If this obj is greater than the other obj return 1. 如果它们相同,则返回0。如果此obj大于另一个obj,则返回1。

When you sort a collection using the .Sort() method, it will use your rules. 当您使用.Sort()方法对集合进行排序时,它将使用您的规则。

Is this what you are looking for? 这是你想要的?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM