feature_finder: Add features one-by-one to find good small sets of features

Description Usage Arguments Details Value

View source: R/feature_finder.R

Description

Add features one-by-one to find good small sets of features

Usage

1
2
feature_finder(train, test, response, model, difference, n_features,
  verbose = F)

Arguments

train

The training dataset

test

The testing dataset

response

The response column as a string

model

A list containing at least a training function .train and a .predict function, plus optional named parameters to the train function.

The .train function has to take a data argument that stores the training data and a ... argument for the parameters. The .predict function needs to take two arguments, where the first is the model and the second the new dataset.

You can use model_trainer as a wrapper for this list. It will also test your inputs to a certain degree.

difference

A function that calculates the difference between labels and predictions, for example function(x,y) abs(x-y)

n_features

The number of features to try before stopping the algorithm. Can be passed as a integer between 1 and ncol(train) or a fraction, in which case the number of features to try will be n_features * ncol(train). Defaults to ncol(train), only taking numeric columns into account.

verbose

Flag indicating if intermediate updates should be printed

Details

This function will select features one-by-one depending on the correlation of a feature with the residuals of the train predictions to slowly build up a bigger model.

Value

A dataframe, containing the mean difference for train and test set, as well as the feature that was added at each step.


jeroenvdhoven/datapiper documentation built on July 14, 2019, 9:34 p.m.