ranking

Simulate rank in mysql (without rank) with two conditions

跟風遠走 提交于 2020-05-28 07:52:57
问题 Coming from this answer: Rank based on two columns I've the following example: CREATE TABLE tmpPoradi (`player` int, `wins` int, `diff` int) ; INSERT INTO tmpPoradi (`player`, `wins`, `diff`) VALUES (1, 10, 12), (2, 8, 2), (3, 10, 10), (4, 8, 1), (5, 8, 7), (6, 10, 14), (8, 10, 10), (7, 12, 3) ; and the desired result must be: +--------+------+------+------+ | player | wins | diff | rank | +--------+------+------+------+ | 7 | 12 | 3 | 1 | | 6 | 10 | 14 | 2 | | 1 | 10 | 12 | 3 | | 3 | 10 | 10

Simulate rank in mysql (without rank) with two conditions

大憨熊 提交于 2020-05-28 07:52:56
问题 Coming from this answer: Rank based on two columns I've the following example: CREATE TABLE tmpPoradi (`player` int, `wins` int, `diff` int) ; INSERT INTO tmpPoradi (`player`, `wins`, `diff`) VALUES (1, 10, 12), (2, 8, 2), (3, 10, 10), (4, 8, 1), (5, 8, 7), (6, 10, 14), (8, 10, 10), (7, 12, 3) ; and the desired result must be: +--------+------+------+------+ | player | wins | diff | rank | +--------+------+------+------+ | 7 | 12 | 3 | 1 | | 6 | 10 | 14 | 2 | | 1 | 10 | 12 | 3 | | 3 | 10 | 10

How to compare ranked lists

这一生的挚爱 提交于 2020-05-25 03:13:29
问题 I have two lists of ranked items. Each item has an rank and an associated score. The score has decided the rank. The two lists can contains (and usually do) different items, that is their intersection can be empty. I need measures to compare such rankings. Are there well-known algorithms (in literature or real-world systems) to do so ? The measure of distance should take into account the scores as well as the ranks of the items. 回答1: This question has never been answered before, but I still

How to compare ranked lists

感情迁移 提交于 2020-05-25 03:08:34
问题 I have two lists of ranked items. Each item has an rank and an associated score. The score has decided the rank. The two lists can contains (and usually do) different items, that is their intersection can be empty. I need measures to compare such rankings. Are there well-known algorithms (in literature or real-world systems) to do so ? The measure of distance should take into account the scores as well as the ranks of the items. 回答1: This question has never been answered before, but I still

Ranking array elements

痞子三分冷 提交于 2020-05-07 10:34:09
问题 I need an algorithm to rank elements of an array in Javascript. Example : I have an array as follows: [79, 5, 18, 5, 32, 1, 16, 1, 82, 13] I need to rank the entries by value. So 82 should receive rank 1, 79 rank 2 etc. If two entries have the same value they receive the same rank and the rank for a lower value is raised. So for this array, the new ranking array would be: [2, 7, 4, 7, 3, 9, 5, 9, 1, 6] How can I do this ? 回答1: var arr = [79, 5, 18, 5, 32, 1, 16, 1, 82, 13]; var sorted = arr

Ranking - minimizing pair-wise comparison

烈酒焚心 提交于 2020-03-05 00:38:17
问题 I have a list of 100 items and I want generate a ranked list, the user is asked to rate pairs of items, prompting: "Do you prefer item A or item B instead?". Since it would be really tiring asking every possible combination of those items. Eg. if item 1 is prefered over item 2, and item 2 is preferred over item 3, it's not necessary to compare item 1 and item 3. I'm looking for a algorithm that reduce such comparisons and will give a complete ranked list. If the number of comparisons would be

Ranking - minimizing pair-wise comparison

匆匆过客 提交于 2020-03-05 00:27:41
问题 I have a list of 100 items and I want generate a ranked list, the user is asked to rate pairs of items, prompting: "Do you prefer item A or item B instead?". Since it would be really tiring asking every possible combination of those items. Eg. if item 1 is prefered over item 2, and item 2 is preferred over item 3, it's not necessary to compare item 1 and item 3. I'm looking for a algorithm that reduce such comparisons and will give a complete ranked list. If the number of comparisons would be

Finding highest values in each row in a data frame for python

狂风中的少年 提交于 2020-02-28 04:43:30
问题 I'd like to find the highest values in each row and return the column header for the value in python. For example, I'd like to find the top two in each row: df = A B C D 5 9 8 2 4 1 2 3 I'd like my for my output to look like this: df = B C A D 回答1: You can use a dictionary comprehension to generate the largest_n values in each row of the dataframe. I transposed the dataframe and then applied nlargest to each of the columns. I used .index.tolist() to extract the desired top_n columns. Finally,

Finding highest values in each row in a data frame for python

拜拜、爱过 提交于 2020-02-28 04:43:09
问题 I'd like to find the highest values in each row and return the column header for the value in python. For example, I'd like to find the top two in each row: df = A B C D 5 9 8 2 4 1 2 3 I'd like my for my output to look like this: df = B C A D 回答1: You can use a dictionary comprehension to generate the largest_n values in each row of the dataframe. I transposed the dataframe and then applied nlargest to each of the columns. I used .index.tolist() to extract the desired top_n columns. Finally,

Difference between sort(), rank(), and order() [duplicate]

对着背影说爱祢 提交于 2020-02-16 10:44:32
问题 This question already has answers here : rank and order in R (7 answers) Closed last year . What is the difference between sort(), rank(), and order() in R . Can you explain with examples? 回答1: sort() sorts the vector in an ascending order. rank() gives the respective rank of the numbers present in the vector, the smallest number receiving the rank 1. order() returns the indices of the vector in a sorted order. for example: if we apply these functions are applied to the vector - c (3, 1, 2, 5