Regression
Functions
cross_validation_ridge_regression(X_data_list, y_data_list, n_splits, score_fct, alphas=np.logspace(-3, 3, 7))
Cross validate ridge regression
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X_data_list |
List[ndarray]
|
List of X data as np array for each story |
required |
y_data_list |
List[ndarray]
|
List of fmri data as np array for each story. Must be in same order as X_data_list. |
required |
n_splits |
int
|
Cross validation splits |
required |
score_fct |
fct(np.ndarray, np.ndarray) -> np.ndarray
|
A function taking y_test (shape = (number_trs, n_voxels)) and y_predict (same shape as y_test) and returning an array with an entry for each voxel (shape = (n_voxels)) |
required |
alphas |
ndarray
|
Array of alpha values to optimize over |
logspace(-3, 3, 7)
|
Source code in src/regression.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
score_correlation(y_test, y_predict)
Returns the correlations for each voxel given predicted and true data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_test |
ndarray
|
shape = (number_trs, n_voxels) |
required |
y_predict |
ndarray
|
shape = (number_trs, n_voxels) |
required |
Returns:
Type | Description |
---|---|
ndarray
|
shape = (n_voxels) |
Source code in src/regression.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|