davidavdav / GaussianMixtures.jl

Large scale Gaussian Mixture Models
Other
95 stars 36 forks source link

Verbosity of GMM() #84

Closed timmyfaraday closed 3 years ago

timmyfaraday commented 3 years ago

Hi,

We are planning to use your package in our state-estimation package: PowerModelsDistributionStateEstimation

However, the GMM-function has quite a lot of printed output. A previous (closed) issue suggested a fix for this but I notice that this is currently commented in the current version of the code.

Any change to allow to set the print-level to :none through the GMM-function?

with kind regards,

Tom Van Acker

davidavdav commented 3 years ago

Yes, this is a good point. Logging in GaussianMixtureModels should be carried out by a standard logging framework, that can be controlled from other packages that use the package, in a way similar to python's logging module, even though I still fight with that on a daily basis (I do appreciate the cleverness of the design, but still don't completely grasp the way it works...)

Would you know of the recommended way to do this in Julia?

timmyfaraday commented 3 years ago

Hi,

Thank you for the quick response!

I think the way you are doing it currently seems ok (See Logging)! However, a part of the code is commented out which sets the printing level of the K-means algorithm, which is not captured by the logging rather a feature they allow for internally. If you would uncomment lines 102-108 in /src/train.jl, the iteration output should be controllable through the logging setting.

Any user can create a logger using: logger = Logging.SimpleLogger(stdout, Logging.Warn), which should be set to the global logger using global_logger(logger) And then the if clause should read if global_logger().min_level <= Logging.Debug and ifelse global_logger().min_level <= Logging.Info If no logger is defined then this will default to the global logger with a level Info.

with kind regards,

Tom

davidavdav commented 3 years ago

I've implemented this suggestion now, is this what you were looking for? Or do you need more finegraned control?

Should the GMM package itself not have its own logger, for instance, so that you can control the verbosity of the package externally, like you would do in Python. (I started using python only after I had written this GMM package, so I didn't know what a proper way of doing logging was at the time. Still Python logging baffles me at times, I still don't really understand it.)

timmyfaraday commented 3 years ago

Hi,

Thanks for this implementation, this should be sufficient from our end. The question of a specific logger of the package I leave to you. From our perspective this is not necessary.

Thank you for your effort in this!

Tom

davidavdav commented 3 years ago

OK, there should be a version 0.3.4 by now if I did everything correctly