diff --git a/python_ml/main.py b/python_ml/main.py index 21565a2..eede93d 100644 --- a/python_ml/main.py +++ b/python_ml/main.py @@ -62,6 +62,9 @@ app.add_middleware( # Global instances - Try hybrid first, fallback to legacy USE_HYBRID_DETECTOR = os.getenv("USE_HYBRID_DETECTOR", "true").lower() == "true" +# Model version based on detector type +MODEL_VERSION = "2.0.0" if USE_HYBRID_DETECTOR else "1.0.0" + if USE_HYBRID_DETECTOR: print("[ML] Using Hybrid ML Detector (Extended Isolation Forest + Feature Selection)") ml_detector = MLHybridDetector(model_dir="models") @@ -212,7 +215,7 @@ async def train_model(request: TrainRequest, background_tasks: BackgroundTasks): (model_version, records_processed, features_count, training_duration, status, notes) VALUES (%s, %s, %s, %s, %s, %s) """, ( - "1.0.0", + MODEL_VERSION, len(df), 0, 0, @@ -232,7 +235,7 @@ async def train_model(request: TrainRequest, background_tasks: BackgroundTasks): (model_version, records_processed, features_count, training_duration, status, notes) VALUES (%s, %s, %s, %s, %s, %s) """, ( - "1.0.0", + MODEL_VERSION, result['records_processed'], result['features_count'], 0, # duration non ancora implementato