Skip to main content
. 2024 Jul 31;24(15):4965. doi: 10.3390/s24154965
Algorithm 1 Approach for load recognition based on the Analysis of Variance F-test with SelectKBest and the model optimization of the gradient-boosting machines
  • Input: 

    Generated dataset (D), proportion of training data (p.train), proportion of test data (p.test), initial number of components (η), threshold (ξ), number of folds (K), set of J candidates for the values of the maximum depth hyperparameter of the chosen model/GBM: {h1(GBM,k),h2(GBM,k),,hJ(GBM,k)} = {hi(GBM,k)}i=1J.

  • Output: 

    Type of load in operation

  •   1:

    First step:

    Divide the D database between D(p.train) training set and the D(p.test) test set.

  •   2:

    Second step:

    Employ the ANOVA with SelectKBest using D(p.train) and η initial number of features. In the sequel, obtain the selected data D(p.train,ANOVA)(η).

  •   3:

    Third step:

    Compute the covariance matrix C(ANOVA) from D(p.train,ANOVA)(η). We calculate the covariance matrix based on Lemes et al. [12].

  •   4:

    Fourth step:

    Obtain the eigenvalues γi via C(ANOVA)=Λ·Γ·Λ1, in wich Λ is the eigenvector matrix and Γ is the diagonal matrix, i.e., diag(γ1,γ2,,γη).

  •   5:

    Fifth step:

    Sort the eigenvalues in descending order: γ1γ2γ3γη

  •   6:

    Sixth step:

    Discover the optimal number of features (k) through CEV:

        Generate the variable k and set its value to zero

        Compute CEVr=j=1rγji=1ηγi

            if CEVrξ

                k ← number of r-th feature

            end if

  •   7:

    Seventh step:

    Employ the ANOVA with SelectKBest, according to k features, to obtain the new selected data for the training set, i.e., the D(p.train,ANOVA)(k).

  •   8:

    Eighth step:

    Employ the possible values for the hyperparameters for each k, i.e., {hi(GBM,k)}i=1J

  •   9:

    Ninth step:

    Apply GS with K-CV

        Divide D(p.train,ANOVA)(k) in K folds

        Train the model on each K fold

        Calculate accuracy

        Measure average accuracy

        Assign the average accuracy to the current possible values for the hyperparameters

        Adopt the hyperparameter with the highest average accuracy achieved: hoptimal(GBM,k)

  • 10:

    Tenth step:

    Train the chosen GBM with hoptimal(GBM,k)

  • 11:

    Eleventh step:

    Testing the optimized model: GBM using D(p.test,ANOVA)(k)

    return Type of load in operation