actsnclass.random_forest
- actsnclass.random_forest(train_features: array, train_labels: array, test_features: array, nest=1000, seed=42, max_depth=None, n_jobs=1, return_model=False)
Random Forest classifier.
- Parameters:
train_features (np.array) – Training sample features.
train_labels (np.array) – Training sample classes.
test_features (np.array) – Test sample features.
nest (int (optional)) – Number of estimators (trees) in the forest. Default is 1000.
seed (float (optional)) – Seed for random number generator. Default is 42.
max_depth (None or int (optional)) – The maximum depth of the tree. Default is None.
n_jobs (int (optional)) – Number of cores used to train the model. Default is 1.
return_model (bool (optional)) – If True, return the trained model as a third output. Default is False.
- Returns:
predictions (np.array) – Predicted classes.
prob (np.array) – Classification probability for all objects, [pnon-Ia, pIa].