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.
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)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.
Total number of observations in the data set to be partitioned.
Number of folds in the data partition.
Number of random partitions to generate.
Column names for the resulting partition matrix, used as partition ID.
Formula object to use for extracting response variable from data set.
Data frame containing response variable as defined in formula.
Filepath from which to read an R object into memory (saved using the save function).
Vectors of equal length, used to calculate their RMSE distance.
Alireza S. Mahani, Mansour T.A. Sharabiani