All Questions
Tagged with numpy clustering
19
questions
6
votes
1
answer
570
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 ...
5
votes
2
answers
4k
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 ...
3
votes
0
answers
536
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 ...
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 ...
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.
...
2
votes
0
answers
238
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?
...
7
votes
1
answer
159
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, ...
5
votes
1
answer
589
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 ...
0
votes
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 ...
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'...
7
votes
1
answer
6k
views
k-means clustering algorithm implementation
Here is my personal implementation of the clustering k-means algorithm.
...
10
votes
1
answer
14k
views
K-Mean with Numpy
I have implemented the K-Mean clustering Algorithm in Numpy:
...
2
votes
1
answer
350
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 ...
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:
...
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:
...
8
votes
2
answers
30k
views
K-means clustering in Python
The following code uses scikit-learn to carry out K-means clustering where \$K = 4\$, on an example related to wine marketing from the book DataSmart. That book uses excel but I wanted to learn Python ...
6
votes
1
answer
2k
views
Calculating Euclidean norm for each vector in a sparse matrix
Below is a naive algorithm to find nearest neighbours for a point in some n-dimensional space.
...
4
votes
1
answer
267
views
KMeans in the shortest and most readable format
I'm learning Python (coming from Java) so I decided to write KMeans as a practice for the language. However I want to see how could one improve the code and making it shorter and yet readable. I ...
52
votes
3
answers
167k
views
Finding the closest point to a list of points
I'm trying to find the closest point (Euclidean distance) from a user-inputted point to a list of 50,000 points that I have. Note that the list of points changes all the time. and the closest distance ...