Package 'maize'

Title: Specialty Kernels for SVMs
Description: Bindings for svm kernels via kernlab for use with the 'parsnip' package. Specifically related to specialty kernels for support vector machines not available in parsnip. package includes interface for various kernlab kernels and custom kernels too.
Authors: Frankie T. Hull [aut, cre], Max Kuhn [ctb]
Maintainer: Frankie T. Hull <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9031415
Built: 2024-11-10 02:43:40 UTC
Source: https://github.com/frankiethull/maize

Help Index


Synthetic Corn Dataset for Corny Example

Description

Synthetic Corn Dataset for Corny Example

Details

Asked Claude Sonnet for a corn data given the README story problem

Value

corn_data

a tibble

Source

claude-3-5-sonnet-20240620

Examples

data(corn_data)
str(corn_data)

Laplacian function kernel PCA signal extraction via Hebbian Algorithm

Description

step_kha_laplace() creates a specification of a recipe step that will convert numeric data into one or more principal components using a laplace kernel basis expansion.

Usage

step_kha_laplace(
  recipe,
  ...,
  role = "predictor",
  trained = FALSE,
  num_comp = 5,
  res = NULL,
  columns = NULL,
  sigma = 0.2,
  learn_rate = 0.005,
  threshold = 1e-04,
  stop_iter = 100,
  prefix = "kha",
  keep_original_cols = FALSE,
  skip = FALSE,
  id = rand_id("kha_laplace")
)

Arguments

recipe

A recipe object. The step will be added to the sequence of operations for this recipe.

...

One or more selector functions to choose variables for this step. See selections() for more details.

role

For model terms created by this step, what analysis role should they be assigned? By default, the new columns created by this step from the original variables will be used as predictors in a model.

trained

A logical to indicate if the quantities for preprocessing have been estimated.

num_comp

The number of components to retain as new predictors. If num_comp is greater than the number of columns or the number of possible components, a smaller value will be used. If num_comp = 0 is set then no transformation is done and selected variables will stay unchanged, regardless of the value of keep_original_cols.

res

An S4 kernlab::kha() object is stored here once this preprocessing step has be trained by prep().

columns

A character string of the selected variable names. This field is a placeholder and will be populated once prep() is used.

sigma

A numeric value for the laplace function parameter.

learn_rate

hebbian learning rate

threshold

the smallest value of the convergence step

stop_iter

maximum number of iterations

prefix

A character string for the prefix of the resulting new variables. See notes below.

keep_original_cols

A logical to keep the original variables in the output. Defaults to FALSE.

skip

A logical. Should the step be skipped when the recipe is baked by bake()? While all operations are baked when prep() is run, some operations may not be able to be conducted on new data (e.g. processing the outcome variable(s)). Care should be taken when using skip = TRUE as it may affect the computations for subsequent operations.

id

A character string that is unique to this step to identify it.

See Also

Other multivariate transformation steps: step_kha_tanh(), step_kpca_laplace(), step_kpca_tanh()


tanh function kernel PCA signal extraction via Hebbian Algorithm

Description

step_kha_tanh() creates a specification of a recipe step that will convert numeric data into one or more principal components using a tanh kernel basis expansion.

Usage

step_kha_tanh(
  recipe,
  ...,
  role = "predictor",
  trained = FALSE,
  num_comp = 5,
  res = NULL,
  columns = NULL,
  scale_factor = 0.2,
  learn_rate = 0.005,
  threshold = 1e-04,
  stop_iter = 100,
  prefix = "kha",
  keep_original_cols = FALSE,
  skip = FALSE,
  id = rand_id("kha_tanh")
)

Arguments

recipe

A recipe object. The step will be added to the sequence of operations for this recipe.

...

One or more selector functions to choose variables for this step. See selections() for more details.

role

For model terms created by this step, what analysis role should they be assigned? By default, the new columns created by this step from the original variables will be used as predictors in a model.

trained

A logical to indicate if the quantities for preprocessing have been estimated.

num_comp

The number of components to retain as new predictors. If num_comp is greater than the number of columns or the number of possible components, a smaller value will be used. If num_comp = 0 is set then no transformation is done and selected variables will stay unchanged, regardless of the value of keep_original_cols.

res

An S4 kernlab::kha() object is stored here once this preprocessing step has be trained by prep().

columns

A character string of the selected variable names. This field is a placeholder and will be populated once prep() is used.

scale_factor

A numeric value for the tanh function parameter.

