davidavdav / GaussianMixtures.jl

Large scale Gaussian Mixture Models
Other
99 stars 38 forks source link

Support a verbose parameter to null the output #88

Closed sylvaticus closed 3 years ago

sylvaticus commented 3 years ago

I couldn't find in the readme a parameter to null the output (other than redirecting the output stream). For example when I run dGMM = GMM(3, x; method=:kmeans, kind=:full) I always get

[ Info: Initializing GMM, 3 Gaussians diag covariance 4 dimensions using 150 data points
K-means converged with 5 iterations (objv = 78.85144142614662)
┌ Info: K-means with 150 data points using 5 iterations
└ 10.0 data points per parameter

That's annoying when you do stuff like cross-validation...

davidavdav commented 3 years ago

Is this not solved by the patch in #84 ?

sylvaticus commented 3 years ago

Thank you. It works in a standard Julia console:

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.0 (2021-03-24)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Logging, Random, RDatasets,GaussianMixtures
julia> iris    = dataset("datasets", "iris");
julia> x       = Matrix{Float64}(iris[:,1:4]);
julia> shuffle!(x);
julia> logger  = Logging.SimpleLogger(stdout, Logging.Warn)
Base.CoreLogging.SimpleLogger(Base.TTY(RawFD(13) open, 0 bytes waiting), Warn, Dict{Any, Int64}())
julia> global_logger(logger)
ConsoleLogger(Base.TTY(RawFD(15) open, 0 bytes waiting), Info, Logging.default_metafmt, true, 0, Dict{Any, Int64}())
julia> fGMM    = GMM(3, x; method=:kmeans, kind=:full);
julia> em!(fGMM, x);
julia> 

It doesn't however in Juno, it prints some strange text, but I guess this is a problem of Juno, so I am closing this issue:

Starting Julia...
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.0 (2021-03-24)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Logging, Random, RDatasets,GaussianMixtures
julia> iris    = dataset("datasets", "iris");
julia> x       = Matrix{Float64}(iris[:,1:4]);
julia> shuffle!(x);
julia> logger  = Logging.SimpleLogger(stdout, Logging.Warn);
julia> global_logger(logger);
julia> fGMM    = GMM(3, x; method=:kmeans, kind=:full);
julia> em!(fGMM, x);
3 (1:3
julia> )
3 (1:3,)
3 (1:3,)