API Reference

This is the class and function reference for mouse_connectivity_models. Please refer to the full user guide for further details.

mcmodels.core: Core data related classes and utility functions

The mcmodels.core module implements objects useful in data manipulation.

User Guide See the Working with data from the AllenSDK section for further details.

core.VoxelData(cache[, …]) Container class for voxel-scale grid data.
core.RegionalData(cache[, …]) Container class for regionalized voxel-scale grid data.
core.Experiment([injection_density, …]) Class containing the data from an anterograde injection
core.Mask(reference_space[, structure_ids, …]) Object for masking the grid data from allensdk.
core.VoxelModelCache([resolution, cache, …]) Cache class extending MouseConnectivityCache to cache voxel model data.
core.VoxelModelApi([base_uri]) HTTP Client extending MouseConnectivityApi to download model data.

Utitility fucntions

Module containing utility functions for the mcmodels.core module.

core.utils.compute_centroid(injection_density) Computes centroid in index coordinates.
core.utils.get_injection_hemisphere_id(…) Gets injection hemisphere based on injection density.

mcmodels.regressors: Classes for Performing Regressions

The mcmodels.regressors module implements scikit-learn style estimators for solving various regression problems. It implements the NadarayaWatson regressor, and both regularized (L2) and non-regularized non-negative least squares linear models.

mcmodels.regressors.nonnegative_linear: Nonnegative Linear Least squares

The mcmodels.regressors.nonnegative_linear module implements linear models subject to the nonnegativity constraint. It includes Nonnegative linear regression and experimental modules implementing Nonnegative linear regression with L2 (Ridge) regularization.

Note

User Guide See the Nonnegative Least Squares Regression section for further details.

Classes

regressors.NonnegativeLinear Nonnegative least squares linear model.
regressors.NonnegativeRidge([alpha, solver]) Nonnegative least squares with L2 regularization.

Functions

regressors.nonnegative_regression(X, y[, …]) Solve the nonnegative least squares estimate regression problem.
regressors.nonnegative_ridge_regression(X, …) Solve the nonnegative least squares estimate ridge regression problem.

mcmodels.regressors.nonparametric: Nonparametric Regression

The mcmodels.regressors.nonparametric module implements Nonparametric regression models and the polynomial family of kernels. This module includes NadarayaWatson regression and the general Polynomial kernel.

User Guide See the Nonnparametric Regression section for further details.

regressors.NadarayaWatson([kernel, degree, …]) NadarayaWatson Estimator.
regressors.NadarayaWatsonCV(param_grid[, …]) NadarayaWatson Estimator with built in Leave-one-out cross validation.

mcmodels.models: Published Mesoscale Connectivity Models

The mcmodels.models module implements models that have been developed here at the Allen Institute for modeling mesoscale connectivity in the mouse. The module contains a HomogeneousModel similar to Oh et al. 2014 as well as the recent VoxelModel from Knox et al. 2018.

mcmodels.models.homogeneous: Homogeneous Regional Model

The mcmodels.models.homogeneous module implements a Homogeneous Model for predicting regional connectivity similar to Oh et al. 2014. Additionally, the module implements greedy forward/backward subset selection algorithms to improve the conditioning of given input arrays.

User Guide See the HomogeneousModel similar to [Oh2014] section for further details.

Classes

models.HomogeneousModel([kappa]) Homogeneous model similar to Oh et al.

Functions

models.homogeneous.svd_subset_selection(X, n) svd subset selection to return n cols that are less linearly dependent.
models.homogeneous.forward_subset_selection_conditioning(X) Conditioning through subselecting columns of X.
models.homogeneous.backward_subset_selection_conditioning(X) Conditioning through subselecting columns of X.

mcmodels.models.voxel: Voxel-scale Model

The mcmodels.models.voxel module implements the voxel scale model or predicting voxel-scale connectivity from Knox et al. 2018. The module also contains a VoxelConnectivityArray class to work with the model in memory (implicitly computing its weights) and a RegionalizedModel class to integrate the model weights to the regional level.

User Guide See the New Voxel-scale Connectivity Model [Knox2018] section for further details.

models.VoxelModel(source_voxels[, kernel, …]) Voxel-scale interpolation model for mesoscale connectivity.
models.voxel.RegionalizedModel(weights, …) Regionalization/Parcelation of VoxelModel.
models.voxel.VoxelConnectivityArray(weights, …) Class for implicit construction of the voxel model.

mcmodels.utils: Utilities

Module containing utility functions

utils.get_experiment_ids(mcc, structure_ids) Returns all experiment ids with injection in structure_ids.
utils.lex_ordered_unique(ar, lex_order[, …]) np.unique in a given order.
utils.nonzero_unique(ar, \*\*unique_kwargs) np.unique returning only nonzero unique elements.
utils.ordered_unique(ar, \*\*unique_kwargs) np.unique in the order in which the unique values occur.
utils.padded_diagonal_fill(arrays) Returns array filled with uneven arrays padding with zeros.
utils.unionize(volume, key[, return_regions]) Unionize voxel data to regional data.