BaselearnerCategoricalRidge | R Documentation |
This base learner can be used to estimate effects of categorical features. The classes are included similar as in the linear model by using a one-hot encoded data matrix. Additionally, a Ridge penalty allows unbiased feature selection.
data_source |
CategoricalDataRaw |
blearner_type |
( |
df |
( |
S4 object.
BaselearnerCategoricalRidge$new(data_source, list(df)) BaselearnerCategoricalRidge$new(data_source, blearner_type, list(df))
This class doesn't contain public fields.
$summarizeFactory()
: () -> ()
$transfromData(newdata)
: list(InMemoryData) -> matrix()
$getMeta()
: () -> list()
$getData()
: () -> matrix()
$getDF()
: () -> integer()
$getPenalty()
: () -> numeric()
$getPenaltyMat()
: () -> matrix()
$getFeatureName()
: () -> character()
$getModelName()
: () -> character()
$getBaselearnerId()
: () -> character()
# Sample data:
x = sample(c("one","two"), 20, TRUE)
y = c(one = 0.8, two = -1.2)[x] + rnorm(20, 0, 0.2)
dat = data.frame(x, y)
# S4 API:
ds = CategoricalDataRaw$new(x, "cat")
bl = BaselearnerCategoricalRidge$new(ds, list(df = 1))
bl$getData()
bl$summarizeFactory()
bl$getData()
bl$summarizeFactory()
bl$transformData(list(ds))
bl$getBaselearnerId()
# R6 API:
cboost = Compboost$new(dat, "y")
cboost$addBaselearner("x", "binary", BaselearnerCategoricalRidge)
cboost$train(100, 0)
table(cboost$getSelectedBaselearner())
plotPEUni(cboost, "x", individual = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.