Comments (6)
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.
from comparing-trajectory-clustering-methods.
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.
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.
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.
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)
- Data files HOT 7
- Need some tips
- No such file or directory: '0.traj' HOT 1
- about silhouette method HOT 1
- data link HOT 12
- This data link is invalid 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 comparing-trajectory-clustering-methods.