Skip to content

A class for using ML algorithms for spike prediction

License

Notifications You must be signed in to change notification settings

KordingLab/spykesML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpykesML

How to build encoding models with machine learning methods

This repository accompanies "Modern Machine Learning Far Outperforms GLMs at Predicting Spikes"[https://doi.org/10.1101/111450].

Here you can find a Python class MLencoding that you can use for quickly making encoding models. For a tutorial on how to use MLencoding, see the notebooks folder.

The notebooks folder also has a "standalone notebook" that demos how to use some ML methods without our fancy class.

Currently implemented methods:

  • GLM
  • 2-layer feedforward net
  • Random forest
  • xgboost
  • LSTM With
  • k-fold cross-validation
  • spike and covariate history options and more!

Installation

In a terminal:

git clone https://github.com/KordingLab/spykesML
cd spykesML
python setup.py install

Quick how-to:

Build the encoder:

model = MLencoding(tunemodel = 'xgboost')
print(model.params)

Fit and predict to some data:

model.fit(X_train, y_train)
Y_hat = model.predict(X_test)

Perform k-fold cross-validation:

model.fit_cv(X,y)

Use spike and covariate history as inputs:

xgb_history = MLencoding(tunemodel = 'xgboost',
                         cov_history = True, spike_history=True,
                         window = 50, #this dataset has 50ms time bins
                         n_filters = 4,
                         max_time = 250 ) #in ms
xgb_history.fit_cv(X,y, verbose = 2, continuous_folds = True)

See the tutorial for how to define parameters and build new encoding models.

Dependencies

Basics

  • numpy
  • pandas
  • scipy
  • matplotlib

Methods

  • sklearn
  • pyglmnet (glm)
  • xgboost
  • theano (NN)
  • keras (NN)

predictfirst

About

A class for using ML algorithms for spike prediction

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •