fibre: Fit a 'fibre'

View source: R/fibre-fit.R

fibreR Documentation

Fit a fibre

Description

fibre() fits a model.

Usage

fibre(x, ...)

## Default S3 method:
fibre(x, ...)

## S3 method for class 'data.frame'
fibre(
  x,
  y,
  intercept = TRUE,
  engine = c("inla", "glmnet", "torch"),
  engine_options = list(),
  ncores = NULL,
  verbose = 0,
  fit = TRUE,
  ...
)

## S3 method for class 'matrix'
fibre(
  x,
  y,
  intercept = TRUE,
  engine = c("inla", "glmnet", "torch"),
  engine_options = list(),
  ncores = NULL,
  verbose = 0,
  fit = TRUE,
  ...
)

## S3 method for class 'formula'
fibre(
  formula,
  data,
  intercept = TRUE,
  family = "gaussian",
  engine = c("inla", "glmnet", "torch"),
  engine_options = list(),
  ncores = NULL,
  verbose = 0,
  fit = TRUE,
  ...
)

## S3 method for class 'recipe'
fibre(
  x,
  data,
  intercept = TRUE,
  engine = c("inla", "glmnet", "torch"),
  engine_options = list(),
  ncores = NULL,
  verbose = 0,
  fit = TRUE,
  ...
)

Arguments

x

Depending on the context:

  • A data frame of predictors.

  • A matrix of predictors.

  • A recipe specifying a set of preprocessing steps created from recipes::recipe().

...

Not currently used, but required for extensibility.

y

When x is a data frame or matrix, y is the outcome specified as:

  • A data frame with 1 numeric column.

  • A matrix with 1 numeric column.

  • A numeric vector.

intercept

A logical. Should an intercept be included in the model?

engine

A single character. The engine to use for fitting the model.

engine_options

A list of options to pass to the engine.

ncores

An integer. The number of cores to use for parallel processing.

verbose

An integer. The level of verbosity.

fit

A logical. Should the model be fit? If FALSE, the model is not fit and instead a list of data is returned that can be used to fit the model later. Useful for debugging or for fitting the model using a custom model design or currently unsupported engine.

formula

A formula specifying the outcome terms on the left-hand side, and the predictor terms on the right-hand side.

data

When a recipe or formula is used, data is specified as:

  • A data frame containing both the predictors and the outcome.

Value

A fibre object.

Examples

predictors <- mtcars[, -1]
outcome <- mtcars[, 1]

# XY interface
#mod <- fibre(predictors, outcome)

# Formula interface
#mod2 <- fibre(mpg ~ ., mtcars)

# Recipes interface
#library(recipes)
#rec <- recipe(mpg ~ ., mtcars)
#rec <- step_log(rec, disp)
#mod3 <- fibre(rec, mtcars)


rdinnager/fibre documentation built on Dec. 14, 2024, 10:33 a.m.