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

View source: R/RandomForest_ranger.R

train_rf_modelR Documentation

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"
)

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".

Value

A trained 'ranger' model object.


text2emotion documentation built on June 8, 2025, 1:04 p.m.