Create a regressor object for Probabilistic Machine Learning

regressor(
  x,
  y,
  model = c("ranger", "extratrees", "ridge", "bcn", "glmnet", "krr", "xgboost", "svm"),
  pi_method = c("none", "splitconformal", "jackknifeplus", "kdesplitconformal",
    "bootsplitconformal", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal",
    "surrjackknifeplus"),
  level = 95,
  B = 100,
  nb_hidden = 0,
  nodes_sim = c("sobol", "halton", "unif"),
  activ = c("relu", "sigmoid", "tanh", "leakyrelu", "elu", "linear"),
  engine = NULL,
  params = NULL,
  type_split = c("stratify", "sequential"),
  seed = 123
)

Arguments

x

Input matrix or data frame of features

y

Vector of target values

model

Model to use for regression

pi_method

Method to use for conformal prediction

level

Confidence level for conformal prediction

B

Number of simulations for conformal prediction

nb_hidden

Number of nodes in the hidden layer

nodes_sim

Type of simulations for hidden nodes

activ

Activation function for hidden layer

engine

Engine to use for fitting the model

params

Additional parameters passed to the model

type_split

Type of data splitting for split conformal prediction: "stratify" (for classical supervised learning) "sequential" (when the data sequential ordering matters)

seed

Reproducibility seed for randomization

...

Additional arguments passed to Regressor$new()

Value

A regressor object of class "regressor"

Examples


X <- mtcars[, -1]
y <- mtcars$mpg
X_train <- X[1:25, ]
y_train <- y[1:25]
X_test <- X[26:32, ]
y_test <- y[26:32]
reg <- regressor(X_train, y_train, pi_method = "splitconformal", level = 95)

print(sqrt(mean((y_test - predict(reg, newx = X_test))^2)))
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'print': error in evaluating the argument 'x' in selecting a method for function 'mean': non-numeric argument to binary operator