Spaces:
Sleeping
Sleeping
Update src/module/Features.py
Browse files- src/module/Features.py +8 -8
src/module/Features.py
CHANGED
|
@@ -395,7 +395,7 @@ def show_feature_engine(client, sheet_name):
|
|
| 395 |
client: Client Google Sheets
|
| 396 |
sheet_name: Nom de la feuille Google Sheets
|
| 397 |
"""
|
| 398 |
-
st.markdown("##
|
| 399 |
st.caption("Transformation des données CLEAN (ETL) en vecteurs ML avec lags, rolling stats et interactions.")
|
| 400 |
|
| 401 |
# ===== 1. CHARGEMENT VIA ETL =====
|
|
@@ -406,7 +406,7 @@ def show_feature_engine(client, sheet_name):
|
|
| 406 |
data_explorer = st.session_state.data_explorer
|
| 407 |
st.success("✅ Données CLEAN récupérées du Cache ETL")
|
| 408 |
else:
|
| 409 |
-
with st.spinner("
|
| 410 |
success, result = etl.run_etl()
|
| 411 |
|
| 412 |
if not success:
|
|
@@ -429,7 +429,7 @@ def show_feature_engine(client, sheet_name):
|
|
| 429 |
if 'ml_features' not in st.session_state:
|
| 430 |
engine = FeatureEngineer(data_explorer)
|
| 431 |
|
| 432 |
-
with st.spinner("
|
| 433 |
df_final, msg = engine.build_full_dataset()
|
| 434 |
|
| 435 |
if df_final is not None and not df_final.empty:
|
|
@@ -450,7 +450,7 @@ def show_feature_engine(client, sheet_name):
|
|
| 450 |
st.success(f"✅ Dataset ML Prêt ({len(df):,} échantillons)")
|
| 451 |
|
| 452 |
with col_btn:
|
| 453 |
-
if st.button("
|
| 454 |
del st.session_state['ml_features']
|
| 455 |
st.rerun()
|
| 456 |
|
|
@@ -465,7 +465,7 @@ def show_feature_engine(client, sheet_name):
|
|
| 465 |
st.divider()
|
| 466 |
|
| 467 |
# ===== ANALYSE DES FEATURES =====
|
| 468 |
-
st.subheader("
|
| 469 |
|
| 470 |
# Catégorisation des features
|
| 471 |
feature_categories = {
|
|
@@ -504,7 +504,7 @@ def show_feature_engine(client, sheet_name):
|
|
| 504 |
st.divider()
|
| 505 |
|
| 506 |
# ===== MATRICE DE CORRÉLATION =====
|
| 507 |
-
st.subheader("
|
| 508 |
|
| 509 |
numerics = df.select_dtypes(include=[np.number])
|
| 510 |
|
|
@@ -539,11 +539,11 @@ def show_feature_engine(client, sheet_name):
|
|
| 539 |
st.info("Pas assez de features numériques pour la matrice de corrélation")
|
| 540 |
|
| 541 |
# ===== STATISTIQUES DESCRIPTIVES =====
|
| 542 |
-
with st.expander("
|
| 543 |
st.dataframe(df.describe(), use_container_width=True)
|
| 544 |
|
| 545 |
# ===== PREVIEW DATA =====
|
| 546 |
-
with st.expander("
|
| 547 |
# Options de filtrage
|
| 548 |
col_f1, col_f2 = st.columns(2)
|
| 549 |
|
|
|
|
| 395 |
client: Client Google Sheets
|
| 396 |
sheet_name: Nom de la feuille Google Sheets
|
| 397 |
"""
|
| 398 |
+
st.markdown("## FEATURE ENGINEERING CORE")
|
| 399 |
st.caption("Transformation des données CLEAN (ETL) en vecteurs ML avec lags, rolling stats et interactions.")
|
| 400 |
|
| 401 |
# ===== 1. CHARGEMENT VIA ETL =====
|
|
|
|
| 406 |
data_explorer = st.session_state.data_explorer
|
| 407 |
st.success("✅ Données CLEAN récupérées du Cache ETL")
|
| 408 |
else:
|
| 409 |
+
with st.spinner(" Exécution ETL requis..."):
|
| 410 |
success, result = etl.run_etl()
|
| 411 |
|
| 412 |
if not success:
|
|
|
|
| 429 |
if 'ml_features' not in st.session_state:
|
| 430 |
engine = FeatureEngineer(data_explorer)
|
| 431 |
|
| 432 |
+
with st.spinner(" Génération des features (Lags, Rolling, Saisons, Interactions)..."):
|
| 433 |
df_final, msg = engine.build_full_dataset()
|
| 434 |
|
| 435 |
if df_final is not None and not df_final.empty:
|
|
|
|
| 450 |
st.success(f"✅ Dataset ML Prêt ({len(df):,} échantillons)")
|
| 451 |
|
| 452 |
with col_btn:
|
| 453 |
+
if st.button(" Recalculer", key="recalc_features"):
|
| 454 |
del st.session_state['ml_features']
|
| 455 |
st.rerun()
|
| 456 |
|
|
|
|
| 465 |
st.divider()
|
| 466 |
|
| 467 |
# ===== ANALYSE DES FEATURES =====
|
| 468 |
+
st.subheader(" Analyse des Features Générées")
|
| 469 |
|
| 470 |
# Catégorisation des features
|
| 471 |
feature_categories = {
|
|
|
|
| 504 |
st.divider()
|
| 505 |
|
| 506 |
# ===== MATRICE DE CORRÉLATION =====
|
| 507 |
+
st.subheader(" Matrice de Corrélation")
|
| 508 |
|
| 509 |
numerics = df.select_dtypes(include=[np.number])
|
| 510 |
|
|
|
|
| 539 |
st.info("Pas assez de features numériques pour la matrice de corrélation")
|
| 540 |
|
| 541 |
# ===== STATISTIQUES DESCRIPTIVES =====
|
| 542 |
+
with st.expander(" Statistiques Descriptives"):
|
| 543 |
st.dataframe(df.describe(), use_container_width=True)
|
| 544 |
|
| 545 |
# ===== PREVIEW DATA =====
|
| 546 |
+
with st.expander(" Inspecter le Dataset ML Final"):
|
| 547 |
# Options de filtrage
|
| 548 |
col_f1, col_f2 = st.columns(2)
|
| 549 |
|