Skip to content

romain-fontugne/pybursts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pybursts

Changelog

0.1.2

Description

This is a Python port of the R implementation of Kleinberg's algorithm (described in 'Bursty and Hierarchical Structure in Streams'). The algorithm models activity bursts in a time series as an infinite hidden Markov model.

Installation

pip install pybursts

or

easy_install pybursts

Dependencies

Usage

import pybursts

offsets = [4, 17, 23, 27, 33, 35, 37, 76, 77, 82, 84, 88, 90, 92]
print pybursts.kleinberg(offsets, s=2, gamma=0.1)

Input

  • offsets: a list of time offsets (numeric)
  • s: the base of the exponential distribution that is used for modeling the event frequencies
  • gamma: coefficient for the transition costs between states

This version also alows to set n and T in order to have a fixed cost function (not dependent of the given offsets). Which is needed if you want to compare bursts for different inputs.

Output

An array of intervals in which a burst of activity was detected. The first column denotes the level within the hierarchy; the second column the start value of the interval; the third column the end value. The first row is always the top-level activity (the complete interval from start to finish).

References

About

A Python port of the R implementation of Kleinberg's burst detection algorithm

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%