alexminnaar / time-series-classification-and-clustering Goto Github PK
View Code? Open in Web Editor NEWTime series classification and clustering code written in Python.
Time series classification and clustering code written in Python.
Thanks for the excellent ipython notebook.
I have a doubt, can you please clarify.
Using k-means clustering, what is the conclusion? there are no clusters as such.
How can we predict cluster number for a new input, based on such results?
Please revert back.
I see that tslearn.clustering natively supports dynamic time warping via TimeSeriesKMeans.
However, TimeSeriesKMeans is quite slow. I would like to use this implementation which from the code looks like it has more optimization via locality constraints. I'm not sure it's actually faster but I have my fingers crossed it is.
Can someone point me to how I can use @alexminnaar's implementation to output cluster labels per series?
I can see that this implementation robustly outputs the average cluster curves but I don't see it outputting the labels for the entire time series data.
I suspect it is in this block, but I'm having trouble parsing it.
if closest_clust in assignments: assignments[closest_clust].append(ind) else: assignments[closest_clust]=[]
Any pointers would be appreciated.
Hi Alex, Can you please tell about/ describe a bit of data. What number or the row suggest what.?
I've followed the exact method (for Kmean Clustering) you've written in the tutorial.
But it generates following error:
100
iteration 1
100
iteration 2
69
iteration 3
48
iteration 4
38
Traceback (most recent call last):
File "spatio-time cluster.py", line 177, in <module>
for i in centroids:
TypeError: 'NoneType' object is not iterable
The datasets are same as your Github repo. I am also attaching the code. Please let me know, where I am doing wrong.
if closest_clust in assignments:
assignments[closest_clust].append(ind)
else:
assignments[closest_clust]=[]
this code is error! when the element match the clus , the element will not append to the clust ,it make the result error!the right code like this:
assignments.setdefault(closest_clust,[])
assignments[closest_clust].append(ind)
#recalculate centroids of clusters
for key in self.assignments:
clust_sum=0
for k in self.assignments[key]:
clust_sum=clust_sum+data[k]
self.centroids[key]=[m/len(self.assignments[key]) for m in clust_sum]-- error in this line,int is not iterable.
change clust_sum declaration to np.zeros(len(data[0]))
change clust_sum=clust_sum+data[k] to clust_sum=np.add(clust_sum,data[k])
change it to following code
#recalculate centroids of clusters
for key in self.assignments:
clust_sum=np.zeros(len(data[0]))
for k in self.assignments[key]:
clust_sum=np.add(clust_sum,data[k])
self.centroids[key]=[m/len(self.assignments[key]) for m in clust_sum]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.