## 3 Methods
### Facial Expression Recognition
\(y_{i}(\mathbf{w}\cdot\mathbf{x}_{i}+b)\geq 1\quad\forall i\)
35: Train Logistic Regression:
36:\(P(y|X)=\frac{1}{1+e^{-(wX+b)}}\)
37:Step 6: Individual Predictions
38: Predict with SVM: \(\hat{y}_{\text{SVM}}=\text{SVM}(F_{\text{selected}})\)
39: Predict with Logistic Regression: \(\hat{y}_{\text{LR}}=\text{LR}(F_{\text{selected}})\)
40:Step 7: Ensemble Prediction with DBMM
41: Compute posterior using DBMM:
42:\(P(C^{t}|A^{t})=\frac{\prod_{k=t-T}^{t}P(C^{t}|C^{k-1})\sum_{i}w_{i}^{t}P_{i }(A^{t}|C^{t})}{\sum_{i}\prod_{k=t-T}^{t}P_{ij}(C^{t}|C^{k-1})\sum_{i}w_{i}^{t} P_{i,j}(A^{t}|C^{t})}\)
43: Compute classifier weights using inverse entropy:
44:\(w_{i}=1-\frac{-\sum_{k}P_{i,k}\log p_{k,k}}{\sum(-\sum_{k}P_{i,k}\log p_{k,k})}\)
45: Compute final classification using argmax:
46:\(C^{*}=\arg\max P(C^{t}|A^{t})\)
47:Return: Predicted facial expression class C

### Theoretical Foundations of Proposed Bayesian Immediate Feedback Learning (BIFL)

Bayesian Immediate Feedback Learning (BIFL) is a probabilistic framework designed to dynamically optimize real-time stimulus selection based on immediate feedback from cognitive and affective states. BIFL combines Bayesian inference and Multi-Armed Bandit (MAB) theory to learn and adjust stimulus-response strategies for each child in an adaptive educational environment. BIFL is particularly useful in scenarios where the acquisition of extensive data is challenging due to ethical, privacy, or experimental constraints. Unlike conventional Reinforcement Learning methods that require extensive training and a predefined reward function, BIFL updates its decision-making strategy dynamically, relying on Bayesian posterior updates of observed responses. BIFL is structured around a Bayesian MAB model, where each possible stimulus is treated as an \"arm\" with an uncertain reward distribution. The algorithm balances exploration (testing new stimuli) and exploitation (employing previously effective stimuli) to maximize engagement and cognitive improvement. In other words, BIFL continuously identifies and delivers the most suitable stimulus modality (visual, auditory, or text) during gameplay by analyzing real-time multimodal feedback--including EEG concentration, facial expressions, and game performance. This enables the system to promote engagement and emotional regulation in neurodivergent children by dynamically adapting to their biophysical responses. #### 3.3.1 Problem Definition

Let there be a set of stimuli \(=\{s_{1},s_{2},...,s_{N}\}\), where each \(s_{i}\) represents a distinct stimulus (e.g., auditory, visual, or multimodal cues). The goal of BIFL is to sequentially select stimuli to maximize the engagement and cognitive performance of a child interacting with the system. At each time step \(t\), the system selects a stimulus \(s_{i}\) and observes an immediate feedback response \(x_{i,t}\), which represents an increase (or decrease) in the child's cognitive engagement or regulated emotion (from negative to neutral or positive). This feedback is obtained via EEG-based concentration levels or facial expression-based emotional responses. The reward function \(R(s_{i})\) is modeled as a random variable representing the effectiveness of stimulus \(s_{i}\) in improving engagement. The true reward distribution of each stimulus is unknown but can be estimated dynamically using Bayesian inference. Each stimulus \(s_{i}\) follows a Beta prior distribution, \(\theta_{i}\sim Beta(\alpha_{i},\beta_{i})\), where \(\alpha_{i}\) and \(\beta_{i}\) are the parameters representing the number of observed successes and failures, respectively. #### 3.3.2 Bayesian Convergence of BIFL

**Theorem 1**.