Giter Site home page Giter Site logo

adaptivememorymodel's Introduction

AdaptiveMemoryModel

DOI

This script provides a way to build the models used in[1], either markovian or adaptive memory model of any order.

Requirements

Packages

The software is written in R and it uses the following packages:

  • data.table
  • plyr
  • docopt

If you want to run it using multi core capabilities, the execution requires the use of the package doMC.

To install the required packages make use of the following instruction.

install.packages("data.table", "plyr", "docopt", "doMC")

Input file

The input file must be provided in CSV format and it must contain records of the position of an agent or multiple agents over time. It has to be composed by the following columns:

  • agentId: The id of the agent who has generated the record.
  • timestamp: information about the moment when the position has been recorded. Any sortable format will work.
  • localizationId: id of the location.

Usage

The call to the script has to fulfill the following format:

Rscript get_model.R (--adaptive | --markovian) --order <order> --input <input> --output <output> [--cores <num_cores> --minimum_events <events>]

Parameters

  -h --help                             Show this screen.
  -i <input>, --input <input>           Three column input CSV FILE in the form of (agent id, timestamp, location id).
  -o <output>, --output <output>        Output file where to store the model.
  -a, --adaptive                        Adaptive memory model.
  -m, --markovian                       Markovian model.
  -n <order>, --order <order>           Order of the model.
  -c <num_cores>, --cores <num_cores>   Number of CPU cores used to compute the model [default: 1]
  --minimum_events <events>             Minimum number of evets to consider [default: <order> + 1]

Output

The output of the execution will be stored in the in a CSV file with the following format:

  • The first norder columns: contain the encoding of the source following the format Src1, Src2,..., SrcN, being the last one the most recent position.
  • The next norder columns: contain the encoding of the destination following the format Target1, Target2,..., TargetN, being the last one the most recent position.
  • Transition probability: the last column contain the transition from source to destination.

Example

As an example of the usage, let's consider the following command to generate an adaptive memory model of second order using the data stored in test/data.csv and store the results in a file called test.csv:

Rscript get_model.R -i test/data.csv -o test.csv -a -n 2

References

  1. Matamalas, Joan T., Manlio De Domenico, and Alex Arenas. "Assessing reliable human mobility patterns from higher order memory in mobile communications." Journal of The Royal Society Interface 13.121 (2016): 20160203.

adaptivememorymodel's People

Contributors

jtmatamalas avatar

Stargazers

Manlio De Domenico avatar

Watchers

 avatar Manlio De Domenico avatar

Forkers

manlius

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.