DeterministicConstantRegressor
DeterministicConstantRegressorThis "dummy" predictor always makes the same prediction, irrespective of the provided input pattern, namely the mean value of the training target values. (It's counterpart, ConstantRegressor makes probabilistic predictions.) This model handles mutlitargets, i.e, the training target can be a matrix or a table (with rows as observations).
Almost any reasonable model is expected to outperform DeterministicConstantRegressor which is used almost exclusively for testing and establishing performance baselines.
In MLJ, do model = DeterministicConstantRegressor() to construct a model instance.
Training data
In MLJ (or MLJBase) bind an instance model to data with
mach = machine(model, X, y)Here:
Xis any table of input features (eg, aDataFrame)yis the target, which can be anyAbstractVector,AbstractVectoror table whose element scitype isContinuous; check the scitypescitype(y)or, for tables, withschema(y)
Train the machine using fit!(mach, rows=...).
Operations
predict(mach, Xnew): Return predictions of the target given featuresXnew(which for this model are ignored).
Fitted parameters
The fields of fitted_params(mach) are:
mean: The target mean(s). Always a row vector. (i.e anAbstractMatrixobject with row dim 1)
Examples
using MLJ
X, y = make_regression(10, 2; n_targets=3); ## synthetic data: two tables
regressor = DeterministicConstantRegressor();
mach = machine(regressor, X, y) |> fit!;
fitted_params(mach)
Xnew, _ = make_regression(3, 2)
predict(mach, Xnew)
See also ConstantClassifier