I am marking the exams and here I want to report the most absurd solutions
using the AI a student has created the required pivot table MANUALLY
willingn = [1;1;2;2;3;3;4;4;5;5;6;6;7;7];
disc_compete = {"[1, 4)"; "[4, 7)"; "[1, 4)"; "[4, 7)"; "[1, 4)"; "[4, 7)"; "[1, 4)"; "[4, 7)"; "[1, 4)"; "[4, 7)"; "[1, 4)"; "[4, 7)"; "[1, 4)"; "[4, 7)"};
XGlobal_1_5 = [35; 4; 33; 3; 24; 8; 22; 34; 23; 44; 10; 31; 9; 9];
XGlobal_5_7 = [ 2; 1; 2; 2; 2; 1; 13; 7; 30; 9;264; 12;571;972];
% crating a Table now
T = table(willingn, disc_compete, XGlobal_1_5, XGlobal_5_7);
disp(T)
Of course this student had a penalization of -5 to the overall exam
The same student also got this very generic and wrong output from AI
% Comment on univariate outliers:
% Univariate outliers are observations that fall far from the main cluster
% in either age or xGlobal. Points with age > 30 or age < 20 may be outliers.
% Points with xGlobal values much higher than the main distribution
Look at this student
% The table needs to group:
% Rows: 'willing' (1 to 7) and discretized 'compete' into [1, 4) and [4, 7]
% Columns: discretized 'xGlobal' into [1, 5) and [5, 7]
% Discretize 'compete'
% [1, 4) matches values 1, 2, 3. [4, 7] matches 4, 5, 6, 7.
disc_compete = cell(height(sm), 1);
disc_compete(sm.compete >= 1 & sm.compete < 4) = {'[1, 4)'};
disc_compete(sm.compete >= 4 & sm.compete <= 7) = {'[4, 7]'};
% Discretize 'xGlobal'
% [1, 5) matches 1, 2, 3, 4. [5, 7] matches 5, 6, 7.
disc_xGlobal = cell(height(sm), 1);
disc_xGlobal(sm.xGlobal >= 1 & sm.xGlobal < 5) = {'[1, 5)'};
disc_xGlobal(sm.xGlobal >= 5 & sm.xGlobal <= 7) = {'[5, 7]'};
% Create a temporary table for pivot grouping
tmpTable = table(sm.willingn, disc_compete, disc_xGlobal, ...
'VariableNames', {'willingn', 'disc_compete', 'xGlobal_bins'});
% Compute the Pivot Table using unstack
TVP_raw = groupsummary(tmpTable, {'willingn', 'disc_compete', 'xGlobal_bins'});
TVP = unstack(TVP_raw, 'GroupCount', 'xGlobal_bins');
% Ensure column order matches the prompt: [1, 5) then [5, 7]
target_records = sm(sm.willingn == 1 & ...
sm.compete >= 4 & sm.compete <= 7 & ...
sm.xGlobal >= 1 & sm.xGlobal < 5, :);
disp('--- Task 2: First 3 columns of the 4 extracted records ---');
disp(target_records(1:4, 1:3));
disp('--- Task 3: Contingency Table (willingn vs compete) ---');
[ContingencyTable, chi2, p, labels] = crosstab(sm.willingn, sm.compete);
disp(ContingencyTable);
The incredible thing is that the dataset has not even been LOADED into memory!!!!!!!!!!!!!!!!!
SAL.... you have been penalized!
Now let us come to this solution which is incredible
%% Compute the pivot table shown in the text
KU.disc_compete = strings(height(KU),1);
KU.disc_compete(KU.compete >= 1 & KU.compete < 4) = "[1,4)";
KU.disc_compete(KU.compete >= 4 & KU.compete <= 7) = "[4,7]";
KU.disc_compete = categorical(KU.disc_compete);
KU.disc_xGlobal = strings(height(KU),1);
KU.disc_xGlobal(KU.xGlobal >= 1 & KU.xGlobal < 5) = "[1,5)";
KU.disc_xGlobal(KU.xGlobal >= 5 & KU.xGlobal <= 7) = "[5,7]";
KU.disc_xGlobal = categorical(KU.disc_xGlobal);
TVP = groupsummary( ...
KU,...
{'willingn','disc_compete','disc_xGlobal'} ...
);
TVP = unstack(TVP,"GroupCount","disc_xGlobal");
TVP.Properties.VariableNames{3} = '[1,5)';
TVP.Properties.VariableNames{4} = '[5,7]';
disp("Pivot table:")
disp(TVP)
This student however managed to get it right from the AI.
However the evaluation in this case is reduced
Look what this student has done later
%% Comment on both plots
fprintf("Chi-square statistic = %.4f\n", chi2);
fprintf("p-value = %.4f\n", pValue);
if pValue < 0.05
disp("Variables are associated")
else
disp("Variables are not associated")
end
disp("Cells with large values contribute more to the Chi-square statistic.")
disp("The Pareto plot highlights the most important cells.")
This is the typical very generic thing generated by AI.
Also this part has been fully created by AI
%% Create a plot showing the contribution of each cell
% to the Chi-square index and the associated Pareto plot
rowTotals = sum(ContTable,2);
colTotals = sum(ContTable,1);
grandTotal = sum(ContTable(:));
Expected = rowTotals * colTotals / grandTotal;
ChiContribution = (ContTable - Expected).^2 ./ Expected;
figure
heatmap(ChiContribution)
title("Chi-square contributions")
figure
pareto(ChiContribution(:))
KU... you got a PENALIZATION for this
This is another absurd solution
This code generated by AI
SI = readtable("univer.xlsx","ReadRowNames",true);
disp(SI.Properties.VariableNames)
disp("Dataset Variables displayed")
%% TASK 2
SI.compClass = categorical( ...
discretize(SI.compete, [1 4 7], ...
'categorical', ["Low", "High"]));
SI.globClass = categorical( ...
discretize(SI.xGlobal, [1 5 7], ...
'categorical', ["Small", "Large"]));
%% Summary Table
S = groupsummary( ...
SI,...
{'willingn','compClass','globClass'} ...
);
S = unstack(S,"GroupCount","globClass");
disp(S)
produces

