GaussianMixtureRegressor
mutable struct GaussianMixtureRegressor <: MLJModelInterface.Deterministic
A non-linear regressor derived from fitting the data on a probabilistic model (Gaussian Mixture Model). Relatively fast but generally not very precise, except for data with a structure matching the chosen underlying mixture.
This is the single-target version of the model. If you want to predict several labels (y) at once, use the MLJ model MultitargetGaussianMixtureRegressor
.
Hyperparameters:
n_classes::Int64
: Number of mixtures (latent classes) to consider [def: 3]initial_probmixtures::Vector{Float64}
: Initial probabilities of the categorical distribution (n_classes x 1) [default:[]
]mixtures::Union{Type, Vector{<:BetaML.GMM.AbstractMixture}}
: An array (of lengthn_classes
) of the mixtures to employ (see the [
?GMM](@ref GMM) module). Each mixture object can be provided with or without its parameters (e.g. mean and variance for the gaussian ones). Fully qualified mixtures are useful only if the
initialisationstrategyparameter is set to "gived"
This parameter can also be given symply in term of a _type. In this case it is automatically extended to a vector ofn_classes
mixtures of the specified type. Note that mixing of different mixture types is not currently supported. [def:
[DiagonalGaussian() for i in 1:n_classes]`]tol::Float64
: Tolerance to stop the algorithm [default: 10^(-6)]minimum_variance::Float64
: Minimum variance for the mixtures [default: 0.05]minimum_covariance::Float64
: Minimum covariance for the mixtures with full covariance matrix [default: 0]. This should be set different than minimum_variance (see notes).initialisation_strategy::String
: The computation method of the vector of the initial mixtures. One of the following:- "grid": using a grid approach
- "given": using the mixture provided in the fully qualified
mixtures
parameter - "kmeans": use first kmeans (itself initialised with a "grid" strategy) to set the initial mixture centers [default]
Note that currently "random" and "shuffle" initialisations are not supported in gmm-based algorithms.
maximum_iterations::Int64
: Maximum number of iterations [def:typemax(Int64)
, i.e. ∞]rng::Random.AbstractRNG
: Random Number Generator [deafult:Random.GLOBAL_RNG
]
Example:
julia> using MLJ
julia> X, y = @load_boston;
julia> modelType = @load GaussianMixtureRegressor pkg = "BetaML" verbosity=0
BetaML.GMM.GaussianMixtureRegressor
julia> model = modelType()
GaussianMixtureRegressor(
n_classes = 3,
initial_probmixtures = Float64[],
mixtures = BetaML.GMM.DiagonalGaussian{Float64}[BetaML.GMM.DiagonalGaussian{Float64}(nothing, nothing), BetaML.GMM.DiagonalGaussian{Float64}(nothing, nothing), BetaML.GMM.DiagonalGaussian{Float64}(nothing, nothing)],
tol = 1.0e-6,
minimum_variance = 0.05,
minimum_covariance = 0.0,
initialisation_strategy = "kmeans",
maximum_iterations = 9223372036854775807,
rng = Random._GLOBAL_RNG())
julia> mach = machine(model, X, y);
julia> fit!(mach);
[ Info: Training machine(GaussianMixtureRegressor(n_classes = 3, …), …).
Iter. 1: Var. of the post 21.74887448784976 Log-likelihood -21687.09917379566
julia> ŷ = predict(mach, X)
506-element Vector{Float64}:
24.703442835305577
24.70344283512716
⋮
17.172486989759676
17.172486989759644