Skip to main content
. 2025 Jun 26;25(13):3991. doi: 10.3390/s25133991
Algorithm 1. AI-based Cooperate Meta-Model Fall Risk Prediction Algorithm: Pseudocode of the Proposed Model (Figure 4)
  1. Input Mapping:

Let:
  •  XAI1 = Output of AI1  Model—Normal, Low, Moderate, High, Emergency

  •  XAI2 = Output of AI2  Model—Low, Moderate, High

Assign weights WAI1 and WAI2  to the outputs:
                   For XAI1: WAI1=0.2 if Normal0.4 if Low0.6 if Moderate0.8 if High1.0 if Emergency
                   For XAI2: WAI2=0.4 if Low0.6 if Moderate0.8 if High
  • 2.

    Combined Risk Score:

The combined risk score Scombined is calculated as:
                                      Scombined = WAI1+WAI22
  • 3.

    Define Risk Levels:

Risk level R is defined based on Scombined:
                   R=Low if 0 Scombined0.40Moderate if 0.41 Scombined0.80High 0.81 Scombined1.00
  • 4.

    Train Random Forest Meta-Model

Let the dataset consist of
  • Training features Xtrain={WAI1, WAI2}

  • Training labels Ytrain = MFS-based risk levels {Low, Moderate, High}

  • 5.

    Random Forest Model:

Initialize T, the number of decision trees.
n_estimators = 100
max_depth = 10
min_samples_split = 4
For each tree t in T:
  • Select a random subset Xt from Xtrain

  • Build a decision tree using Xt and Ytrain

  • Split data at each node using features {WAI1, WAI2}

  • Aggregate predictions from all T trees by majority voting.

  • 6.

    Predict Fall Risk:

For testing data Xtest={WAI1, WAI2}
  • Pass each test instance through all T decision trees.

  • Compute the predicted risk level Rpred  based on a majority vote from the T trees.

  • 7.

    Output Results

For each participant i, output: Participant i: {Scombined,Rpred}