knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

RF

In plant breeding, it is common to leave one population out when training a machine learning model. This package allows the user to run random forest using one population as the test set, as well as with other, more common, CV strategies (e.g. leave-one-out, 5-fold, 10-fold, etc.).

Installation

You can install the RF package like so:

devtools::install_github("nad7wf/RF")

Example

library(RF)
library(magrittr)

# Simulate some data.
set.seed(76123)
row_num <- 1000

ex <- data.frame(
    Y = runif(row_num, 30, 150),
    GE_ID = runif(row_num, 1e8, 2e8),
    Parent_A = sample(LETTERS[1:4], row_num, replace = TRUE),
    Parent_B = sample(LETTERS[5:8], row_num, replace = TRUE)
) %>%
    cbind(replicate(10, runif(row_num, 0, 1)) %>%
              as.data.frame() %>%
              magrittr::set_names(paste0("Marker", seq(10))))

# Run random forest with specified fold strategy.
result <- RF(ex, "family")
lapply(result, head)


nad7wf/RF documentation built on Sept. 30, 2020, 11:17 a.m.