|
29 | 29 | # Path of the data directory |
30 | 30 | # -------------------------- |
31 | 31 | from voxelwise_tutorials.io import get_data_home |
| 32 | + |
32 | 33 | directory = get_data_home(dataset="shortclips") |
33 | 34 | print(directory) |
34 | 35 |
|
|
108 | 109 | from voxelwise_tutorials.delayer import Delayer |
109 | 110 | from himalaya.kernel_ridge import KernelRidgeCV |
110 | 111 | from himalaya.backend import set_backend |
| 112 | + |
111 | 113 | backend = set_backend("torch_cuda", on_error="warn") |
112 | 114 |
|
113 | 115 | X_train = X_train.astype("float32") |
|
126 | 128 |
|
127 | 129 | ############################################################################### |
128 | 130 | from sklearn import set_config |
| 131 | + |
129 | 132 | set_config(display='diagram') # requires scikit-learn 0.23 |
130 | 133 | pipeline |
131 | 134 |
|
|
182 | 185 | # function. |
183 | 186 |
|
184 | 187 | import matplotlib.pyplot as plt |
185 | | -fig, axs = plt.subplots(6, 1, figsize=(8, 6.5), constrained_layout=True, |
186 | | - sharex=True) |
187 | | -times = np.arange(n_trs)*TR |
| 188 | + |
| 189 | +fig, axs = plt.subplots(6, 1, figsize=(8, 6.5), constrained_layout=True, |
| 190 | + sharex=True) |
| 191 | +times = np.arange(n_trs) * TR |
188 | 192 |
|
189 | 193 | axs[0].plot(times, y, color="r") |
190 | 194 | axs[0].set_title("BOLD response") |
191 | 195 | for i, (ax, xx) in enumerate(zip(axs.flat[1:], x_delayed.T)): |
192 | | - ax.plot(times, xx, color='k') |
193 | | - ax.set_title("$x(t - {0:.0f})$ (feature delayed by {1} sample{2})".format( |
194 | | - i*TR, i, "" if i == 1 else "s")) |
| 196 | + ax.plot(times, xx, color='k') |
| 197 | + ax.set_title("$x(t - {0:.0f})$ (feature delayed by {1} sample{2})".format( |
| 198 | + i * TR, i, "" if i == 1 else "s")) |
195 | 199 | for ax in axs.flat: |
196 | | - ax.axvline(40, color='gray') |
197 | | - ax.set_yticks([]) |
| 200 | + ax.axvline(40, color='gray') |
| 201 | + ax.set_yticks([]) |
198 | 202 | _ = axs[-1].set_xlabel("Time [s]") |
199 | 203 | plt.show() |
200 | 204 |
|
201 | | - |
202 | 205 | ############################################################################### |
203 | 206 | # Compare with a model without delays |
204 | 207 | # ----------------------------------- |
|
0 commit comments