-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
78 lines (68 loc) · 2.82 KB
/
Copy pathmain.py
File metadata and controls
78 lines (68 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import os
import sys
import subprocess
from config import DATA_DIR, MODELS_DIR
def run_script(script_name):
"""Exécute un script Python situé dans le même répertoire ou des sous-dossiers."""
# On cherche le script récursivement si besoin, ou on suppose qu'il est à la racine
# Pour simplifier, on suppose ici que les scripts sont accessibles ou bien rangés.
# Si tu as rangé tes fichiers dans des dossiers (ex: training/), ajoute le préfixe ici
# Sinon, on suppose que tout est à plat pour l'instant.
paths_to_check = [
script_name,
os.path.join("training", script_name),
os.path.join("analysis", script_name),
os.path.join("src", script_name)
]
target_path = None
for path in paths_to_check:
if os.path.exists(path):
target_path = path
break
if not target_path:
print(f"Erreur : Impossible de trouver le fichier {script_name}")
return
print(f"\nLancement de {target_path}...\n" + "="*40)
try:
subprocess.run([sys.executable, target_path], check=True)
print("="*40 + "\nTerminé avec succès.\n")
except subprocess.CalledProcessError:
print("\nUne erreur est survenue lors l'exécution du script.\n")
def main_menu():
while True:
print("\n--- INDUSTRIAL SENSOR LSTM PIPELINE ---")
print("1. Générer les données (Simulation Physique)")
print("2. Entraîner le modèle Séquentiel (Baseline)")
print("3. Entraîner le modèle LSTM (Avancé)")
print("4. Comparer les modèles (Métriques)")
print("5. Analyse d'erreurs détaillée (LSTM)")
print("9. Tout exécuter (Pipeline complet)")
print("0. quitter")
choice = input("\nVotre choix : ")
if choice == '1':
run_script("data_generation.py")
elif choice == '2':
run_script("sequential_model_training.py")
elif choice == '3':
run_script("lstm_models_training.py")
elif choice == '4':
run_script("trained_models_comparison.py")
elif choice == '5':
run_script("error_prediction_analysis_lstm.py")
elif choice == '9':
print("\nAttention : Cela va tout relancer depuis zéro.")
if input("Confirmer ? (y/n) : ").lower() == 'y':
run_script("data_generation.py")
run_script("lstm_models_training.py")
run_script("trained_models_comparison.py")
elif choice == '0':
print("Au revoir !")
break
else:
print("Choix invalide.")
if __name__ == "__main__":
# Vérification rapide de l'environnement
if not os.path.exists(DATA_DIR):
print(f"📁 Création du dossier data : {DATA_DIR}")
os.makedirs(DATA_DIR)
main_menu()