assess_features: Assess the predictive power of a set of features using a...

Description Usage Arguments Details Value

Description

Trains a machine learning model using the features provided as argument, then validates it against the validation set. The function evaluates the results using an externally provided function to obtain a figure of merit associated with the given set of features. When used iteratively to loop through a group of different sets of features, the figure of merit can be compared to assess the relative predictive power of each feature set.

Usage

1
2
3
4
assess_features(features, train_set, val_set, Nrepeat = 1, mlalgo = "rf",
  mlpar = list(mtry = 1, ntree = 1000, min_rows = 5),
  meritFUN = "trading_returns", meritFUNpar = list(long_thres = 0,
  short_thres = 0))

Arguments

features

A vector of features with which to train the machine learning algorithm.

train_set

The training set used to build the model. Column 1 should contain the target variable (y). The features argument above is used to subset the train_set to extract the features for training.

val_set

The validation set used to validate the model's performance. Column 1 should contain the target variable (y). The features argument above is used to subset the val_set and extract the features for predicting.

Nrepeat

Number of times to iterate the train-validate process. This is useful to build and validate multiple identical models and compile statistics on the figure of merits for all runs. Doing this helps to empirically determine the hyper-parameter values by ensuring all such models make similar predictions.

mlalgo

The machine learning algorithm used to build the model.

mlpar

A named list containing the machine learning model parameters. If a parameter is missing, then the model's defaults are used.

meritFUN

The name of a function used to calculate a numeric figure of merit (FOM) to include in the return list for evaluation by an upper layer function.

meritFUNpar

The name of a function used to calculate a numeric figure of merit (FOM) to include in the return list for evaluation by an upper layer function.

Details

This is a low-level function normally used within a higher level loop to perform feature selection through iteratively training and validation.

Value

Returns a list with the following elements:

$features

A vector of the features used to develop the model. This is identical to the features argument.

$FOM

The numeric figure of merit associated with the model, based on evaluating it against the validation set and using the provided function meritFUN.

$meritFUN

The name of the merit function meritFUN used to calculated FOM.

$resmat

The matrix containing the predicted (yhat) and actual (y) results based on making a prediction using the validation set.


jeanmarcgp/mlStocks documentation built on May 19, 2019, 12:38 a.m.