Why did meta-learning (or model stacking) underperform the individual base learners? I want to use meta-learning, specifically, stacking to combine the results of two algorithms, denoted here A and B. The results of A and B correspond to the first and second columns in the dataset 'dataset.csv' in the link, which are obtained by implementing A and B on a test dataset. The third column in 'dataset.csv' corresponds to the true class label, with 1 for positive class and 0 for negative class.
I used several algorithms as meta learner in MATLAB, including decision tree, logistic regression, naive bayes. Since cross validation was used, the predicted scores on the cross-validated observations were used to plot the ROC curve. The false positive rate and true positive rate were obtained using the code 'CalROCXY.m' in the above link. The results image are following:



I want to know why the performance of stacked model is worse than both of the base learners A and B? Is there something wrong with my workflow and code? Or it is just possible situation for meta-learning which might be due to the quality of my dataset.
Following is the main body of my Matlab code:
clear;
clc;

df = readtable('C:\Users\jiank\Desktop\dataset.csv');
X = df{:, 1:2};
Y = df{:, 3};
% Stacking algorithm A and B (with cross-validation):
% Mdl_tree = fitctree(X, Y, 'MaxNumSplits', 2, 'Leaveout', 'on');
% [Label,NegLoss,PBScore,Posterior] = kfoldPredict(Mdl_tree);

% Mdl = fitclinear(X, Y, 'Learner',"logistic",'CrossVal', 'on');
Mdl = fitcnb(X, Y,"CrossVal", 'on');
[label, PBScore] = kfoldPredict(Mdl);

% Evaluate performance using ROC curve:
[fpr_AE, tpr_AE, auc_AE] = CalROCXY([X(:, 1), Y]);
[fpr_LSA, tpr_LSA, auc_LSA] = CalROCXY([X(:, 2), Y]);
[fpr_Stack, tpr_Stack, auc_Stack] = CalROCXY([PBScore(:,2), Y]);

figure('Position', [50, 50, 400, 300]);
h1 = plot(fpr_AE, tpr_AE, 'b-', 'LineWidth', 1);hold on;
h2 = plot(fpr_LSA, tpr_LSA, 'r-', 'LineWidth', 1);
h3 = plot(fpr_Stack, tpr_Stack, 'm-', 'LineWidth', 1);
axis equal;axis tight;
plot([0, 1], [0, 1], 'k--');
xlabel('FPR');
ylabel('TPR');
legend([h1, h2, h3], {['AE(auc=', num2str(roundn(auc_AE, -2)), ')'], ...
                  ['LSA(auc=', num2str(roundn(auc_LSA, -2)), ')'], ...
                  ['Stacking(auc=', num2str(roundn(auc_Stack, -2)), ')']}, ...
                  'Location', 'southeast', 'Box',"off");


A popular post about 'stacking' can be found here: Ensemble Learning: Why is Model Stacking Effective?. The author said that 'stacking' can easily improve the performance with respect to the individual base learners. But I found it not that easy, at least in my project.
Many posts said the key for stacking to work consists in many different base learners are used. From my understanding, it is like the Fourier series in which a complex function can be approximated by a series of triangular base functions. It required that the base triangular fucntions are different in frequency, in other words, they represent different characteristics of the objective functions. In model stacking, we also required the base learners to be different that can capture different features of the underlying complex functions.
Actually, I calculated the simple Pearson correlation of the two methods A and B in the question, and found the correlation coefficient to be only 0.2. I am not sure whether it indicates being different enough for stacking. If they are not that different, or they both underestimate or overestiamte the result on average, then the stacking can never improve the performance whatever meta-learner was used?
