Git Product home page Git Product logo

137-stopmove's Introduction

137-stopmove

A module for TrajSuite. Algorithms to automatically discover stops and moves in GPS trajectories.

White-paper describing POSMIT can be found here.

Algorithms

  • POSMIT - Probability of Stops and Moves in Trajectories. Uses a probabilistic approach to determine if a given entry in the trajectory is stopping or moving. Unlike traditional approaches POSMIT allows the user filter out low probability stops using the minimum stop probability parameter. Also, POSMIT comes with some heuristics to estimate its parameters.
  • CB-SMoT - Clustering-based Stop and Moves of Trajectories. Uses a modified DB-SCAN algorithm to find stops.
  • SMoT - Stops and Moves of Trajectories. Uses predefined regions to search for a minimum duration stay within those region. Unlike the original algorithm our implementation creates these regions by divided up the studying region into uniform cells. The original algorithms calls for the author to pass in interesting regions.

Usages

Below are some code usages for each of the algorithms provided in this repo.

POSMIT*

//load in a trajectory to process
STTrajectory traj = ....
//how many entries to search either side of each entry 
int nSearchRadius = 2;
//how much a stop can spatially jitter around and still be considered a stop (remember GPS is quite noisy)
double stopVariance = 1.5;
//intialise the actual POSMIT algorithm
POSMIT algo = new POSMIT();
//find the stop probability for each entry in the trajectory
double[] stopProbabilities = algo.run(traj, nSearchRadius, stopVariance);
//set a threshold for an entry to be classified as a stop, otherwise it is a move.
//i.e in this case only entries with an 80% or higher probability become stops,
//whilst lower probability entries become moves.
double minStopConfidence = 0.8;
//convert the trajectory into a trajectory with stop/move annotations at each entry
STStopTrajectory stopTraj = algo.toStopTrajectory(traj, stopProbabilities, minStopConfidence);

*Note: see FindStopsPOSMIT.java for a full example.

CB-SMoT*

//load in a trajectory to process
STTrajectory traj = ....
//Much like DB-SCAN you must specify a spatial epsilon to control cluster growth
double epsMeters = 1.5;
//CB-SMoT introduces a concept that a cluster can only become a stop if it has a 
//total duration equal to or exceeding a user-specified minimum stop duration
long minTimeMillis = 3000L;
//run the CB-SMoT algorithm
STStopTrajectory outTraj = new CBSMoT().run(traj, epsMeters, minTimeMillis);

*Note: see FindStopsCBSmot.java for a full example.

Working with the source

The source is licensed under the MIT licsense so feel free to use it in your projects. It does have some dependencies which are listed in the build.gradle file. The easiest use-case is setting the source up as a gradle project and letting gradle grab those dependencies for you. Next easiest is maven, though you will have translate the dependencies yourself.

Using this project as a library in your own project, your build.gradle file will have to include these:

repositories {
    maven{url 'https://dl.bintray.com/lukehb/137-stopmove'} //hosted on bintray
}

dependencies {
    compile 'onethreeseven:stopmove:0.0.4'
}

....Or without cloning, the built source is also hosted on BinTray and can be downloaded: Download

137-stopmove's People

Contributors

lukehb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

137-stopmove's Issues

Problem running projects gradle

Hey everybody.
I am facing a problem while trying to get project dependencies.
I ran gradle at project's root directory, then the following error occurred.

I'm using:
~ Java 1.8
~ Gradle 2.10
~ Ubuntu 16.04

The error...

$ gradle

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/tales/dev/137-stopmove/build.gradle' line: 94

  • What went wrong:
    A problem occurred evaluating root project 'stopmove'.

