| pptr | R Documentation |
This function trains a Projection-Pursuit oblique decision tree using either a formula and data frame interface or a matrix-based interface. When using the formula interface, specify the model formula and the data frame containing the variables. For the matrix-based interface, provide matrices for the features and labels directly.
If lambda = 0, the model is trained using Linear Discriminant Analysis (LDA). If lambda > 0, the model is trained using Penalized Discriminant Analysis (PDA).
pptr(
formula = NULL,
data = NULL,
x = NULL,
y = NULL,
mode = NULL,
lambda = 0.5,
seed = NULL,
pp = NULL,
cutpoint = NULL,
stop = NULL,
binarize = NULL,
grouping = NULL,
leaf = NULL
)
formula |
A formula of the form |
data |
A data frame containing the variables in the formula. |
x |
A matrix containing the features for each observation. |
y |
A matrix containing the labels for each observation. |
mode |
Training mode: either |
lambda |
A regularization parameter (default: 0.5). If |
seed |
An optional integer seed for reproducibility. If |
pp |
A projection pursuit strategy object created by |
cutpoint |
A split cutpoint strategy object created by |
stop |
A stopping rule object. Default depends on mode:
|
binarize |
A binarization strategy object. Default depends on mode:
|
grouping |
A grouping strategy object. Default depends on mode:
|
leaf |
A leaf strategy object. Default depends on mode:
|
Mode is taken from the mode argument when explicit, and otherwise auto-detected from 'y' (factor/character → classification, numeric → regression). Pass mode = "classification" to force classification on integer labels (e.g. binary 0/1), or mode = "regression" to assert intent on numeric responses.
A pptr model. Its S3 class vector is
c("pptr_classification", "pptr", "ppmodel") or
c("pptr_regression", "pptr", "ppmodel") depending on the mode.
predict.pptr_classification, predict.pptr_regression, formula.ppmodel, print.pptr, save_json, load_json, pp_tree for parsnip integration
# Example 1: formula interface with the `iris` dataset
pptr(Species ~ ., data = iris)
# Example 2: formula interface with the `iris` dataset with regularization
pptr(Species ~ ., data = iris, lambda = 0.5)
# Example 3: matrix interface with the `iris` dataset
pptr(x = iris[, 1:4], y = iris[, 5])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.