get_fit {treeheatr} | R Documentation |
———————————————————————————— Get the fitted tree depending on the input 'x'.
Description
If 'x' is a data.frame object, computes conditional tree from partkit::ctree(). If 'x' is a partynode object specifying the customized tree, fit 'x' on 'data_test'. If 'x' is a party (or constparty) object specifying the precomputed tree, simply coerce 'x' to have class constparty.
Usage
get_fit(x, ...)
## Default S3 method:
get_fit(x, ...)
## S3 method for class 'partynode'
get_fit(x, data_test, target_lab, ...)
## S3 method for class 'party'
get_fit(x, data_test, target_lab, task, ...)
## S3 method for class 'data.frame'
get_fit(x, data_test, target_lab, ...)
Arguments
x |
Dataframe or a 'party' or 'partynode' object representing a custom tree. If a dataframe is supplied, conditional inference tree is computed. If a custom tree is supplied, it must follow the partykit syntax: https://cran.r-project.org/web/packages/partykit/vignettes/partykit.pdf |
... |
Further arguments passed to each method. |
data_test |
Tidy test dataset. Required if 'x' is a 'partynode' object. If NULL, heatmap displays (training) data 'x'. |
target_lab |
Name of the column in data that contains target/label information. |
task |
Character string indicating the type of problem, either 'classification' (categorical outcome) or 'regression' (continuous outcome). |
Value
Fitted object as a list with prepped 'data_test' if available.