mcmodels.models.HomogeneousModel¶
-
class
mcmodels.models.
HomogeneousModel
(kappa=1000)[source]¶ Homogeneous model similar to Oh et al. 2014.
Implements the Homogeneous model for fitting nonnegative weights at the regional level. There is an additional constraint on the features to ensure the regression is well conditioned.
Parameters: - kappa : float, optional, default: 1000
The maximum condition number allowed for input data arrays.
References
- Oh et al. 2014. A mesoscale connectome of the mouse brain. Nature,
- 508(7495), 207-214. doi: 10.1038/nature13186
Examples
>>> from mcmodels.core import VoxelModelCache, RegionalData >>> from mcmodels.models import HomogeneousModel >>> # get data with whcich to fit model >>> cache = VoxelModelCache() >>> voxel_data = cache.get_experiment_data() >>> regional_data = RegionalData.from_voxel_data(voxel_data) >>> # fit model >>> reg = HomogeneousModel() >>> reg.fit(regional_data.injections, regional_data.projections) HomogeneousModel(kappa=1000)
Attributes: - columns_ : array
The features that are included in the regression after the conditioning has occurred.
- coef_ : array, shape (n_targets, n_features)
The model weights.
Methods
fit
(self, X, y[, sample_weight])Fit HomogeneousModel. get_params
(self[, deep])Get parameters for this estimator. predict
(self, X)Predict using the HomogeneousModel. score
(self, X, y[, sample_weight])Returns the coefficient of determination R^2 of the prediction. set_params
(self, \*\*params)Set the parameters of this estimator. Methods
__init__
(self[, kappa])fit
(self, X, y[, sample_weight])Fit HomogeneousModel. get_params
(self[, deep])Get parameters for this estimator. predict
(self, X)Predict using the HomogeneousModel. score
(self, X, y[, sample_weight])Returns the coefficient of determination R^2 of the prediction. set_params
(self, \*\*params)Set the parameters of this estimator. -
fit
(self, X, y, sample_weight=None)[source]¶ Fit HomogeneousModel.
Parameters: - X : array, shape (n_samples, n_features)
Training data.
- y : array, shape (n_samples, n_features)
Target values.
Returns: - self : returns an instance of self
-
predict
(self, X)[source]¶ Predict using the HomogeneousModel.
Parameters: - X : array, shape (n_samples, n_features)
Training data.
Returns: - C : array, shape (n_samples,) or (n_samples, n_targets)
Returns predicted values.
-
weights
¶ Convenience property for pulling out regional matrix.