MaxnetBinaryClassifier
MaxnetBinaryClassifierA model type for constructing a Maxnet, based on Maxnet.jl, and implementing the MLJ model interface.
From MLJ, the type can be imported using
MaxnetBinaryClassifier = @load MaxnetBinaryClassifier pkg=MaxnetDo model = MaxnetBinaryClassifier() to construct an instance with default hyper-parameters. Provide keyword arguments to override hyper-parameter defaults, as in MaxnetBinaryClassifier(features=...).
Training data
In MLJ or MLJBase, bind an instance model to data with
mach = machine(model, X, y)where
X: any table of input features (eg, aDataFrame) whose columns each have one of the following element scitypes:Continuousor<:Multiclass. Checkscitypeswithschema(X).y: is the target, which can be anyAbstractVectorwhose element scitype is<:Binary. The first class should refer to background values, and the second class to presence values.
Hyper-parameters
features: Specifies which features classes to use in the model, e.g. "lqh" for linear, quadratic and hinge features. See also Maxnet.maxnetregularization_multiplier = 1.0: 'Adjust how tight the model will fit. Increasing this will reduce overfitting.regularization_function: A function to compute the regularization of each feature class. Defaults toMaxnet.default_regularizationaddsamplestobackground = true: Controls wether to add presence values to the background.n_knots = 50: The number of knots used for Threshold and Hinge features. A higher number gives more flexibility for these features.weight_factor = 100.0: AFloat64value to adjust the weight of the background samples.link = Maxnet.CloglogLink(): The link function to use when predicting. SeeMaxnet.predictclamp = false: Clamp values passed toMLJBase.predictto the range the model was trained on.
Operations
predict(mach, Xnew): return predictions of the target given featuresXnewhaving the same scitype asXabove. Predictions are probabilistic and can be interpreted as the probability of presence.
Fitted Parameters
The fields of fitted_params(mach) are:
fitresult: ATuplewhere the first entry is theMaxnet.MaxnetModelreturned by the Maxnet algorithm and the second the entry is the classes ofy
Report
The fields of report(mach) are:
selected_variables: AVectorofSymbolsof the variables that were selected.selected_features: AVectorofMaxnet.ModelMatrixColumnwith the features that were selected.complexity: the number of selected features in the model.
Example
using MLJBase, Maxnet
p_a, env = Maxnet.bradypus()
y = coerce(p_a, Binary)
X = coerce(env, Count => Continuous)
mach = machine(MaxnetBinaryClassifier(features = "lqp"), X, y)
fit!(mach)
yhat = MLJBase.predict(mach, env)