ea5d191f7f71b6fa927a96ef4e785c762a54d5db,examples/decoding/plot_oasis_vbm_space_net.py,,,#,14
Before Change
ax1.plot(age_pred, "--", c="g", label="Fitted age", linewidth=linewidth)
ax1.set_ylabel("age")
plt.legend(loc="best")
ax2 = plt.subplot("212")
ax2.plot(age - age_pred, label="True age - fitted age", linewidth=linewidth)
ax2.set_xlabel("subject")
plt.legend(loc="best")
plt.show()
After Change
from nilearn.decoding import SpaceNetRegressor
import matplotlib.pyplot as plt
from nilearn.plotting import plot_stat_map
for penalty in ["tv-l1", "smooth-lasso"]:
decoder = SpaceNetRegressor(memory="cache", penalty=penalty, verbose=2)
decoder.fit(X_train, y_train) // fit
coef_img = decoder.coef_img_
y_pred = decoder.predict(X_test).ravel() // predict
mse = np.mean(np.abs(y_test - y_pred))
////// Visualization //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// weights map
background_img = X[0]
plot_stat_map(coef_img, background_img, title="%s weights" % penalty,
display_mode="z", cut_coords=3)
// quality of predictions
plt.figure()
plt.suptitle("%s: Mean Absolute Error %.2f years" % (penalty, mse))
linewidth = 3
ax1 = plt.subplot("211")
ax1.plot(y_test, label="True age", linewidth=linewidth)
ax1.plot(y_pred, "--", c="g", label="Predicted age", linewidth=linewidth)
ax1.set_ylabel("age")
plt.legend(loc="best")
ax2 = plt.subplot("212")
ax2.plot(y_test - y_pred, label="True age - predicted age",
linewidth=linewidth)
ax2.set_xlabel("subject")
plt.legend(loc="best")
plt.show()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: nilearn/nilearn
Commit Name: ea5d191f7f71b6fa927a96ef4e785c762a54d5db
Time: 2015-07-28
Author: elvis.dohmatob@inria.fr
File Name: examples/decoding/plot_oasis_vbm_space_net.py
Class Name:
Method Name:
Project Name: nilearn/nilearn
Commit Name: ba96096f784a73ce0d14b0b72e757c0fdbf331db
Time: 2015-07-28
Author: elvis.dohmatob@inria.fr
File Name: examples/decoding/plot_oasis_vbm_space_net.py
Class Name:
Method Name:
Project Name: rodluger/starry
Commit Name: 03b04a9921afe6953d460c49e39067326e8a73a8
Time: 2018-05-10
Author: rodluger@gmail.com
File Name: tex/figures/autodiff.py
Class Name:
Method Name: