Ahmedik95316 commited on
Commit
c2c8dfb
·
verified ·
1 Parent(s): 8b0a2e5

Update initialize_system.py

Browse files
Files changed (1) hide show
  1. initialize_system.py +30 -4
initialize_system.py CHANGED
@@ -332,12 +332,38 @@ def run_initial_training():
332
  test_acc_mean = cv_data['test_scores']['accuracy']['mean']
333
  test_acc_std = cv_data['test_scores']['accuracy']['std']
334
 
335
- cv_data['performance_indicators'] = {
336
- 'overfitting_score': float(train_acc_mean - test_acc_mean),
337
- 'stability_score': float(1 - (test_acc_std / test_acc_mean)) if test_acc_mean > 0 else 0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  }
339
 
340
- # Save CV results to file
341
  cv_results_path = path_manager.get_logs_path("cv_results.json")
342
  with open(cv_results_path, 'w') as f:
343
  json.dump(cv_data, f, indent=2)
 
332
  test_acc_mean = cv_data['test_scores']['accuracy']['mean']
333
  test_acc_std = cv_data['test_scores']['accuracy']['std']
334
 
335
+ cv_data = {
336
+ "methodology": {
337
+ "n_splits": 3,
338
+ "cv_type": "StratifiedKFold",
339
+ "random_state": 42
340
+ },
341
+ "test_scores": {
342
+ "accuracy": {
343
+ "mean": test_acc_mean,
344
+ "std": test_acc_std,
345
+ "scores": cv_results['test_accuracy'].tolist()
346
+ },
347
+ "f1": {
348
+ "mean": float(cv_results['test_f1_weighted'].mean()),
349
+ "std": float(cv_results['test_f1_weighted'].std()),
350
+ "scores": cv_results['test_f1_weighted'].tolist()
351
+ }
352
+ },
353
+ "train_scores": {
354
+ "accuracy": {
355
+ "mean": train_acc_mean,
356
+ "std": float(cv_results['train_accuracy'].std()),
357
+ "scores": cv_results['train_accuracy'].tolist()
358
+ }
359
+ },
360
+ "performance_indicators": {
361
+ "overfitting_score": overfitting_score,
362
+ "stability_score": stability_score
363
+ }
364
  }
365
 
366
+ # Save CV results
367
  cv_results_path = path_manager.get_logs_path("cv_results.json")
368
  with open(cv_results_path, 'w') as f:
369
  json.dump(cv_data, f, indent=2)