rr.experiment.algorithm module

class rr.experiment.algorithm.Model(nb_tree_per_forest=50, max_depth=10)

Bases: object

Create a new ML model (Random forest classifier from scikitlearn)

Parameters
  • nb_tree_per_forest (int) – number of decision trees in the forest

  • max_depth (int) – max depth of the trees

Returns

None

Raises

None

predict(X)

Make a prediction on the data using the trained model

Parameters

X (numpy.ndarray) – A NxM 2D-array where each row corresponds to a sample and each column to a feature

Returns

A 1D array (with a dtype of int) containing the predicted label for each sample

Return type

numpy.ndarray

Raises

None

train(X, y)

Train the model using the given data

Parameters
  • X (numpy.ndarray) – A NxM 2D-array where each row corresponds to a sample and each column to a feature

  • y (numpy.ndarray) – A 1D-array of length N, where each element corresponds to a sample label

Returns

None

Raises

None