Skip to content

Commit

Permalink
Feature selection deprecated functions (#363)
Browse files Browse the repository at this point in the history
* normalize has been deprecated

* Automated changes

* Automated changes

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
linogaliana and github-actions[bot] committed Jun 12, 2023
1 parent 58c7128 commit e12187b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/course/modelisation/4_featureselection/index.qmd
Expand Up @@ -231,7 +231,7 @@ les variables sélectionnées sont :
#| echo: false
#3. Estimer un modèle LASSO et afficher les valeurs des coefficients
lasso1 = Lasso(fit_intercept=True,normalize=False, alpha = 0.1).fit(X_train,y_train)
lasso1 = Lasso(fit_intercept=True, alpha = 0.1).fit(X_train, y_train)
#np.abs(lasso1.coef_)
features_selec = df2.select_dtypes(include=np.number).drop("per_gop", axis = 1).columns[np.abs(lasso1.coef_)>0].tolist()
Expand All @@ -254,7 +254,7 @@ Par ailleurs, on sélectionne des variables redondantes. Une phase plus approfon
corr = df2[features_selec].corr()
plt.figure()
p = corr.style.background_gradient(cmap='coolwarm', axis=None).set_precision(2)
p = corr.style.background_gradient(cmap='coolwarm', axis=None).format('{:.2f}')
p
```

Expand Down Expand Up @@ -358,7 +358,7 @@ yindex = df3.columns.get_loc("per_gop")
df3_scale = scaler.fit(df3).transform(df3)
# X_train, X_test , y_train, y_test = train_test_split(np.delete(data, yindex, axis = 1),data[:,yindex], test_size=0.2, random_state=0)
lcv = LassoCV(alphas=my_alphas ,normalize=False,fit_intercept=False,random_state=0,cv=5).fit(np.delete(df3_scale, yindex, axis = 1), df3_scale[:,yindex])
lcv = LassoCV(alphas=my_alphas, fit_intercept=False,random_state=0,cv=5).fit(np.delete(df3_scale, yindex, axis = 1), df3_scale[:,yindex])
```

```{python}
Expand Down

0 comments on commit e12187b

Please sign in to comment.