Predictive Models
LinearCPMModel
Linear Connectome-based Predictive Modeling (CPM) implementation.
This class implements a linear CPM model, allowing for fitting and prediction based on connectome data, covariates, and residuals.
Attributes:
Name | Type | Description |
---|---|---|
models |
ModelDict
|
A dictionary containing the fitted models for different networks and data types (connectome, covariates, residuals, and full model). |
models_residuals |
dict
|
A dictionary storing linear regression models used to calculate residuals for connectome data, controlling for covariates. |
edges |
dict
|
A dictionary defining the edges (features) used for each network (e.g., 'positive', 'negative'). |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
edges
|
dict
|
Dictionary containing indices of edges for 'positive' and 'negative' networks. |
required |
__init__(edges)
Initialize the LinearCPMModel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
edges
|
dict
|
Dictionary containing indices of edges for 'positive' and 'negative' networks. |
required |
fit(X, y, covariates)
Fit the CPM model.
This method fits multiple linear regression models for the connectome, covariates, residuals, and full model using the provided data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
ndarray
|
A 2D array of shape (n_samples, n_features) representing the connectome data. |
required |
y
|
ndarray
|
A 1D array of shape (n_samples,) representing the target variable. |
required |
covariates
|
ndarray
|
A 2D array of shape (n_samples, n_covariates) representing the covariates. |
required |
Returns:
Type | Description |
---|---|
LinearCPMModel
|
The fitted CPM model instance. |
predict(X, covariates)
Predict using the fitted CPM model.
This method generates predictions for the target variable using the connectome, covariates, residuals, and full models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
ndarray
|
A 2D array of shape (n_samples, n_features) representing the connectome data. |
required |
covariates
|
ndarray
|
A 2D array of shape (n_samples, n_covariates) representing the covariates. |
required |
Returns:
Type | Description |
---|---|
ModelDict
|
A dictionary containing predictions for each network and model type (connectome, covariates, residuals, and full model). |