SUOD
SUOD copied to clipboard
Verbose = True
The SUOD library clutters my console. After a bit of digging, I found that in the Parallel(...) call, the parameter verbose is just set to true instead of self.verbose.
Would be nice if it's controlled through the objects verbose parameter.
Thanks for your work.
If we are at it. There is a weird print statement. https://github.com/yzhao062/SUOD/blob/ce50b69b56f2129801979cbf09d935f65a5084ac/suod/models/parallel_processes.py#L98
I've made a pull request to address the issue: https://github.com/yzhao062/SUOD/pull/12
Workaround
@Blaxzter joblib
logs clutter can be addressed via context manager:
import contextlib
import joblib
import builtins as __builtin__
@contextlib.contextmanager
def _joblib_silent_print():
orig_fn = joblib.Parallel._print
orig_print = __builtin__.print
def silent_print(self, msg, msg_args):
return
@staticmethod
def _silent_print():
pass
joblib.Parallel._print = silent_print
__builtin__.print = _silent_print
try:
yield
finally:
joblib.Parallel._print = orig_fn
__builtin__.print = orig_print
The call will look like this:
with _joblib_silent_print():
detector = SUOD(**self.suod_kwargs)
self.detectors.append(detector.fit(x_train))
y_val_scores = detector.decision_function(x_val) # outlier scores
This will remove following lines:
[Parallel(n_jobs=2)]: Using backend LokyBackend with 2 concurrent workers.
[Parallel(n_jobs=2)]: Done 2 out of 2 | elapsed: 1.0s remaining: 0.0s
[Parallel(n_jobs=2)]: Done 2 out of 2 | elapsed: 1.0s finished