rr.experiment.experiments module

rr.experiment.experiments.base_experiment(protocol, variables, filepath, nb_tree_per_forest=50, max_depth=10)

Basic test for the random forest classifier

Parameters
  • protocol (str) – protocol to use

  • variables (1d-array) – list of desired variables (features)

  • filepath (str) – path to the file containing the dataset to load

  • nb_tree_per_forest – number of decision trees in the forest

  • max_depth – max depth of the trees

Returns

A 2D array (with a dtype of int) containing the confusion matrix.

Return type

numpy.ndarray

Raises

None

rr.experiment.experiments.experiment_impact_nb_trees(tabnum, filepath, nb_trees, max_depth, plot_path)

Evaluates the impact of the number of trees per forest on the classifiers performance

Parameters
  • tabnum (int) – first confusion matrix numbering

  • filepath (str) – path to the file containing the dataset to load

  • nb_trees (list) – list of number of trees to evaluate

  • max_depth (int) – trees maximum depth

  • plot_path (str) – folder where to store confusion matrix plots

Returns

experiment results

Return type

str

Raises

None

rr.experiment.experiments.experiment_impact_tree_depth(tabnum, filepath, nb_trees, max_depths, plot_path)

Evaluates and the impact of the trees depth on the classifiers performance

Parameters
  • tabnum (int) – first confusion matrix numbering

  • filepath (str) – path to the file containing the dataset to load

  • nb_trees (int) – number of trees in forest

  • max_depths (list) – list of trees maximum depths to evaluate

  • plot_path (str) – folder where to store confusion matrix plots

Returns

experiment results

Return type

str

Raises

None

rr.experiment.experiments.pretty_confusion_matrix(cm)

Adds labels to confusion matrix

Parameters

cm (numpy.ndarray) – A 2D array (with a dtype of int) containing the confusion matrix.

Returns

nicely formatted confusion matrix for printing

Return type

str

Raises

None