Subscribe to DSC Newsletter

This is a follow up to our video series From chaos to clusters, made with data points moving over time to form clusters, and produced with open source and home-made data science algorithms.

See below two frames from the new video, now featuring line segments connecting a current point to its location in the previous frame. These line segments are overwritten and change constantly from iteration to iteration, creating a "shooting stars" visual effect when you watch the video.

Towards the end of the video, the clusters are well formed (though they are also moving, especially the one at the bottom right corner) and points coming from outside are progressively attracted to the nearest cluster: you can see them quickly getting close and then get absorbed. 

Here are the two new videos:

Download the data file rfile3.txt used to produce these videos, (also available in compressed format). These videos are based on the following R script (a more complex version of our initial R script):

R Source code

for (n in 1:199) {
  x<-vv$x[iter == n];
  y<-vv$y[iter == n];
  z<-vv$new[iter == n];
  u<-vv$d2init[iter == n];
  v<-vv$d2last[iter == n];
  p<-vv$x[iter == n-1];
  q<-vv$y[iter == n-1];
  if (n==1) {
    plot(p,q,xlim=c(-0.08,1.08),ylim=c(-0.08,1.09),pch=20,cex=0,col=rgb(1,1,0),xlab="",ylab="",axes=TRUE  );


segments(p,q,x,y,col=rgb(0,0,1)); # arrows segments

Related articles

Views: 6941


You need to be a member of AnalyticBridge to add comments!

Join AnalyticBridge

Comment by Vincent Granville on May 2, 2013 at 4:33pm

All the source code (R and Perl) is accessible from the article (follow the links). It's actually quite compact (< 200 lines total). Another guy (Carlos Ortegas) successfully implemented it on his machine and translated my script (to produce the data) from Perl to R. His source code is also in my article. Looks like his R code is slower, but I think it's because he did not pre-compute all the 50 million distances and the location of the 100,000 dots that appear in the video, at a rate of 500 dots per frame (200 frames total). In short, my video is running very fast because I just upload the 100,000 coordinates in memory, then let the streaming happen and record the video.

On Data Science Central

© 2021   TechTarget, Inc.   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service