online.ODT {ODRF} | R Documentation |
using new training data to update an existing ODT
.
Description
Update existing ODT
using new data to improve the model.
Usage
## S3 method for class 'ODT'
online(obj, X = NULL, y = NULL, weights = NULL, MaxDepth = Inf, ...)
Arguments
obj |
an object of class |
X |
An new n by d numeric matrix (preferable) or data frame used to update the object of class |
y |
A new response vector of length n used to update the object of class |
weights |
Vector of non-negative observational weights; fractional weights are allowed (default NULL). |
MaxDepth |
The maximum depth of the tree (default |
... |
optional parameters to be passed to the low level function. |
Value
The same result as ODT
.
See Also
Examples
# Classification with Oblique Decision Tree
data(seeds)
set.seed(221212)
train <- sample(1:209, 100)
train_data <- data.frame(seeds[train, ])
test_data <- data.frame(seeds[-train, ])
index <- seq(floor(nrow(train_data) / 2))
tree <- ODT(varieties_of_wheat ~ ., train_data[index, ], split = "gini")
online_tree <- online(tree, train_data[-index, -8], train_data[-index, 8])
pred <- predict(online_tree, test_data[, -8])
# classification error
(mean(pred != test_data[, 8]))
# Regression with Oblique Decision Tree
data(body_fat)
set.seed(221212)
train <- sample(1:252, 100)
train_data <- data.frame(body_fat[train, ])
test_data <- data.frame(body_fat[-train, ])
index <- seq(floor(nrow(train_data) / 2))
tree <- ODT(Density ~ ., train_data[index, ], split = "mse")
online_tree <- online(tree, train_data[-index, -1], train_data[-index, 1])
pred <- predict(online_tree, test_data[, -1])
# estimation error
mean((pred - test_data[, 1])^2)
[Package ODRF version 0.0.4 Index]