Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong cross validated weight maps in output for lassopcr #368

Closed
mpcoll opened this issue Jan 16, 2021 · 0 comments
Closed

Wrong cross validated weight maps in output for lassopcr #368

mpcoll opened this issue Jan 16, 2021 · 0 comments
Labels

Comments

@mpcoll
Copy link

mpcoll commented Jan 16, 2021

In brain_data.py at line 1108 the same (non-cross validated) weight map is returned for each cross-validation fold because the initial classifier object is used instead of the cross-validation one.

I believe this part

if predictor_settings['algorithm'] == 'lassopcr':
    wt_map_xval.append(np.dot(predictor_settings['_pca'].components_.T, predictor_settings['_lasso'].coef_))
elif predictor_settings['algorithm'] == 'pcr':
    wt_map_xval.append(np.dot(predictor_settings['_pca'].components_.T, predictor_settings['_regress'].coef_))
else:
    wt_map_xval.append(predictor_cv.coef_.squeeze())
output['weight_map_xval'].data = np.array(wt_map_xval)

should be replaced by

if predictor_settings['algorithm'] == 'lassopcr':
    wt_map_xval.append(np.dot(predict_cv['pca'].components_.T, predict_cv['lasso'].coef_))
elif predictor_settings['algorithm'] == 'pcr':
    wt_map_xval.append(np.dot(predict_cv['pca'].components_.T, predict_cv['regress'].coef_))
else:
    wt_map_xval.append(predictor_cv.coef_.squeeze())
output['weight_map_xval'].data = np.array(wt_map_xval)
@ejolly ejolly added the bug label Oct 27, 2021
@ejolly ejolly closed this as completed in 738f9c1 Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants