Feat time elapsed for training and inference #105

Merged
meowndor merged 2 commits from feature/101-feat-time-elapsed-for-training-and-inference into dev 2025-08-17 22:55:37 +00:00
Showing only changes of commit 3cbef17b0c - Show all commits

View File

@@ -117,11 +117,20 @@ def train_and_evaluate_model(
result = {"model": model_name, "sensor": sensor_label, "success": False}
try:
import time
start_time = time.time()
# Train the model
model.fit(x_train, y_train)
result["elapsed_time_training"] = time.time() - start_time
try:
# Predict on the test set (validation)
start_time = time.time()
y_pred = model.predict(x_test)
result["elapsed_time_validation"] = time.time() - start_time
result["y_pred"] = y_pred # Convert to numpy array
except Exception as e:
result["error"] = f"Prediction error: {str(e)}"