import pickle
import random
import sys
+import time
import warnings
from abc import ABC, abstractmethod
from dataclasses import dataclass
models.append(model)
modelid_to_params[model.get_id()] = str(params)
+ all_models = {}
best_model = None
best_score: Optional[np.float64] = None
best_test_score: Optional[np.float64] = None
self.y_test,
)
score = (training_score + test_score * 20) / 21
+ all_models[params] = (score, training_score, test_score)
if not self.spec.quiet:
print(
f"{bold()}{params}{reset()}: "
if not self.spec.quiet:
print(f"New best score {best_score:.2f}% with params {params}")
- if not self.spec.quiet:
- executors.DefaultExecutors().shutdown()
- msg = f"Done training; best test set score was: {best_test_score:.1f}%"
- print(msg)
- logger.info(msg)
-
+ executors.DefaultExecutors().shutdown()
assert best_training_score is not None
assert best_test_score is not None
assert best_params is not None
+
+ if not self.spec.quiet:
+ time.sleep(1.0)
+ print('Done training...')
+ for params in all_models:
+ msg = f'{bold()}{params}{reset()}: score={all_models[params][0]:.2f}% '
+ msg += f'({all_models[params][2]:.2f}% test, '
+ msg += f'{all_models[params][1]:.2f}% train)'
+ if params == best_params:
+ msg += f'{bold()} <-- winner{reset()}'
+ print(msg)
+
(
scaler_filename,
model_filename,