Traverses the tree recursively and produces one plot per internal node, showing the SVM hyperplane for that node's binary split, the background region colouring, and the actual data points (coloured by true class). Each node receives only the subset of data that reaches it during training.

plot_boundary(
  tree,
  data,
  response_col = NULL,
  max_depth = NULL,
  check_accuracy = TRUE,
  resolution = 100
)

Arguments

tree

An svmodt_node object returned by svm_split.

data

The original training data frame.

response_col

Character string naming the response column in data. Auto-detected when NULL (first factor/character column not used as a predictor).

max_depth

Maximum tree depth to visualize. NULL (default) shows all nodes.

check_accuracy

Logical; if TRUE (default), compute and display training accuracy at each node.

resolution

Integer; grid resolution per axis (default 100). Increase for smoother boundaries at the cost of speed.

Value

Invisibly returns a list with four elements:

plots

Named list of ggplot2 objects, one per node. Names encode depth and path, e.g. "depth_1_Root", "depth_2_Root_L".

grid_data

Named list of data frames (full expanded grid used for each node's contour calculation).

accuracy_info

Named list of per-node metadata: depth, path, sample count, accuracy, features, whether the boundary was visible, and the pad factor that was needed.

response_col

The response column name used.