Update src/app.py
Browse files- src/app.py +3 -1
src/app.py
CHANGED
|
@@ -345,7 +345,9 @@ try:
|
|
| 345 |
lr.intercept_ = intercept
|
| 346 |
lr.coef_ = np.array(coefs, dtype=float)
|
| 347 |
lr.feature_names_in_ = np.array(coef_names)
|
| 348 |
-
|
|
|
|
|
|
|
| 349 |
X_used_corrected = X_used_no_const.reindex(columns=lr.feature_names_in_, fill_value=0)
|
| 350 |
|
| 351 |
explainer = shap.Explainer(lr, X_used_corrected)
|
|
|
|
| 345 |
lr.intercept_ = intercept
|
| 346 |
lr.coef_ = np.array(coefs, dtype=float)
|
| 347 |
lr.feature_names_in_ = np.array(coef_names)
|
| 348 |
+
|
| 349 |
+
# force numérique (au cas où une colonne serait restée 'object')
|
| 350 |
+
X_used_corrected = X_used_corrected.apply(pd.to_numeric, errors="coerce").fillna(0)
|
| 351 |
X_used_corrected = X_used_no_const.reindex(columns=lr.feature_names_in_, fill_value=0)
|
| 352 |
|
| 353 |
explainer = shap.Explainer(lr, X_used_corrected)
|