Giter VIP home page Giter VIP logo

neymanscottprocesses.jl's Introduction

NeymanScottProcesses.jl

Neyman-Scott processes in Julia.

Yixin Wang, Anthony Degleris, Alex Williams, Scott Linderman.
Spatiotemporal Clustering with Neyman-Scott Processes via Connections to Bayesian Nonparametric Mixture Models.

Installation

First, download and install Julia. Then run julia from the terminal to open the Julia REPL. From the REPL, type ] to enter package mode and run

pkg> add https://github.com/lindermanlab/NeymanScottProcesses.jl

to install this package. If you want to plotting capabilities, you'll also need to run

pkg> add Plots

to install Plots. Finally, press backspace / delete to exit package mode.

Neural Spike Modeling

If you're interested in using Neyman-Scott processes for modeling neural spike trains, please check out PPSeq.jl.

JASA Reproducibility

If you are interested in reporoducing our results from our JASA paper, please read the sections below to reproduce individual experiments and figures.

Installation and Setup

Reproducing experimental results will require cloning the repository directly and activating the Julia environments used to generate each figure. To download the respository, first install Julia and downlod the respository:

git clone https://github.com/lindermanlab/NeymanScottProcesses.jl.git

Next, from the NeymanScottProcesses directory, run:

julia setup.jl

This will download and install all the project dependencies specified in Project.toml, as well as experiment specific dependencies.

Interactive Experiments

Some experiments were developed using Pluto notebooks. All Pluto notebooks use plain .jl files and can be run as normal Julia scripts. However, if you'd like to run them interactively, we recommend you install pluto using the Julia package manager (type ] from the REPL)

pkg> add Pluto

Running a Pluto notebook server is than as simple as running:

julia> using Pluto
julia> Pluto.run()

All the notebooks will automatically activate the relevant environments installed in the previos section.

Figure 2 - Synthetic draws from NSPs and DPMMs

To reproduce Figure 2, run the following script (or open it in a Pluto notebook):

julia experiments/dpm_limit/example_data.jl

Figure 3 - Sampler performance

To reproduce Figure 3, run the following script (or open it in a Pluto notebook):

julia experiments/dpm_limit/cj_vs_rj.jl

Figure 4 - NSP and DPMM modeling performance

To reproduce Figure 4, run the following script (or open it in a Pluto notebook):

julia experiments/dpm_limit/nsp_vs_dpm.jl

Figure 5 - Neural modeling

The code used to generate Figure 5 comes from an older repository that specifically considers Neyman-Scott processes for modeling neural spike trains. All of this code is available in the ppseq/ directory. Specifically, source code is in ppseq/PointProcessSequences/ and experiment scripts are in ppseq/ppseq/. For each panel in Figure 6, the data is generated by running a script of the form:

julia ppseq/ppseq/launch_<experiment_name>.jl

After generating the results, figures can be reproduced using the code in ppseq/ppseq/figures/.

Figure 6 - Document modeling

To reproduce Figure 6, you'll need acquire the embassy document stream dataset from the authors and place it in experiments/embassy/raw/raw. Once you've acquired the data, you can run the following scripts to generate the results:

julia experiments/embassy/run_baseline.jl
julia experiments/embassy/run_nsp.jl

These may take some time. You can then plot the results by running the following script (or opening it in Pluto):

julia experiments/embassy/make_plots.jl

neymanscottprocesses.jl's People

Contributors

degleris1 avatar ahwillia avatar yixinwang avatar

Stargazers

Maxsuel F de Almeida avatar  avatar Yasuo Kabe avatar Bryan avatar Linwei Sang avatar Simon Dirmeier avatar Diana Cai avatar Ryan Young avatar  avatar

Watchers

 avatar Scott Linderman avatar  avatar  avatar

neymanscottprocesses.jl's Issues

Gaussian example throws initialization error

Hi,

Just following along in the gaussian.jl example, I get an error at https://github.com/lindermanlab/NeymanScottProcesses.jl/blob/838505cb924e6f2bc8a2e80a16b2e4e24d7596e2/examples/gaussian.jl#L68:

ERROR: BoundsError: attempt to access 0-element Vector{Any} at index [0]
Stacktrace:
 [1] getindex
   @ ./essentials.jl:13 [inlined]
 [2] last(a::Vector{Any})
   @ Base ./abstractarray.jl:520
 [3] (::GibbsSampler)(model::GaussianNeymanScottModel{2}, data::Vector{RealObservation{2}}; initial_assignments::Vector{Int64})
   @ NeymanScottProcesses ~/.julia/packages/NeymanScottProcesses/VzzXx/src/samplers/gibbs.jl:76
 [4] (::MaskedSampler{CircleMask{2}})(model::GaussianNeymanScottModel{2}, unmasked_data::Vector{RealObservation{2}}; initial_assignments::Vector{Int64})
   @ NeymanScottProcesses ~/.julia/packages/NeymanScottProcesses/VzzXx/src/samplers/mask.jl:61
 [5] (::Annealer)(model::GaussianNeymanScottModel{2}, data::Vector{RealObservation{2}}; initial_assignments::Symbol)
   @ NeymanScottProcesses ~/.julia/packages/NeymanScottProcesses/VzzXx/src/samplers/anneal.jl:62
 [6] (::Annealer)(model::GaussianNeymanScottModel{2}, data::Vector{RealObservation{2}})
   @ NeymanScottProcesses ~/.julia/packages/NeymanScottProcesses/VzzXx/src/samplers/anneal.jl:33
 [7] top-level scope
   @ REPL[246]:2

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.