Skip to main content
. 2024 Oct 22;24(21):6776. doi: 10.3390/s24216776
Algorithm 2 Hybrid LIME–SHAP Explanation Generation
Require: Decision dD, Model M, Feature set F={f1,f2,,fm}
Ensure: Hybrid feature importance ϕiHybrid for all fiF
  •   1:

    Input: Decision d, Model M, Feature set F

  •   2:

    Output: Hybrid feature importance ϕiHybrid

  •   3:

    Step 1: LIME Approximation

  •   4:

    for each feature fiF do

  •   5:

          Compute LIME importance f^iLIME=LIME(fi,d)

  •   6:

    end for

  •   7:

    Step 2: SHAP Refinement

  •   8:

    for each feature fiF do

  •   9:

          if fiTop-k features based on f^iLIME then

  • 10:

              Compute SHAP value ϕiSHAP

  • 11:

              Compute hybrid importance ϕiHybrid=α·f^iLIME+(1α)·ϕiSHAP

  • 12:

          else

  • 13:

               Set ϕiHybrid=f^iLIME

  • 14:

          end if

  • 15:

    end for

  • 16:

    Step 3: Multi-Model Aggregation

  • 17:

    if multiple models M1,M2,,MN are used then

  • 18:

          for each feature fiF do

  • 19:

                Compute aggregated importance ϕiHybrid-Combined=1Nj=1Nϕi,jHybrid

  • 20:

          end for

  • 21:

    end if

  • 22:

    Return: ϕiHybrid or ϕiHybrid-Combined