navis 1.4.0
  • Install
  • Quickstart
  • Tutorials
  • API
  • Changelog
  • Github
  • Ecosystem
  • Site
    • Page
        • navis.connectivity_sparseness
          • connectivity_sparseness()

    navis.connectivity_sparseness¶

    navis.connectivity_sparseness(x, which='LTS')[source]¶

    Calculate sparseness.

    Sparseness comes in three flavors:

    Lifetime kurtosis (LTK) quantifies the widths of tuning curves (according to Muench & Galizia, 2016):

    S = \Bigg\{ \frac{1}{N} \sum^N_{i=1} \Big[ \frac{r_i - \overline{r}}{\sigma_r} \Big] ^4  \Bigg\} - 3

    where N is the number of observations, r_i the value of observation i, and \overline{r} and \sigma_r the mean and the standard deviation of the observations’ values, respectively. LTK is assuming a normal, or at least symmetric distribution.

    Lifetime sparseness (LTS) quantifies selectivity (Bhandawat et al., 2007):

    S = \frac{1}{1-1/N} \Bigg[1- \frac{\big(\sum^N_{j=1} r_j / N\big)^2}{\sum^N_{j=1} r_j^2 / N} \Bigg]

    where N is the number of observations, and r_j is the value of an observation.

    Activity ratio describes distributions with heavy tails (Rolls and Tovee, 1995).

    Notes

    NaN values will be ignored. You can use that to e.g. ignore zero values in a large connectivity matrix by changing these values to NaN before passing it to navis.sparseness.

    Parameters:
    • x (DataFrame | array-like) – (N, M) dataset with N (rows) observations for M (columns) neurons. One-dimensional data will be converted to two dimensions (N rows, 1 column).

    • which ("LTS" | "LTK" | "activity_ratio") – Determines whether lifetime sparseness (LTS) or lifetime kurtosis (LTK) is returned.

    Returns:

    pandas.Series if input was pandas DataFrame, else numpy.array.

    Return type:

    sparseness

    Examples

    Calculate sparseness of olfactory inputs to group of neurons:

    >>> import navis
    >>> import numpy as np
    >>> import matplotlib.pyplot as plt
    >>> # Get ORN response matrix from DoOR database
    >>> url = 'https://raw.githubusercontent.com/ropensci/DoOR.data/master/data/door_response_matrix.csv'
    >>> adj = pd.read_csv(url, delimiter=';')
    >>> # Calculate lifetime sparseness
    >>> S = navis.connectivity_sparseness(adj, which='LTS')
    >>> # Plot distribution
    >>> ax = S.plot.hist(bins=np.arange(0, 1, .1))
    >>> _ = ax.set_xlabel('LTS')
    >>> plt.show()                                              
    

    Back to top

    Source

    © Copyright 2018, Philipp Schlegel.
    Created using Sphinx 5.3.0.