13.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.0217316468466 (-3.83 in log scale); Rp=0.655426704113

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 25.456 seconds)

Generated by Sphinx-Gallery