Create a classifier object for Probabilistic Machine Learning

classifier(
  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,
  seed = 123
)

Arguments

x

Input matrix or data frame of features

y

Vector of target values

model

Model to use for classification

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

seed

Reproducibility seed for randomization

...

Additional arguments passed to Classifier$new()

Value

A classifier object of class "classifier"

Examples


X <- iris[, -5]
y <- iris$Species
X_train <- X[1:100, ]
y_train <- y[1:100]
X_test <- X[101:150, ]
y_test <- y[101:150]
clf <- classifier(X_train, y_train, pi_method = "kdesplitconformal", level = 95)
#> Error in dimnames(x) <- dn: length of 'dimnames' [2] not equal to array extent
predict(clf, newx = X_test)
#> Error: object 'clf' not found
print(mean(y_test == predict(clf, newx = X_test)))
#> 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': object 'clf' not found