tests/testthat/_snaps/svmsmote.md

bad distance arg for step_svmsmote()

Code
  bake(prep(step_svmsmote(recipe(class ~ x + y, data = circle_example), class,
  distance = "L2")), new_data = NULL)
Condition
  Error in `step_svmsmote()`:
  ! `distance` must be one of "euclidean", "cosine", "mahalanobis", "manhattan", "chebyshev", "squared_chord", "matusita", "hellinger", "bhattacharyya", "canberra", "soergel", "lorentzian", "jeffreys", "topsoe", "jensen-shannon", "jensen_difference", "taneja", or "kumar-johnson", not "L2".

errors if there isn't enough data

Code
  prep(step_svmsmote(recipe(Status ~ Age, data = credit_data0), Status))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `bake()`:
  ! The minority class "dummy" does not have enough observations to perform SVMSMOTE.
  i 1 observation was found, but 6 are needed.

bad data

Code
  prep(step_svmsmote(rec, x))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  ! `x` should be a factor variable.
Code
  prep(step_svmsmote(rec, class, id))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  ! The selector should select at most a single variable.

errors if character are present

Code
  prep(step_svmsmote(recipe(~., data = df_char), x))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  x All columns selected for the step should be double or integer.
  * 1 factor variable found: `y`

NA in response

Code
  prep(step_svmsmote(recipe(Job ~ Age, data = credit_data), Job))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  ! Cannot have any missing values. NAs found in Job.

indicator_column bad args

Code
  step_svmsmote(recipe(class ~ x + y, data = circle_example), class,
  indicator_column = 1)
Condition
  Error in `step_svmsmote()`:
  ! `indicator_column` must be a single string or `NULL`, not the number 1.
Code
  prep(step_svmsmote(recipe(class ~ x + y, data = circle_example), class,
  indicator_column = ""))
Condition
  Error in `step_svmsmote()`:
  ! `indicator_column` must be a single string or `NULL`, not the empty string "".
Code
  prep(step_svmsmote(recipe(class ~ x + y, data = circle_example), class,
  indicator_column = "x"))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  ! Name collision occurred. The following variable names already exist:
  * `x`

bad args

Code
  prep(step_svmsmote(recipe(~., data = mtcars), over_ratio = "yes"))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  ! `over_ratio` must be a number, not the string "yes".
Code
  prep(step_svmsmote(recipe(~., data = mtcars), neighbors = TRUE))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  ! `neighbors` must be a whole number, not `TRUE`.
Code
  step_svmsmote(recipe(~., data = mtcars), seed = TRUE)
Condition
  Error in `step_svmsmote()`:
  ! `seed` must be a whole number, not `TRUE`.
Code
  prep(step_svmsmote(recipe(~., data = mtcars), m_neighbors = 0))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  ! `m_neighbors` must be a whole number larger than or equal to 1 or `NULL`, not the number 0.
Code
  prep(step_svmsmote(recipe(~., data = mtcars), out_step = "yes"))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  ! `out_step` must be a number, not the string "yes".

m_neighbors larger than the data errors

Code
  svmsmote(df, "class", m_neighbors = nrow(df))
Condition
  Error in `svmsmote()`:
  ! `m_neighbors` must be less than the number of observations.
  i 400 neighbors were requested, but only 400 observations are available.

unused outcome levels are skipped with a warning (#238)

Code
  res <- bake(prep(step_svmsmote(recipe(class ~ x + y, data = circle_example),
  class)), new_data = NULL)
Condition
  Warning in `prep()`:
  Unused factor level "unused" in `class` was dropped.
  i  Level with zero observations is skipped when computing sampling targets.

step_svmsmote() checks over_ratio names when prepped (#323)

Code
  prep(step_svmsmote(recipe(class ~ ., data = df), class, over_ratio = c(a = 1,
    potato = 1)))
Condition
  Error in `step_svmsmote()`:
  Caused by error in `prep()`:
  ! `over_ratio` names must be levels of the outcome.
  x Unknown name: "potato".
  i Available levels: "a", "b", and "c".

bake method errors when needed non-standard role columns are missing

Code
  bake(trained, new_data = circle_example[, -3])
Condition
  Error in `step_svmsmote()`:
  ! The following required column is missing from `new_data`: class.

empty printing

Code
  rec
Message

  -- Recipe ----------------------------------------------------------------------

  -- Inputs 
  Number of variables by role
  outcome:    1
  predictor: 10

  -- Operations 
  * SVM-SMOTE based on: <none>
Code
  rec
Message

  -- Recipe ----------------------------------------------------------------------

  -- Inputs 
  Number of variables by role
  outcome:    1
  predictor: 10

  -- Training information 
  Training data contained 32 data points and no incomplete rows.

  -- Operations 
  * SVM-SMOTE based on: <none> | Trained

printing

Code
  print(rec)
Message

  -- Recipe ----------------------------------------------------------------------

  -- Inputs 
  Number of variables by role
  outcome:   1
  predictor: 2

  -- Operations 
  * SVM-SMOTE based on: class
Code
  prep(rec)
Message

  -- Recipe ----------------------------------------------------------------------

  -- Inputs 
  Number of variables by role
  outcome:   1
  predictor: 2

  -- Training information 
  Training data contained 400 data points and no incomplete rows.

  -- Operations 
  * SVM-SMOTE based on: class | Trained


Try the themis package in your browser

Any scripts or data that you put into this service are public.

themis documentation built on Aug. 2, 2026, 9:07 a.m.