similarity

Find the similarity between two string columns of a DataFrame

此生再无相见时 提交于 2019-12-06 05:35:10
问题 I am new to programming.I have a pandas data frame in which two string columns are present. Data frame is like below: Col-1 Col-2 Update have a account Account account summary AccountDTH Cancel Balance Balance Summary Credit Card Update credit card Here i need to check the similarity of Col-2 elements with each element of Col-1. It Means i have to compare have a account with all the elements of Col-1 . Then find the top 3 similar one. Suppose the similarity scores are : Account(85),AccountDTH

generating bigram combinations from grouped data in pig

不羁岁月 提交于 2019-12-06 03:07:35
given my input data in userid,itemid format: raw: {userid: bytearray,itemid: bytearray} dump raw; (A,1) (A,2) (A,4) (A,5) (B,2) (B,3) (B,5) (C,1) (C,5) grpd = GROUP raw BY userid; dump grpd; (A,{(A,1),(A,2),(A,4),(A,5)}) (B,{(B,2),(B,3),(B,5)}) (C,{(C,1),(C,5)}) I'd like to generate all of the combinations(order not important) of items within each group. I eventually intend on performing jaccard similarity on the items in my group. ideally my the bigrams would be generated and then I'd FLATTEN the output to look like: (A, (1,2)) (A, (1,3)) (A, (1,4)) (A, (2,3)) (A, (2,4)) (A, (3,4)) (B, (1,2))

Checking and preventing similar strings while insertion in MySQL

三世轮回 提交于 2019-12-06 01:23:36
问题 Brief info I have 3 tables: Set: id name SetItem: set_id item_id position TempSet: id I have a function that generates new random combinations from Item table. Basically, always after successful generation, I create a new row in Set table, get it's id and add all item ids into SetItem table. Problem Every time before generating new combination I truncate the TempSet table, fill new item ids into this table and check for similarity percentage by comparing with previous combinations in SetItem

How to get pair-wise “sequence similarity score” for ~1000 proteins?

霸气de小男生 提交于 2019-12-06 00:28:12
问题 I have a large number of protein sequences in fasta format. I want to get the pair-wise sequence similarity score for each pairs of the proteins. Any package in R could be used to get the blast similarity score for protein sequences? 回答1: As per Chase's suggestion, bioconductor is indeed the way to go and in particular the Biostrings package. To install the latter I would suggest installing the core bioconductor library as such: source("http://bioconductor.org/biocLite.R") biocLite() This way

What is an efficient way to measure similarity between two strings? (Levenshtein Distance makes stack too deep)

荒凉一梦 提交于 2019-12-05 23:51:55
So, I started with this: http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#Ruby Which works great for really small strings. But, my strings can be upwards of 10,000 characters long -- and since the Levenshtein Distance is recursive, this causes a stack too deep error in my Ruby on Rails app. So, is there another, maybe less stack intensive method of finding the similarity between two large strings? Alternatively, I'd need a way to make the stack have much larger size. (I don't think this is the right way to solve the problem, though) Consider a non-recursive

What is the use of Brown Corpus in measuring Semantic Similarity based on WordNet

耗尽温柔 提交于 2019-12-05 17:37:45
I came across several methods for measuring semantic similarity that use the structure and hierarchy of WordNet, e.g. Jiang and Conrath measure (JNC), Resnik measure(RES), Lin measure (LIN) etc. The way they are measured using NLTK is: sim2=wn.jcn_similarity(entry1,entry2,brown_ic) sim3=entry1.res_similarity(entry2, brown_ic) sim4=entry1.lin_similarity(entry2,brown_ic) If WordNet is the basis of calculating semantic similarity, what is the use of Brown Corpus here? arturomp Take a look at the explanation at the NLTK howto for wordnet. Specifically, the *_ic notation is information content .

Algorithm to find edit distance to all substrings

放肆的年华 提交于 2019-12-05 17:10:26
问题 Given 2 strings s and t . I need to find for each substring in s edit distance(Levenshtein distance) to t . Actually I need to know for each i position in s what is the minimum edit distance for all substrings started at position i . For example: t = "ab" s = "sdabcb" And I need to get something like: {2,1,0,2,2} Explanation: 1st position: distance("ab", "sd") = 4 ( 2*subst ) distance("ab", "sda") = 3( 2*delete + insert ) distance("ab", "sdab") = 2 ( 2 * delete) distance("ab", "sdabc") = 3 (

ORDER BY Color with Hex Code as a criterio in MySQL

眉间皱痕 提交于 2019-12-05 12:19:42
I have a table that contains color options for a product. The color options include a hex color code, which is used to generate the UI (HTML). I would like to sort the rows so that the colors in the UI look like a rainbow, instead of the current order that sorts based off of the Name of the color (not very useful). Here is what my query looks like. I get the R G B decimal values from the hex code. I just don't know how to order it. I've looked into color difference algorithms. They seem more useful to compare 2 colors' similarity, not sort. I'm using MySQL: select a.*, (a.c_r + a.c_g + a.c_b)

Normalizing by max value or by total value?

守給你的承諾、 提交于 2019-12-05 12:12:25
I'm doing some work that involves document comparison. To do this, I'm analizing each document, and basically counting the number of times some key words appear on each of these documents. For instance: Document 1: Document 2: Book -> 3 Book -> 9 Work -> 0 Work -> 2 Dollar -> 5 Dollar -> 1 City -> 18 City -> 6 So after the counting process, I store all these sequence of numbers in a vector. This sequence of numbers will represent the feature vector for each document. Document 1: [ 3, 0, 5, 18] Document 2: [ 9, 2, 1, 6] The final step would be to normalize the data in a range from [0 1] . But

Explicit Semantic Analysis

好久不见. 提交于 2019-12-05 08:50:31
I came across this term called 'Explicit Semantic Analysis ' which uses Wikipedia as a reference and finds the similarity in documents and categorizes them into classes (correct me if i am wrong). The link i came across is here I wanted to learn more about it. Please help me out with it ! This explicit semantic analysis works on similar lines as semantic similarity . I got hold of this link which provides a clear example of ESA 来源: https://stackoverflow.com/questions/8707624/explicit-semantic-analysis