package orf

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module IntMap = BatMap.Int
type features = int IntMap.t
type dep_var = float
type sample = features * dep_var
type tree =
  1. | Leaf of dep_var
  2. | Node of tree * int * int * tree
type metric =
  1. | MSE
  2. | MAE
  3. | MAD
type forest = (tree * int array) array
val train : int -> Random.State.t -> metric -> int -> RFC.int_or_float -> int -> RFC.int_or_float -> int -> sample array -> forest

train ncores rng metric ntrees max_features card_features max_samples min_node_size training_set

val predict_one : int -> forest -> sample -> dep_var * float

(pred_avg, pred_std_dev) = predict_one ncores trained_forest sample

val predict_many : int -> forest -> sample array -> (dep_var * float) array

like predict_one but for an array of samples

val predict_OOB : forest -> sample array -> (dep_var * dep_var) array

use a trained forest to predict on the Out Of Bag (OOB) training set of each tree. The training_set must be provided in the same order than when the model was trained. Can be used to get a reliable model performance estimate, even if you don't have a left out test set. truth_preds = predict_OOB forest training_set

val r2 : (dep_var * dep_var) array -> float

r2 truth_preds: coefficient of determination R^2

val drop_OOB : forest -> forest

make trained model forget OOB samples (reduce model size)

type filename = string
val save : filename -> forest -> unit

Save model to file (Marshal). OOB samples are dropped prior to saving the model.

val restore : filename -> forest

Restore model from file (Marshal)

OCaml

Innovation. Community. Security.