12.6. Plot weights resulting from an Elastic Net analysis

Note that only the 50 most important weigths are shown

We look at the” effect of the alpha parameter on the weights returned by the elastic net analysis

from gdsctools import *

First we alpha=0.01

gd = GDSCElasticNet(ic50_v17, gf_v17)
drugid = 1047

Find best model and corresponding alpha

res = gd.runCV(drugid, kfolds=10)
best_alpha = res.alpha

Out:

Best alpha on 10 folds: 0.0202670065825 (-3.90 in log scale); Rp=0.660523333496

Plot weights of best model

best_model = gd.get_model(alpha=best_alpha)
gd.plot_weight(drugid, model=best_model)
../_images/sphx_glr_plot_elastic_weights_001.png

increasing alpha

model1 = gd.get_model(alpha=best_alpha*10.)
gd.plot_weight(drugid, model=model1, fontsize=9)
../_images/sphx_glr_plot_elastic_weights_002.png

decreasing alpha

model2 = gd.get_model(alpha=best_alpha/10.)
gd.plot_weight(drugid, model=model2, fontsize=9)
../_images/sphx_glr_plot_elastic_weights_003.png

Total running time of the script: ( 0 minutes 33.602 seconds)

Gallery generated by Sphinx-Gallery