Comments (4)
Hi @marcosterland,
In your example, ang
is of shape ang.reshape((-1, 1)).shape = (300, 1)
so it is a single vector there is not much to cluster.
The scipy.stats.vonmises routine only samples from a univariate vMF distribution. If you are trying to sample from a higher dimension mixture of vMF distribution, I recommend starting from this example: https://github.com/clara-labs/spherecluster/blob/develop/examples/small_mix_3d.py#L19-L36 and working with something like https://github.com/clara-labs/spherecluster/blob/develop/spherecluster/util.py .
cheers,
Jason
from spherecluster.
Actually I guess it's 300 vectors of length 1. In this case, normalizing each length-1 vector will result in the value 1 for each vector, making the exercise uneventful (which is why you get
[[ 1.]
[ 1.]
[ 1.]]
as output).
from spherecluster.
Thanks for your quick reply @jasonlaska .
It does make sense to cluster 1-D data. And in fact, the KMeans from scikit-learn finds the correct centers [[1.] [3.] [5.]]
on the generated data.
But the scikit-learn KMeans uses standard Euclidean distance instead of the circular, so it's not applicable on e.g. angles.
from spherecluster.
I refer you to https://en.wikipedia.org/wiki/Cosine_similarity, the cosine between any two scalars is going to be same (as they all lie on the same axis, the angle between all of them is 0); similarly the inner product between then (just multiplication) normalized by their abs values (just multiplication) will always result in 1 or -1. Since the cosine distance/similarity does not take into account scale (as the euclidean distance does), it doesn't make sense to cluster scalars in this way unless they are complex scalars of the form a + b * i
(and I'm not sure this package will handle that case).
I believe there might be a way to use the cosine distance in scikit-learn's k-means, you might want to give that a try.
from spherecluster.
Related Issues (20)
- VMF scaling denominator was inf HOT 8
- black dependency breaks python3.5 install HOT 4
- AttributeError: 'SphericalKMeans' object has no attribute '_check_fit_data' HOT 4
- Source install fails due exceptions in setup.py
- Question about sample_vMF HOT 8
- Initialization is using euclidean distance HOT 3
- Using Spherical clustering for Mini-Batch K-Means HOT 1
- Spherical K-Means is producing different results each run even when fixing `random_state` at an integer HOT 1
- TypeError: Expected sequence or array-like, got <class 'NoneType'> HOT 5
- ImportError: cannot import name '_k_means' HOT 10
- Returned labels are floats in VonMissesFisherMixture (soft and hard)
- pip package not up to date? HOT 8
- TypeError: _labels_inertia() got an unexpected keyword argument 'precompute_distances' HOT 2
- Mistake in sample_vMF HOT 1
- Error in _sample_orthonormal_to
- Cannot import spherecluster with scikit-learn 1.0.2: sklearn.cluster.k_means_ has been renamed HOT 3
- Using it for dataframe
- ValueError: Data l2-norm must be 1, found 0.0
- This repo is dead
- return value of movMF function includes None when n_jobs!=1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spherecluster.