In the second, we will show how to use and customize the algorithm in Python.Neuroimage Algorithms and GPS Trajectories ClusteringInstead using classical clustering algorithms like K-Means or DBSCAN, in this article we use a clustering algorithm used in neuromaging.QuickBundles (QB) is a simple compact clustering algorithm used in magnetic resonance imaging to cluster white matter fibers obtained from the application of tractography algorithms.Just by looking at the following image, we can see how the white matter fibers in our brain look like GPS trajectories.Example of white matter fibers obtained after application of tractography algorithm..Frontiers In Neuroscience, vol 6, 2016.The main idea is to treat each GPS trajectory as a white matter fiber and then merge “similar” trajectories in the same cluster..A nice overview of the dataset, with examples describing how to open and use it, is available here.Before starting to perform clustering, let’s plot all the trajectories on google maps using gmplot.GPS trajectories in datasetWe can now start by defining the distance function between two GPS trajectories (streamlines)..This way to compute the distance can be used if and only if the two trajectories have the same number of points, this is why we resampled all the trajectories using the ResampleFeature class.Once the distance between two trajectories is defined, we can run the QuickBundle clustering algorithm.Code to run the trajectory clusteringWe can then plot the trajectories contained in the different clusters on google maps using, as before, gmplot.Clustering plot using gmplotHere the result in my_map.html plot for different clustersCluster #0Cluster #2Cluster #30ConclusionsIn this article we described a simple and fast way to perform trajectories clustering of GPS data.. More details