Skip to main content
. 2023 May 25;23(11):5059. doi: 10.3390/s23115059
Algorithm 1: Recursive feature elimination algorithm

Input: classification data set D with n features; basic classification algorithm model (such as random forest, logistic regression, etc.); the number of features k (1kn) for iteration stop; the number of features eliminated at each step.

  • 1

    Initial feature set F={f1,f2,,fn}

  • 2

    Training the basic algorithm model:use the F feature set of the data set D to train the basic algorithm model;

  • 3

    Calculate feature importance: for each feature in F, calculate its impact on model prediction results according to the training results of the model.

  • 4

    Recursively delete features: delete the least important step features in F;

  • 5

    Repeat steps 2 to 4 until the required number of features is reached, i.e., |F|k;

  • 6

    Preserve the selected features: use the feature set F to train the final model, and output the feature subset F and model.

Output: A feature subset composed of k features.