Fit RandomForestClassifier

A random forest classifier. A random forest is a meta estimator that fits a number of decision tree classifiers on various sub-samples of the dataset and uses averaging to improve the predictive accuracy and control over-fitting. The sub-sample size is controlled with the max_samples parameter if bootstrap=True (default), otherwise the whole dataset is used to build each tree.

A Random Forest classifier works by constructing a multitude of decision trees during training and then combines their predictions to make a final prediction.

Usage:

  1. Start the algorithm from the Processing Toolbox panel.

  2. Select a training dataset or create one by clicking the processing algorithm icon, then click run.

    usr_section/usr_manual/processing_algorithms/classification/source/usr_section/usr_manual/processing_algorithms_includes/classification/img/fitrandomforest_interface.png

Parameters

Classifier [string]

Scikit-learn python code. See RandomForestClassifier for information on different parameters.

Default:

from sklearn.ensemble import RandomForestClassifier
classifier = RandomForestClassifier(n_estimators=100, oob_score=True)
Training dataset [file]

Training dataset pickle file used for fitting the classifier. If not specified, an unfitted classifier is created.

Outputs

Output classifier [fileDestination]

Pickle file destination.

Command-line usage

>qgis_process help enmapbox:FitRandomforestclassifier:

----------------
Arguments
----------------

classifier: Classifier
    Default value:  from sklearn.ensemble import RandomForestClassifier
classifier = RandomForestClassifier(n_estimators=100, oob_score=True)
    Argument type:  string
    Acceptable values:
            - String value
            - field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
            - expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
dataset: Training dataset (optional)
    Argument type:  file
    Acceptable values:
            - Path to a file
outputClassifier: Output classifier
    Argument type:  fileDestination
    Acceptable values:
            - Path for new file

----------------
Outputs
----------------

outputClassifier: <outputFile>
    Output classifier