Hypothesis wrapper for functional models
Hypothesis.RdConstruct a hypothesis object that wraps a user-supplied function with minimal metadata so it can be visualized like a learner.
R6 class wrapping a user-supplied function plus minimal metadata so it can be visualized like a learner on 1D or 2D inputs.
Arguments
- fun
(
function) Function defining the hypothesis. Accepted signatures:1D:
fun(x, ...)orfun(data)wheredatais a data.frame with one predictor column2D:
fun(x, y, ...)orfun(data)wheredatais a data.frame with two predictor columns
- type
(
character(1)) One of "regr" or "classif".- predictors
(
character()) Names of the predictor columns. Length must be 1 or 2.- link
(
character(1)) Link for classif outputs: "identity" (default) or "logit". For regression, only "identity" is used.- domain
(
list|NULL) Named list with limits per predictor, e.g.,list(x = c(-3, 3))for 1D orlist(x = c(-3,3), y = c(-3,3))for 2D. Used when no Task is provided.- levels
(
character(2)|NULL) Class labels for binary classification.
Public fields
fun(
function) User-provided function implementing the hypothesis.type(
character(1)) Prediction type, one of "regr" or "classif".predictors(
character()) Names of predictor columns (length 1 or 2).input_dim(
integer(1)) Number of predictors, derived frompredictors.link(
character(1)) Link for classif output: "identity" or "logit".domain(
list|NULL) Named list with limits per predictor for plotting without a Task.levels(
character(2)|NULL) Class labels for binary classification.
Methods
Method new()
Create a new Hypothesis instance
Usage
Hypothesis$new(
fun,
type,
predictors,
link = "identity",
domain = NULL,
levels = NULL
)Arguments
fun(
function) See class fieldfun.type(
character(1)) See class fieldtype.predictors(
character()) See class fieldpredictors.link(
character(1)) See class fieldlink.domain(
list|NULL) See class fielddomain.levels(
character(2)|NULL) See class fieldlevels.
Method predict()
Predict on newdata