learn_rate

hebbian learning rate

threshold

the smallest value of the convergence step

stop_iter

maximum number of iterations

prefix

A character string for the prefix of the resulting new variables. See notes below.

keep_original_cols

A logical to keep the original variables in the output. Defaults to FALSE.

skip

A logical. Should the step be skipped when the recipe is baked by bake()? While all operations are baked when prep() is run, some operations may not be able to be conducted on new data (e.g. processing the outcome variable(s)). Care should be taken when using skip = TRUE as it may affect the computations for subsequent operations.

id

A character string that is unique to this step to identify it.

See Also

Other multivariate transformation steps: step_kha_laplace(), step_kpca_laplace(), step_kpca_tanh()


Laplacian function kernel PCA signal extraction

Description

step_kpca_laplace() creates a specification of a recipe step that will convert numeric data into one or more principal components using a laplace kernel basis expansion.

Usage

step_kpca_laplace(
  recipe,
  ...,
  role = "predictor",
  trained = FALSE,
  num_comp = 5,
  res = NULL,
  columns = NULL,
  sigma = 0.2,
  prefix = "kPC",
  keep_original_cols = FALSE,
  skip = FALSE,
  id = rand_id("kpca_laplace")
)

Arguments

recipe

A recipe object. The step will be added to the sequence of operations for this recipe.

...

One or more selector functions to choose variables for this step. See selections() for more details.

role

For model terms created by this step, what analysis role should they be assigned? By default, the new columns created by this step from the original variables will be used as predictors in a model.

trained

A logical to indicate if the quantities for preprocessing have been estimated.

num_comp

The number of components to retain as new predictors. If num_comp is greater than the number of columns or the number of possible components, a smaller value will be used. If num_comp = 0 is set then no transformation is done and selected variables will stay unchanged, regardless of the value of keep_original_cols.

res

An S4 kernlab::kpca() object is stored here once this preprocessing step has be trained by prep().

columns

A character string of the selected variable names. This field is a placeholder and will be populated once prep() is used.

sigma

A numeric value for the laplace function parameter.

prefix

A character string for the prefix of the resulting new variables. See notes below.

keep_original_cols

A logical to keep the original variables in the output. Defaults to FALSE.

skip

A logical. Should the step be skipped when the recipe is baked by bake()? While all operations are baked when prep() is run, some operations may not be able to be conducted on new data (e.g. processing the outcome variable(s)). Care should be taken when using skip = TRUE as it may affect the computations for subsequent operations.

id

A character string that is unique to this step to identify it.

See Also

Other multivariate transformation steps: step_kha_laplace(), step_kha_tanh(), step_kpca_tanh()


Laplacian function kernel PCA signal extraction

Description

step_kpca_tanh() creates a specification of a recipe step that will convert numeric data into one or more principal components using a tanh kernel basis expansion.

Usage

step_kpca_tanh(
  recipe,
  ...,
  role = "predictor",
  trained = FALSE,
  num_comp = 5,
  res = NULL,
  columns = NULL,
  scale_factor = 0.2,
  prefix = "kPC",
  keep_original_cols = FALSE,
  skip = FALSE,
  id = rand_id("kpca_tanh")
)

Arguments

recipe

A recipe object. The step will be added to the sequence of operations for this recipe.

...

One or more selector functions to choose variables for this step. See selections() for more details.

role

For model terms created by this step, what analysis role should they be assigned? By default, the new columns created by this step from the original variables will be used as predictors in a model.

trained

A logical to indicate if the quantities for preprocessing have been estimated.

num_comp

The number of components to retain as new predictors. If num_comp is greater than the number of columns or the number of possible components, a smaller value will be used. If num_comp = 0 is set then no transformation is done and selected variables will stay unchanged, regardless of the value of keep_original_cols.

res

An S4 kernlab::kpca() object is stored here once this preprocessing step has be trained by prep().

columns

A character string of the selected variable names. This field is a placeholder and will be populated once prep() is used.

scale_factor

A numeric value for the tanh function parameter.

prefix

A character string for the prefix of the resulting new variables. See notes below.

keep_original_cols

A logical to keep the original variables in the output. Defaults to FALSE.

skip

A logical. Should the step be skipped when the recipe is baked by bake()? While all operations are baked when prep() is run, some operations may not be able to be conducted on new data (e.g. processing the outcome variable(s)). Care should be taken when using skip = TRUE as it may affect the computations for subsequent operations.

id

