Skip to main content

All Questions

Tagged with
6 votes
1 answer
584 views

Schelling's model of Segregation Python implementation with Geopandas

If you don't know what is Schelling's model of segregation, you can read it here. The Schelling model of segregation is an agent-based model that illustrates how individual tendencies regarding ...
Kartikeya Sharma's user avatar
5 votes
2 answers
5k views

Grouping sorted coordinates based on proximity to each other

I created an algotrithm that groups a sorted list of coordinates into buckets based on their proximity (30) to one another. Steps: Create a new key with a list ...
Josh Sharkey's user avatar
3 votes
0 answers
543 views

Locality Sensitive Hash (similar to k-Nearest Neighbor), in Python+Numpy

I've tried implementing Locality Sensitive Hash, the algorithm that helps recommendation engines, and powers apps like Shazzam that can identify songs you heard at restaurants. LSH is supposed to run ...
Josh.F's user avatar
  • 187
5 votes
1 answer
6k views

k-means using numpy

This is k-means implementation using Python (numpy). I believe there is room for improvement when it comes to computing distances (given I'm using a list comprehension, maybe I could also pack it in a ...
Adel Redjimi's user avatar
1 vote
0 answers
7k views

Fuzzy c Means in Python

This is my implementation of Fuzzy c-Means in Python. In the main section of the code, I compared the time it takes with the sklearn implementation of kMeans. ...
Avisek's user avatar
  • 195
2 votes
0 answers
240 views

Calculation of clustering metric in Python

When I try to run the following code for arrays with more than 10k elements, it takes hours and I don't know how to make it in the most efficient way. Any ideas? ...
kibs's user avatar
  • 21
7 votes
1 answer
164 views

Speeding up maximum self-similarity test for heavy tail-exponents

I am trying to reproduce results from a research paper using python. I've checked my method and it works on relatively small sample datasets. However, the code does not run for my actual dataset, ...
user avatar
5 votes
1 answer
599 views

Clustering points on a sphere

I have written a short Python program which does the following: loads a large data file (\$10^9+\$ rows) where each row is a point on a sphere. The code then loads a pre-determined triangular grid on ...
John's user avatar
  • 309
1 vote
1 answer
4k views

Cosine similarity computation

I have a matrix of ~4.5 million vector [4.5mil, 300] and I want to calculate the distance between a vector of length 300 against all the entries in the matrix. I got some great performance time ...
ajaanbaahu's user avatar
4 votes
1 answer
3k views

OpenCV 3: Using k-Nearest Neighbors to analyse RGB image

I'm new to computer vision and numpy. I wrote a simple script to seperate red, green and blue colors from the original image by using the kNN algorithm. After reading through some numpy tutorials, I'...
dev-random's user avatar
7 votes
1 answer
6k views

k-means clustering algorithm implementation

Here is my personal implementation of the clustering k-means algorithm. ...
Daniyal Shahrokhian's user avatar
10 votes
1 answer
14k views

K-Mean with Numpy

I have implemented the K-Mean clustering Algorithm in Numpy: ...
Frames Catherine White's user avatar
2 votes
1 answer
362 views

Neighbours from point connections

I am working with a mesh of triangles (in 3D, although I doubt it makes a difference). The mesh is given as list of lists, each list containing the indices of the three vertices of a triangle in said ...
John's user avatar
  • 309
4 votes
1 answer
5k views

Calculating the distance between one point, and many others

In my program, I have entities that I call "blobs", because they have a blobby shape. Blobs are polygons. If I have two blobs, then their information array would look like: ...
bzm3r's user avatar
  • 399
14 votes
2 answers
9k views

Possible optimizations for calculating squared euclidean distance

I need to do a few hundred million euclidean distance calculations every day in a Python project. Here is what I started out with: ...
herrherr's user avatar
  • 243

15 30 50 per page