hoeffding_tree: Hoeffding trees

View source: R/hoeffding_tree.R

hoeffding_treeR Documentation

Hoeffding trees


An implementation of Hoeffding trees, a form of streaming decision tree for classification. Given labeled data, a Hoeffding tree can be trained and saved for later use, or a pre-trained Hoeffding tree can be used for predicting the classifications of new points.


  batch_mode = FALSE,
  bins = NA,
  confidence = NA,
  info_gain = FALSE,
  input_model = NA,
  labels = NA,
  max_samples = NA,
  min_samples = NA,
  numeric_split_strategy = NA,
  observations_before_binning = NA,
  passes = NA,
  test = NA,
  test_labels = NA,
  training = NA,
  verbose = FALSE



If true, samples will be considered in batch instead of as a stream. This generally results in better trees but at the cost of memory usage and runtime. Default value "FALSE" (logical).


If the 'domingos' split strategy is used, this specifies the number of bins for each numeric split. Default value "10" (integer).


Confidence before splitting (between 0 and 1). Default value "0.95" (numeric).


If set, information gain is used instead of Gini impurity for calculating Hoeffding bounds. Default value "FALSE" (logical).


Input trained Hoeffding tree model (HoeffdingTreeModel).


Labels for training dataset (integer row).


Maximum number of samples before splitting. Default value "5000" (integer).


Minimum number of samples before splitting. Default value "100" (integer).


The splitting strategy to use for numeric features: 'domingos' or 'binary'. Default value "binary" (character).


If the 'domingos' split strategy is used, this specifies the number of samples observed before binning is performed. Default value "100" (integer).


Number of passes to take over the dataset. Default value "1" (integer).


Testing dataset (may be categorical) (numeric matrix/data.frame with info).


Labels of test data (integer row).


Training dataset (may be categorical) (numeric matrix/data.frame with info).


Display informational messages and the full list of parameters and timers at the end of execution. Default value "FALSE" (logical).


This program implements Hoeffding trees, a form of streaming decision tree suited best for large (or streaming) datasets. This program supports both categorical and numeric data. Given an input dataset, this program is able to train the tree with numerous training options, and save the model to a file. The program is also able to use a trained model or a model from file in order to predict classes for a given test set.

The training file and associated labels are specified with the "training" and "labels" parameters, respectively. Optionally, if "labels" is not specified, the labels are assumed to be the last dimension of the training dataset.

The training may be performed in batch mode (like a typical decision tree algorithm) by specifying the "batch_mode" option, but this may not be the best option for large datasets.

When a model is trained, it may be saved via the "output_model" output parameter. A model may be loaded from file for further training or testing with the "input_model" parameter.

Test data may be specified with the "test" parameter, and if performance statistics are desired for that test set, labels may be specified with the "test_labels" parameter. Predictions for each test point may be saved with the "predictions" output parameter, and class probabilities for each prediction may be saved with the "probabilities" output parameter.


A list with several components:


Output for trained Hoeffding tree model (HoeffdingTreeModel).


Matrix to output label predictions for test data into (integer row).


In addition to predicting labels, provide rediction probabilities in this matrix (numeric matrix).


mlpack developers


# For example, to train a Hoeffding tree with confidence 0.99 with data
# "dataset", saving the trained tree to "tree", the following command may be
# used:

## Not run: 
output <- hoeffding_tree(training=dataset, confidence=0.99)
tree <- output$output_model

## End(Not run)

# Then, this tree may be used to make predictions on the test set "test_set",
# saving the predictions into "predictions" and the class probabilities into
# "class_probs" with the following command: 

## Not run: 
output <- hoeffding_tree(input_model=tree, test=test_set)
predictions <- output$predictions
class_probs <- output$probabilities

## End(Not run)

mlpack documentation built on Oct. 29, 2022, 1:06 a.m.