Coder Social home page Coder Social logo

Comments (6)

seljukgulcan avatar seljukgulcan commented on May 24, 2024

Hello, Baoxin1997,

You can look at https://github.com/Shathra/comparing-trajectory-clustering-methods/blob/master/demo/demo.ipynb for a start. If you can convert your data into the format described on the link (each trajectory should be (N, 2) shaped NumPy array), then the code should work. To do that, you may need to group your data by track ID and sort by timestamp. Please check out a NumPy quickstart tutorial if you don't know how to import, edit, sort, etc. an array using Numpy.

Also, euclidian distance doesn't make sense for polar coordinates. You may need to either use haversine distance or project your coordinates into a cartesian plane. The latter may not work if you are working on world-scale data. For more information, you can look at this wiki page: https://en.wikipedia.org/wiki/Geographic_coordinate_system#Grid_coordinates

from comparing-trajectory-clustering-methods.

Baoxin1997 avatar Baoxin1997 commented on May 24, 2024

from comparing-trajectory-clustering-methods.

seljukgulcan avatar seljukgulcan commented on May 24, 2024

Sorry, I'm not familiar with MATLAB. If you have a file that NumPy can import, you can import with numpy.load or numpy.loadtxt depending on the format of the file. Please refer to the corresponding documentation pages for more info.

from comparing-trajectory-clustering-methods.

Baoxin1997 avatar Baoxin1997 commented on May 24, 2024

Ok, I will try for it. Also, I make a dataset like you give me in demo, especially the 'cross.mat' one. If I want to use this file, how could I do for it? Because in demo code, you dwonload the dataset with a link not use a local file.

from comparing-trajectory-clustering-methods.

seljukgulcan avatar seljukgulcan commented on May 24, 2024

These are the lines you're looking for. Depending on your data, you may need to tweak some lines. After importing and preprocessing your data, traj_lst object should be a list of trajectories where each trajectory is represented by a (N, 2) NumPy array.

# Import dataset
traj_data = scipy.io.loadmat(filename)['tracks']

traj_lst = []
for data_instance in traj_data:
    traj_lst.append(np.vstack(data_instance[0]).T)

If it doesn't work please provide a sample output you get after you load your file with scipy.io.loadmat function.

Edit: 'track' key in the code might be something else for your data.

from comparing-trajectory-clustering-methods.

Baoxin1997 avatar Baoxin1997 commented on May 24, 2024

Really*N thanks!

I finish my work perfectly with your help. You are really kindly for me.

Let me thank you again!

from comparing-trajectory-clustering-methods.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.