% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/TrainModels.R
\name{TrainModels}
\alias{TrainModels}
\title{Train the different models}
\usage{
TrainModels(
  CrcBiomeScreenObject = NULL,
  model_type = c("RF", "XGBoost"),
  ClassWeights = TRUE,
  n_cv = 10,
  TaskName = NULL,
  TrueLabel = NULL,
  num_cores = 1
)
}
\arguments{
\item{CrcBiomeScreenObject}{A \code{CrcBiomeScreenObject} containing normalized microbiome data, sample metadata, etc.}

\item{model_type}{Select the method for modeling}

\item{ClassWeights}{Choose using the class weights or not}

\item{n_cv}{Set the number of cross validation}

\item{TaskName}{A character string used to label the output}

\item{TrueLabel}{This label is the future prediction target}

\item{num_cores}{Set the number of the cores in parallel computing}
}
\value{
A A \code{CrcBiomeScreen} object. with training results.
}
\description{
Train the different models
}
\examples{
set.seed(123)
toy_data <- matrix(rpois(6 * 10, 50), nrow = 6)
colnames(toy_data) <- paste0("S", 1:10)
rownames(toy_data) <- paste0("Taxa", 1:6)

toy_taxa <- data.frame(Taxa = rownames(toy_data))
toy_sample <- data.frame(
  study_condition = rep(c("control", "CRC"), each = 5),
  row.names = colnames(toy_data)
)

obj <- CreateCrcBiomeScreenObject(
  AbsoluteAbundance = as.data.frame(toy_data),
  TaxaData = toy_taxa,
  SampleData = toy_sample
)
obj <- SplitTaxas(obj)
obj <- KeepTaxonomicLevel(obj, level = "Genus")
obj <- NormalizeData(obj, method = "TSS", level = "Genus")
obj <- SplitDataSet(obj, label = c("control","CRC"), partition = 0.7)

obj <- TrainModels(
  obj,
  model_type = "RF",
  TrueLabel = "CRC",
  n_cv = 2,
  num_cores = 1
)
}
