function v = AI_majority_value(examples)
%
% AI_majority_value - return majority predicate value 
% Call:
%     v = ([0 1 1; 1 1 1; 0 1 0]);
% On input:
%     examples (mxn array): training set
% On output:
%     v (scalar): 0 if majority value is 0; else 1
% Custom functions used:
%     none
% Author:
%     T. Henderson, UU, 11/2002
% Method:
%      

v = 0;
if isempty(examples)
    return
end
[num_examples,num_cols] = size(examples);

v = examples(1,num_cols);  % return some class value if they exist
[num_examples,num_cols] = size(examples);
indexes = find(examples(:,num_cols-1)==1); % look at remaining examples
if isempty(indexes)
    return
end
vals = examples(indexes,num_cols);
v = mode(vals);
