Skip to content

Commit e12187b

Browse files
Feature selection deprecated functions (#363)
* normalize has been deprecated * Automated changes * Automated changes --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 58c7128 commit e12187b

File tree

1 file changed

+3
-3
lines changed
  • content/course/modelisation/4_featureselection

1 file changed

+3
-3
lines changed

content/course/modelisation/4_featureselection/index.qmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ les variables sélectionnées sont :
231231
#| echo: false
232232
233233
#3. Estimer un modèle LASSO et afficher les valeurs des coefficients
234-
lasso1 = Lasso(fit_intercept=True,normalize=False, alpha = 0.1).fit(X_train,y_train)
234+
lasso1 = Lasso(fit_intercept=True, alpha = 0.1).fit(X_train, y_train)
235235
236236
#np.abs(lasso1.coef_)
237237
features_selec = df2.select_dtypes(include=np.number).drop("per_gop", axis = 1).columns[np.abs(lasso1.coef_)>0].tolist()
@@ -254,7 +254,7 @@ Par ailleurs, on sélectionne des variables redondantes. Une phase plus approfon
254254
corr = df2[features_selec].corr()
255255
256256
plt.figure()
257-
p = corr.style.background_gradient(cmap='coolwarm', axis=None).set_precision(2)
257+
p = corr.style.background_gradient(cmap='coolwarm', axis=None).format('{:.2f}')
258258
p
259259
```
260260

@@ -358,7 +358,7 @@ yindex = df3.columns.get_loc("per_gop")
358358
df3_scale = scaler.fit(df3).transform(df3)
359359
# 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)
360360
361-
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])
361+
lcv = LassoCV(alphas=my_alphas, fit_intercept=False,random_state=0,cv=5).fit(np.delete(df3_scale, yindex, axis = 1), df3_scale[:,yindex])
362362
```
363363

364364
```{python}

0 commit comments

Comments
 (0)