QuantileRegressor
QuantileRegressor
A model type for constructing a quantile regressor, based on MLJLinearModels.jl, and implementing the MLJ model interface.
From MLJ, the type can be imported using
QuantileRegressor = @load QuantileRegressor pkg=MLJLinearModels
Do model = QuantileRegressor()
to construct an instance with default hyper-parameters.
This model coincides with RobustRegressor
, with the exception that the robust loss, rho
, is fixed to QuantileRho(delta)
, where delta
is a new hyperparameter.
Different solver options exist, as indicated under "Hyperparameters" below.
Training data
In MLJ or MLJBase, bind an instance model
to data with
mach = machine(model, X, y)
where:
X
is any table of input features (eg, aDataFrame
) whose columns haveContinuous
scitype; check column scitypes withschema(X)
y
is the target, which can be anyAbstractVector
whose element scitype isContinuous
; check the scitype withscitype(y)
Train the machine using fit!(mach, rows=...)
.
Hyperparameters
delta::Real
: parameterizes theQuantileRho
function (indicating the quantile to use with default0.5
for the median regression) Default: 0.5lambda::Real
: strength of the regularizer ifpenalty
is:l2
or:l1
. Strength of the L2 regularizer ifpenalty
is:en
. Default: 1.0gamma::Real
: strength of the L1 regularizer ifpenalty
is:en
. Default: 0.0penalty::Union{String, Symbol}
: the penalty to use, either:l2
,:l1
,:en
(elastic net) or:none
. Default: :l2fit_intercept::Bool
: whether to fit the intercept or not. Default: truepenalize_intercept::Bool
: whether to penalize the intercept. Default: falsescale_penalty_with_samples::Bool
: whether to scale the penalty with the number of observations. Default: truesolver::Union{Nothing, MLJLinearModels.Solver}
: some instance ofMLJLinearModels.S
whereS
is one of:LBFGS
,IWLSCG
, ifpenalty = :l2
, andProxGrad
otherwise.If
solver = nothing
(default) thenLBFGS()
is used, ifpenalty = :l2
, and otherwiseProxGrad(accel=true)
(FISTA) is used.Solver aliases:
FISTA(; kwargs...) = ProxGrad(accel=true, kwargs...)
,ISTA(; kwargs...) = ProxGrad(accel=false, kwargs...)
Default: nothing
Example
using MLJ
X, y = make_regression()
mach = fit!(machine(QuantileRegressor(), X, y))
predict(mach, X)
fitted_params(mach)
See also RobustRegressor
, HuberRegressor
.