Utility Functions {EnsembleBase}R Documentation

Utility Functions in EnsembleBase Package

Description

Collection of utility functions for generating random partitions in datasets (for cross-validated operations), extracting regression response variable from dataset, loading an object from memory and assigning it to an arbitrary symbol, and error definitions.

Usage

generate.partition(ntot, nfold = 5)
generate.partitions(npart=1, ntot, nfold=5, ids=1:npart)
regression.extract.response(formula, data)
load.object(file)
rmse.error(a,b)

Arguments

ntot

Total number of observations in the data set to be partitioned.

nfold

Number of folds in the data partition.

npart

Number of random partitions to generate.

ids

Column names for the resulting partition matrix, used as partition ID.

formula

Formula object to use for extracting response variable from data set.

data

Data frame containing response variable as defined in formula.

file

Filepath from which to read an R object into memory (saved using the save function).

a,b

Vectors of equal length, used to calculate their RMSE distance.

Value

Function generate.partition returns an integer vector of length ntot, with entries - nearly - equally split in the range 1:nfold. Function generate.partitions returns a matrix of size ntot x npart, with each column being a partition alike to the output of generate.partition. The columns are named ids. Function regression.extract.response returns a vector of length nrow(data), containing the numeric response variable for regression problems. Function load.object returns the saved object, but only works if only a single R object was saved to the file. Function rmse.error returns a single numeric value representing root-mean-squared-error distance between vectors a and b.

Author(s)

Alireza S. Mahani, Mansour T.A. Sharabiani


[Package EnsembleBase version 1.0.2 Index]