ranking

Ranking of a cell array

╄→гoц情女王★ 提交于 2019-12-24 19:37:44
问题 Take the following example: clear all Name1 = {'Data1','Data2','Data3','Data4'}; Data = {6.2,6,3.2,8}; CombnsName = nchoosek(Name1,2); CombnsData = nchoosek(Data,2); for i = 1:length(CombnsData); multiplied{i} = CombnsData{i,1}.*CombnsData{i,2}; end multiplied = multiplied'; Final = [CombnsName, multiplied]; Rankd = sort(cell2mat(multiplied)); Here, Final represents the values gained by multiplying every possible combination of 'Name1'. Now, I'm trying to find a way of changing the order of

How to rank values in a dataframe with indexes?

纵饮孤独 提交于 2019-12-24 19:29:49
问题 I have the following dataframe of topic document probablity matrix with the first row being names of text files. 1 2 ... 80 81 0 778.txt 856.txt ... 831.txt 850.txt 1 0.002735042735042732 0.0054700854700846634 ... 0.01641025640567632 4.2490294446698094e-09 2 2.146512500161246e-28 8.006312700113502e-16 ... 4.580074538571013e-12 0.02017093592191074 where column 0 with values (0.0, 1.0) represents index for topic 1 and 2 respectively.After sorting each column(decsending) def rank_topics_by

Mysql. Order locations and join listings randomly

时光怂恿深爱的人放手 提交于 2019-12-24 16:20:13
问题 I have two tables: locations and listings. locations id title address latitude longitude listings id location info status SELECT locations.title, locations.address, ( 3959 * acos( cos( radians('".$center_lat."') ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians('".$center_lng."') ) + sin( radians('".$center_lat."') ) * sin( radians( latitude ) ) ) ) AS distance FROM locations ORDER BY distance This will list the locations in order by location with the users provided

Sorting and ranking by dates, on a group in a pandas df

社会主义新天地 提交于 2019-12-24 01:38:15
问题 From the following sort of dataframe I would like to be able to both sort and rank the id field on date: df = pd.DataFrame({ 'id':[1, 1, 2, 3, 3, 4, 5, 6,6,6,7,7], 'value':[.01, .4, .2, .3, .11, .21, .4, .01, 3, .5, .8, .9], 'date':['10/01/2017 15:45:00','05/01/2017 15:56:00', '11/01/2017 15:22:00','06/01/2017 11:02:00','05/01/2017 09:37:00', '05/01/2017 09:55:00','05/01/2017 10:08:00','03/02/2017 08:55:00', '03/02/2017 09:15:00','03/02/2017 09:31:00','09/01/2017 15:42:00', '19/01/2017 16:34

Pyspark - Ranking columns keeping ties

耗尽温柔 提交于 2019-12-24 00:45:19
问题 I'm looking for a way to rank columns of a dataframe preserving ties. Specifically for this example, I have a pyspark dataframe as follows where I want to generate ranks for colA & colB (though I want to support being able to rank N number of columns) +--------+----------+-----+----+ | Entity| id| colA|colB| +-------------------+-----+----+ | a|8589934652| 21| 50| | b| 112| 9| 23| | c|8589934629| 9| 23| | d|8589934702| 8| 21| | e| 20| 2| 21| | f|8589934657| 2| 5| | g|8589934601| 1| 5| | h

Building ranking with genetic algorithm,

元气小坏坏 提交于 2019-12-23 17:15:08
问题 Question after BIG edition : I need to built a ranking using genetic algorithm, I have data like this : P(a>b)=0.9 P(b>c)=0.7 P(c>d)=0.8 P(b>d)=0.3 now, lets interpret a,b,c,d as names of football teams, and P(x>y) is probability that x wins with y . We want to build ranking of teams, we lack some observations P(a>d) , P(a>c) are missing due to lack of matches between a vs d and a vs c. Goal is to find ordering of team names, which the best describes current situation in that four team league

php search engine key words ranking

ⅰ亾dé卋堺 提交于 2019-12-23 06:08:19
问题 I am new to php and mysql. In my project I have to develop search engine for multiple keywords on multiple columns and also require the keyword ranking and relevency. For example if I have three words hi, hello, hey and want to search on fields like subject, message, reference, textbody. in this case the row who has more keywords ranking will come first and lowest ranker row goes last. will any one guide me how to implement such search engine. my database is about 4 million and is growing

How to boost index type in elasticsearch?

孤人 提交于 2019-12-22 19:01:41
问题 I used to search like this: curl -XGET localhost:9200/users/_search but users contains user a,b,c like this: curl -XGET localhost:9200/users/a,b,c/_search users is the first index, a/b/c is type. How to boost type a in this query? Best with sample code, thanks. 回答1: You can boost index types using terms query. First Create some test data (e1,e2,e3 are types and test is the index name): PUT test/e1/1 { "subject": "subject 1" } PUT test/e2/1 { "subject": "subject 1" } PUT test/e3/1 { "subject":

MySQL: Querying a leaderboard with ties

*爱你&永不变心* 提交于 2019-12-22 09:15:05
问题 I know this is a popular topic, but I still haven't found quite what I'm looking for. I'd like to query one table BOOKS_READ id user_id book_id to format a leaderboard of users who have listed the most books as having been read. When a user reads a book, a record matching the book id and the user id gets logged into the books_read table. Is it possible to rank the results of this query, starting at 1, and with consideration of ties? SELECT user_id, COUNT(*) AS book_count FROM books_read GROUP

Join single row from a table in MySQL

本秂侑毒 提交于 2019-12-22 08:27:08
问题 I have two tables players and scores . I want to generate a report that looks something like this: player first score points foo 2010-05-20 19 bar 2010-04-15 29 baz 2010-02-04 13 Right now, my query looks something like this: select p.name player, min(s.date) first_score, s.points points from players p join scores s on s.player_id = p.id group by p.name, s.points I need the s.points that is associated with the row that min(s.date) returns. Is that happening with this query? That is, how can I