refactor: update configuration loading and ensure directory existence across modules

This commit is contained in:
2025-08-07 00:36:32 +02:00
parent 104d7e1146
commit 96291b4ad0
9 changed files with 179 additions and 45 deletions
+8 -2
View File
@@ -50,8 +50,14 @@ class TraditionalModel(BaseModel):
y_encoded = self.label_encoder.transform(y)
# Train model
logging.info(f"Fitting model with {X_prepared.shape[0]} samples and {X_prepared.shape[1]} features")
self.model.fit(X_prepared, y_encoded, verbose=2)
if len(X_prepared.shape) == 1:
# For text-based features (like LogisticRegression with vectorization)
logging.info(f"Fitting model with {X_prepared.shape[0]} samples (text features)")
else:
# For numerical features
logging.info(f"Fitting model with {X_prepared.shape[0]} samples and {X_prepared.shape[1]} features")
self.model.fit(X_prepared, y_encoded)
self.is_fitted = True
return self