GithubHelp home page GithubHelp logo

ganguli-lab / twpca Goto Github PK

View Code? Open in Web Editor NEW
122.0 122.0 24.0 44.4 MB

๐Ÿ• Time-warped principal components analysis (twPCA)

License: MIT License

Python 3.84% Makefile 0.03% Jupyter Notebook 96.13%
dimensionality-reduction neuroscience principal-components time-warp

twpca's People

Contributors

ahwillia avatar nhat-le avatar nirum avatar poolio avatar

Stargazers

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

Watchers

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

twpca's Issues

Handle variable length trials and data with NaN values

Trial lengths can be variable in some experiments. We should extend twPCA to handle this by simply ignoring NaN values in the data tensor. Users still specify the data as a trials x time x neuron array, but indicate missing data with nans.

Another possibility would be to pass in a vector holding the indices of trial start or end:

model = TWPCA(n_components).fit(data, trial_start=..., trial_end=...)

ImportError: DLL load failed: The specified module could not be found.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
     57 
---> 58   from tensorflow.python.pywrap_tensorflow_internal import *
     59 

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in <module>
     27             return _mod
---> 28     _pywrap_tensorflow_internal = swig_import_helper()
     29     del swig_import_helper

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()
     23             try:
---> 24                 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
     25             finally:

~\Anaconda3\lib\imp.py in load_module(name, file, filename, details)
    241         else:
--> 242             return load_dynamic(name, filename, file)
    243     elif type_ == PKG_DIRECTORY:

~\Anaconda3\lib\imp.py in load_dynamic(name, path, file)
    341             name=name, loader=loader, origin=path)
--> 342         return _load(spec)
    343 

ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-40-fe2dcd6c15ce> in <module>
----> 1 from twpca import TWPCA
      2 from twpca.datasets import jittered_neuron
      3 
      4 # generates a dataset consisting of a single feature that is jittered on every trial.
      5 # This helper function returns the raw feature, as well as the aligned (ground truth)

~\Anaconda3\lib\site-packages\twpca\__init__.py in <module>
      8 __version__ = '0.0.2'
      9 
---> 10 from .model import TWPCA
     11 from . import regularizers
     12 from . import utils

~\Anaconda3\lib\site-packages\twpca\model.py in <module>
      4 from tqdm import trange
      5 
----> 6 import tensorflow as tf
      7 from . import warp, utils
      8 from .regularizers import l2, curvature

~\Anaconda3\lib\site-packages\tensorflow\__init__.py in <module>
     39 import sys as _sys
     40 
---> 41 from tensorflow.python.tools import module_util as _module_util
     42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
     43 

~\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>
     48 import numpy as np
     49 
---> 50 from tensorflow.python import pywrap_tensorflow
     51 
     52 # Protocol buffers

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
     67 for some common reasons and solutions.  Include the entire stack trace
     68 above this error message when asking for help.""" % traceback.format_exc()
---> 69   raise ImportError(msg)
     70 
     71 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
  File "C:\Users\arpit\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\arpit\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\arpit\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\arpit\Anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\arpit\Anaconda3\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

abstract and poster is missing

For more information about TWPCA, you had provided "Abstract" and "poster". But the link does not work.
Please., correct these links.
Thank you

use mean instead of sum for reconstruction error

currently we compute reconstruction error by summing over comopnents. Instead, we should compute the mean by normalizing by the number of elements. This will hopefully make the choice of regularization hyperparameters more robust across datasets.

Improve transform for discrete data

For discrete data like spikes the transform function that maps the data into the aligned space can smear out the spikes in time, leading to continuous values. We should add an option to either round spikes to the nearest bin, or return the continuous times of the spikes in the aligned space.

New loss functions

Users should have the ability to specify different loss functions. A few easy ones:

  • Logistic loss (spiking data where there is at most 1 spike per bin)
  • Poisson loss (spiking data with multiple spikes per bin)
  • Gamma loss (for calcium imaging data)

In the case of Logistic/Poisson loss functions, this would remove the need to smooth the data as a preprocessing step (see #2), but would necessitate adding regularization for smoothness on the temporal factors. This could also help with #3 - e.g. the reconstruction can be interpreted as a probability of spiking in the logistic case.

append to obj_history

When calling fit, we should append to obj_history (instead of reinitializing it) if reinitialize is set to False

Add ability to smooth the data prior to learning warp functions?

Currently we do this for spiking datasets, but it is not a part of the twpca package yet. We could incorporate a smooth kwarg that applies some temporal smoothing to data before model.fit is called. Then model.transform would transform the original data.

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.