Learn R Programming

text2emotion (version 0.1.0)

train_rf_model: Train a Random Forest Model with TF-IDF Features

Description

Train a Random Forest Model with TF-IDF Features

Usage

train_rf_model(
  train_matrix,
  train_labels,
  ntree = 300,
  mtry = NULL,
  seed = 123,
  verbose = TRUE,
  train_df_cache_path = "train_df_cached.rds"
)

Value

A trained `ranger` model object.

Arguments

train_matrix

A sparse matrix (`dgCMatrix`) of training features.

train_labels

A factor vector of training labels.

ntree

Number of trees. Default 300.

mtry

Variables to consider at each split. If NULL, auto-selected.

seed

Random seed. Default 123.

verbose

Whether to print progress. Default TRUE.

train_df_cache_path

Path to cache the train data frame. Default "train_df_cached.rds".