Library
Module
Module type
Parameter
Class
Class type
type features = int Feature_vector.t
type sample = features * class_label
val train :
int ->
Stdlib.Random.State.t ->
metric ->
int ->
int_or_float ->
int ->
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 ->
Stdlib.Random.State.t ->
forest ->
sample ->
class_label * float
(pred_label, pred_proba) =
predict_one ncores rng trained_forest sample
val predict_one_margin :
int ->
Stdlib.Random.State.t ->
forest ->
sample ->
class_label * float * float
(pred_label, pred_proba, pred_margin) =
predict_one_margin ncores rng trained_forest sample
val predict_many :
int ->
Stdlib.Random.State.t ->
forest ->
sample array ->
(class_label * float) array
like predict_one
but for an array of samples
val predict_many_margin :
int ->
Stdlib.Random.State.t ->
forest ->
sample array ->
(class_label * float * float) array
like predict_one_margin
but for an array of samples
val predict_OOB :
Stdlib.Random.State.t ->
forest ->
sample array ->
(class_label * class_label) 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 rng forest training_set
val mcc : class_label -> (class_label * class_label) array -> float
Matthews Correlation Coefficient (MCC). mcc target_class_label truth_preds
val accuracy : (class_label * class_label) array -> float
Percentage of correct prediction accuracy truth_preds
val roc_auc :
class_label ->
(class_label * float) array ->
class_label array ->
float
ROC AUC roc_auc target_class_label preds true_labels
Save model to file (Marshal) OOB samples are dropped prior to saving the model.
The following are needed to implement RFR
val collect_non_constant_features :
(int Feature_vector.t * 'a) array ->
(int * IntSet.t) list
val partition_samples :
int ->
int ->
(int Feature_vector.t * 'a) array ->
(int Feature_vector.t * 'a) array * (int Feature_vector.t * 'a) array
val ratio_to_int : int -> int -> string -> int_or_float -> int