Description Usage Arguments Value Author(s) See Also Examples
tdmRegress is called by tdmRegressLoop
and returns an object of class tdmRegre
.
It trains a model on training set d_train
and evaluates it on test set d_test
.
If this function is used for tuning, the test set d_test
plays the role of a validation set.
1 2 3 4 5 6 7 8 9 | tdmRegress(
d_train,
d_test,
d_preproc,
response.variables,
input.variables,
opts,
tsetStr = c("Validation", "validation", ".vali")
)
|
d_train |
training set |
d_test |
test set, same columns as training set |
d_preproc |
data used for preprocessing. May be NULL, if no preprocessing is done (opts$PRE.SFA=="none" and opts$PRE.PCA=="none"). If preprocessing is done, then d_preproc is usually all non-validation data. |
response.variables |
name of column which carries the target variable - or - vector of names specifying multiple target columns (these columns are not used during prediction, only for evaluation) |
input.variables |
vector with names of input columns |
opts |
additional parameters [defaults in brackets]
|
tsetStr |
[c("Validation", "validation",".vali")] |
res
, an object of class tdmRegre
, this is a list containing
|
training set + predicted class column(s) |
|
test set + predicted target output |
|
data frame with columns = (rmae.train, rmae.test, theil.train, theil.test, ...) and rows = response variables. Here Theil's U is based on RMAE (relative mean absolute errror). |
|
data frame with columns = (rmse.train, rmse.test, theil.train, theil.test, ...) and rows = response variables. Here Theil's U is based on RMSE (root mean square error). |
|
the last model built (e.g. the last Random Forest in the case of MOD.method=="RF") |
|
parameter list from input, some default values might have been added |
The item lastModel
is
specific for the *last* model (the one built for the last response variable in the last run and last fold)
Wolfgang Konen, FHK, Sep'2009 - Jun'2012
print.tdmRegre
tdmRegressLoop
tdmClassifyLoop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #*# This example shows a simple data mining process (phase 1 of TDMR) for regression on
#*# dataset iris.
#*# The data mining process in tdmRegress calls randomForest as the prediction model.
#*# It is called for 2 response variables. Therefore, the data frames allRMAE and allRMSE
#*# have 2 rows.
#*#
opts=tdmOptsDefaultsSet() # set all defaults for data mining process
gdObj <- tdmGraAndLogInitialize(opts); # init graphics and log file
data(iris)
response.variables=c("Petal.Length","Petal.Width") # names, not data (!)
input.variables=setdiff(names(iris),response.variables)
opts$rgain.type="rmae"
opts$NRUN=1
idx_train = sample(nrow(iris))[1:110]
d_train=iris[idx_train,]
d_vali=iris[-idx_train,]
res <- tdmRegress(d_train,d_vali,NULL,response.variables,input.variables,opts)
print(res$allRMAE)
print(res$allRMSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.