a table which is very different from the onw which was requested
Of course ZO... you have been strongly penalized
The summary of this is: you can use the copilot and the AI but
- if the solution generated by AI is correct but overcomplicated you will not have full score
- if the solution generated by AI is wrong and then you do not realize it is wrong your exam will be strongly penalized
I am marking the exams and here I want to report the most absurd solutions
using the AI a student has created the required pivot table MANUALLY
Of course this student had a penalization of -5 to the overall exam
The same student also got this very generic and wrong output from AI
% Comment on univariate outliers:
% Univariate outliers are observations that fall far from the main cluster
% in either age or xGlobal. Points with age > 30 or age < 20 may be outliers.
% Points with xGlobal values much higher than the main distribution
Look at this student
The incredible thing is that the dataset has not even been LOADED into memory!!!!!!!!!!!!!!!!!
SAL.... you have been penalized!
Now let us come to this solution which is incredible
%% Compute the pivot table shown in the text
KU.disc_compete = strings(height(KU),1);
KU.disc_compete(KU.compete >= 1 & KU.compete < 4) = "[1,4)";
KU.disc_compete(KU.compete >= 4 & KU.compete <= 7) = "[4,7]";
KU.disc_compete = categorical(KU.disc_compete);
KU.disc_xGlobal = strings(height(KU),1);
KU.disc_xGlobal(KU.xGlobal >= 1 & KU.xGlobal < 5) = "[1,5)";
KU.disc_xGlobal(KU.xGlobal >= 5 & KU.xGlobal <= 7) = "[5,7]";
KU.disc_xGlobal = categorical(KU.disc_xGlobal);
TVP = groupsummary( ...
KU,...
{'willingn','disc_compete','disc_xGlobal'} ...
);
TVP = unstack(TVP,"GroupCount","disc_xGlobal");
TVP.Properties.VariableNames{3} = '[1,5)';
TVP.Properties.VariableNames{4} = '[5,7]';
disp("Pivot table:")
disp(TVP)
This student however managed to get it right from the AI.
However the evaluation in this case is reduced
Look what this student has done later
This is the typical very generic thing generated by AI.
Also this part has been fully created by AI
%% Create a plot showing the contribution of each cell
% to the Chi-square index and the associated Pareto plot
rowTotals = sum(ContTable,2);
colTotals = sum(ContTable,1);
grandTotal = sum(ContTable(:));
Expected = rowTotals * colTotals / grandTotal;
ChiContribution = (ContTable - Expected).^2 ./ Expected;
figure
heatmap(ChiContribution)
title("Chi-square contributions")
figure
pareto(ChiContribution(:))
KU... you got a PENALIZATION for this
This is another absurd solution
This code generated by AI
SI = readtable("univer.xlsx","ReadRowNames",true);
disp(SI.Properties.VariableNames)
disp("Dataset Variables displayed")
%% TASK 2
produces
Of course ZO... you have been strongly penalized
The summary of this is: you can use the copilot and the AI but