Could not resolve all dependencies for configuration ':compile'.
Could not find onethreeseven:jclimod:0.0.1-SNAPSHOT.
Searched in the following locations:
https://jcenter.bintray.com/onethreeseven/jclimod/0.0.1-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/onethreeseven/jclimod/0.0.1-SNAPSHOT/jclimod-0.0.1-SNAPSHOT.pom
https://jcenter.bintray.com/onethreeseven/jclimod/0.0.1-SNAPSHOT/jclimod-0.0.1-SNAPSHOT.jar
https://repo1.maven.org/maven2/onethreeseven/jclimod/0.0.1-SNAPSHOT/maven-metadata.xml
https://repo1.maven.org/maven2/onethreeseven/jclimod/0.0.1-SNAPSHOT/jclimod-0.0.1-SNAPSHOT.pom
https://repo1.maven.org/maven2/onethreeseven/jclimod/0.0.1-SNAPSHOT/jclimod-0.0.1-SNAPSHOT.jar
file:/home/tales/.m2/repository/onethreeseven/jclimod/0.0.1-SNAPSHOT/maven-metadata.xml
file:/home/tales/.m2/repository/onethreeseven/jclimod/0.0.1-SNAPSHOT/jclimod-0.0.1-SNAPSHOT.pom
file:/home/tales/.m2/repository/onethreeseven/jclimod/0.0.1-SNAPSHOT/jclimod-0.0.1-SNAPSHOT.jar
Required by:
onethreeseven:stopmove:0.0.5-SNAPSHOT
Could not find onethreeseven:datastructures:0.0.4-SNAPSHOT.
Searched in the following locations:
https://jcenter.bintray.com/onethreeseven/datastructures/0.0.4-SNAPSHOT/maven-metadata.xml
https://jcenter.bintray.com/onethreeseven/datastructures/0.0.4-SNAPSHOT/datastructures-0.0.4-SNAPSHOT.pom
https://jcenter.bintray.com/onethreeseven/datastructures/0.0.4-SNAPSHOT/datastructures-0.0.4-SNAPSHOT.jar
https://repo1.maven.org/maven2/onethreeseven/datastructures/0.0.4-SNAPSHOT/maven-metadata.xml
https://repo1.maven.org/maven2/onethreeseven/datastructures/0.0.4-SNAPSHOT/datastructures-0.0.4-SNAPSHOT.pom
https://repo1.maven.org/maven2/onethreeseven/datastructures/0.0.4-SNAPSHOT/datastructures-0.0.4-SNAPSHOT.jar
file:/home/tales/.m2/repository/onethreeseven/datastructures/0.0.4-SNAPSHOT/maven-metadata.xml
file:/home/tales/.m2/repository/onethreeseven/datastructures/0.0.4-SNAPSHOT/datastructures-0.0.4-SNAPSHOT.pom
file:/home/tales/.m2/repository/onethreeseven/datastructures/0.0.4-SNAPSHOT/datastructures-0.0.4-SNAPSHOT.jar
Required by:
onethreeseven:stopmove:0.0.5-SNAPSHOT

Why sumVariance variable in computeAverageVarianceX function is declared as an int?

Hey @lukehb,

Referring to

private double computeAverageVarianceX(double[][] data){
int sumVariance = 0;
for (int i = 0; i < data.length - 1; i++) {
sumVariance += data[i + 1][0] - data[i][0];
}
return sumVariance / (data.length - 1);
}

Given an input data as following:

          double[][] testData = new double[][]{
          new double[]{0.0, 5.923242512330992},
          new double[]{0.043696938252423816, -0.043696938252423816},
          new double[]{0.11389740929051247, -0.11389740929051247},
          new double[]{0.18409788032860114, -0.18409783529265278},
          new double[]{0.25429835136668977, -0.2007586718855742},
          new double[]{0.32449882240477845, -0.17748831851551608},
          new double[]{0.3946992934428671, -0.18557758044689213},
          new double[]{0.4648997644809557, -0.2427806635806458},
          new double[]{0.5351002355190444, -0.30012371189405407},
          new double[]{0.6053007065571331, -0.362525750626968},
          new double[]{0.6755011775952217, -0.4327262042475261},
          new double[]{0.7457016486333103, -0.5029266656935427},
          new double[]{0.815902119671399, -0.5633790818144169},
          new double[]{0.8861025907094875, -0.6116589286880814},
          new double[]{0.9563030617475762, -0.3541192275919637},
          new double[]{1.0, 0.0}};

The function returns 0.0. Probing further, it looks like sumVariance is being 0. Changing it to double returns 0.06666666666666667. Is there any reason why sumVariance is declared as an int?

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.