A character string that is unique to this step to identify it.

See Also

Other multivariate transformation steps: step_kha_laplace(), step_kha_tanh(), step_kpca_laplace()


ANOVA RBF Support Vector Machine

Description

anova rbf for support vector machines

Usage

svm_anova_rbf(
  mode = "unknown",
  engine = "kernlab",
  cost = NULL,
  anova_rbf_sigma = NULL,
  degree = NULL,
  margin = NULL
)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

anova_rbf_sigma

sigma parameter for anova rbf

degree

degree parameter for anova rbf

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)


Bessel Support Vector Machine

Description

bessel kernel for support vector machines

Usage

svm_bessel(
  mode = "unknown",
  engine = "kernlab",
  cost = NULL,
  bessel_sigma = NULL,
  degree = NULL,
  order = NULL,
  margin = NULL
)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

bessel_sigma

sigma parameter for bessel

degree

degree parameter for bessel

order

order parameter for bessel

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)


Cauchy Support Vector Machine

Description

cauchy kernel for support vector machines

Usage

svm_cauchy(
  mode = "unknown",
  engine = "kernlab",
  cost = NULL,
  margin = NULL,
  sigma = NULL
)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)

sigma

a sigma parameter for cauchy kernels


Cosine Similarity Support Vector Machine

Description

cossim kernel for support vector machines

Usage

svm_cossim(mode = "unknown", engine = "kernlab", cost = NULL, margin = NULL)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)


Fourier Support Vector Machine

Description

fourier kernel for support vector machines

Usage

svm_fourier(
  mode = "unknown",
  engine = "kernlab",
  cost = NULL,
  margin = NULL,
  sigma = NULL
)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)

sigma

a sigma parameter for fourier kernels


Laplacian Support Vector Machine

Description

laplacian kernel for support vector machines

Usage

svm_laplace(
  mode = "unknown",
  engine = "kernlab",
  cost = NULL,
  margin = NULL,
  laplace_sigma = NULL
)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)

laplace_sigma

sigma parameter for laplacian


Sorensen Support Vector Machine

Description

sorensen kernel for support vector machines which is used as a graph kernel for chemical informatics

Usage

svm_sorensen(mode = "unknown", engine = "kernlab", cost = NULL, margin = NULL)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)


Spline Support Vector Machine

Description

spline kernel for support vector machines

Usage

svm_spline(mode = "unknown", engine = "kernlab", cost = NULL, margin = NULL)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)


String Support Vector Machine

Description

stringdot for support vector machines

Usage

svm_string(
  x,
  y,
  mode = "unknown",
  engine = "kernlab",
  cost = NULL,
  length = NULL,
  lambda = NULL,
  normalized = TRUE,
  margin = NULL
)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

length

The length of the substrings considered

lambda

The decay factor

normalized

normalize string kernel values, (default = TRUE)

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)


Hyperbolic Tangent Support Vector Machine

Description

tanh kernel for support vector machines

Usage

svm_tanh(
  mode = "unknown",
  engine = "kernlab",
  cost = NULL,
  scale_factor = NULL,
  margin = NULL
)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

scale_factor

scale parameter for tanh

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)


Tanimoto Support Vector Machine

Description

tanimoto kernel for support vector machines which is used as a graph kernel for chemical informatics

Usage

svm_tanimoto(mode = "unknown", engine = "kernlab", cost = NULL, margin = NULL)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)


T-Student Support Vector Machine

Description

t-student kernel for support vector machines

Usage

svm_tstudent(
  mode = "unknown",
  engine = "kernlab",
  cost = NULL,
  margin = NULL,
  degree = NULL
)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)

degree

a degree parameter for tstudent kernels


Wavelet Support Vector Machine

Description

wavelet kernel for support vector machines

Usage

svm_wavelet(
  mode = "unknown",
  engine = "kernlab",
  cost = NULL,
  margin = NULL,
  sigma = NULL,
  a = 1,
  c = NULL,
  h = NULL
)

Arguments

mode

regression or classification

engine

kernlab ksvm

cost

A positive number for the cost of predicting a sample within or on the wrong side of the margin

margin

A positive number for the epsilon in the SVM insensitive loss function (regression only)

sigma

sigma parameter for svm wavelet kernel

a

scale adjustment parameter for wavelet kernels (temp name)

c

dist adjustment parameter for wavelet kernels can be NULL (temp name)

h

wavelet function for wavelet kernel, default wavelet if NULL (temp name)