Description Usage Arguments Value
This is a generic function that uses the specified machine learning algorithm to train a model from the training set. It then makes its prediction from a specified validation set. It is essentially a wrapper to ease the use of using multiple machine learning algorithms.
1 2 | ml_trainpredict(train_set = NULL, valid_set = NULL, ycol = 1,
IDinfo = NULL, mlalgo = "xgboost", mlpar = NULL)
|
train_set |
The training set used for training the model |
valid_set |
The validation set used to make predictions |
ycol |
The name or column number where the target variable y is found in the training and validation set. The validation set ycol is only used to bind the y column adjacent to yhat. This allows for easy comparison of actual vs predicted values in the matrix returned. |
IDinfo |
This is a matrix of one or multiple columns and the same number of rows as in the validation set. It normally contains the date information related to each trade, but may include other columns such as the symbol traded, etc. These columns are binded as additional columns in the data frame returned. None of this information is used to make predictions and values do not have to be unique (for instance, there may be multiple predictions made on a given date). Default is NULL (no IDinfo added to the dataframe returned). |
mlalgo |
The machine learning algorithm to use during training and prediction. Currently supported algorithms include: "rf", "h2o.rf", and "xgboost". |
mlpar |
A list containing the parameters required by the ML algorithm selected by mlalgo. If NULL, then |
Returns a dataframe with the following 3 columns and the same number of rows as the validation set provided. Column 1, named "predict" contains the predicted value. Column 2 contains the actual target value as provided by ycol in the validation set. Column 3 is the datecol if it was provided as an argument. Note that datecol must be of same length as the validation set.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.