# ajaanbaahu

6 questions

2

91

views

### How to find complexity for the following program?

So I am not a CS major and have hard time answering questions about a program's big(O) complexity. I wrote the following routine to output the pairs of numbers in an array which sum to 0: asd=[-3,-2,-3,2,3,2,4,5,8,-8,9,10,-4] def sum_zero(asd): for i in range(len(asd)): for j in range(i,len(asd)):...
ajaanbaahu

1

409

views

### Is there a limit in Gensim's Doc2Vec most_similar documents result set?

I have been experimenting with the doc2vec module for sometime now. I can train my model and have the trained model output similar documents for a given document as follows : import re modelloaded=Doc2Vec.load('model_all_doc_dm_1') st = 'long description of a document as string' doc = re.sub('[^a-zA...
ajaanbaahu

2

3.6k

views

### How to find set of most frequently occurring word-pairs in a file using python?

I have a data set as follows: '485','AlterNet','Statistics','Estimation','Narnia','Two and half men' '717','I like Sheen', 'Narnia', 'Statistics', 'Estimation' '633','MachineLearning','AI','I like Cars, but I also like bikes' '717','I like Sheen','MachineLearning', 'regression', 'AI' '136','MachineL...
ajaanbaahu

4

1.1k

views

### How to group key:value pairs in a python dictionary based on certain range or interval?

I have a dictionary dict={14:1, 15:2, 16:4, 11:5, 20:1,22:5,25:2...} in python How can I obtain a final result in any data structure(dictionary or something else) which looks like: Final= [10-15:8, 16-20:5, 21-25:7....] or at least can sum up the values for keys falling under certain ranges of let s...
ajaanbaahu

1

521

views

### How to speed up cosine similarity between a numpy array and a very very large matrix?

I have a problem where a need to calculate cosine similarities between a numpy array of shape (1, 300) and a matrix of shape (5000000, 300). I have tried multiple different flavors of codes and now I am wondering if there is a way to reduce the run time substantially : Version 1 : I divide my big ma...
ajaanbaahu

1