Slides are here

In this tutorial, we demonstrate regularization-based learning of the ChI. We have a few papers on this topic, however the most complete work to date is our paper; "A. Pinar, D. T. Anderson, T. Havens, A. Zare, T. Adeyeba, "Measure of the Shapley Index for Learning Lower Complexity Fuzzy Integrals," Granular Computing, 2017".

First, clear your path and figures.

		  

close all; 
clear all;

Next, make three inputs (N=3), 2000 instances (number of samples) and randomly generate the input values (we will create their labels below in a second using a known/ground function).

		  

% how many inputs
N = 3;

% how many instances?
I = 2000;

% lets generate some data (last column is the 'label')
D = rand( I , N+1 );

Now, add some noise (so its not perfect data) and generate the label (result) for each of our above data points.

		  

% how much noise to add? == 0 means none
NoiseLevel = 0.1;

% lets make a capacity that we want to fit
[g, lambda] = fi_sugeno_lambda_measure( [0.2 0.3 0.1] );
for i=1:I
    D(i,end) = fi_choquet_integral_h_and_g_form( D(i,1:end-1) , g ) + NoiseLevel * rand();
end

Next, solve via the QP with and without regularization.

		  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Simple basic QP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% call the QP learner
[ g_res_qp ] = fi_learn_measure_qp( D )';

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Throw in some regularization
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% call the QP learner
[ g_res_qp_reg ] = fi_learn_measure_qp_reg( D , 0.4 )';

figure; bar(g)
figure; bar(g_res_qp)
figure; bar(g_res_qp_reg)

 
g =

   0.20000   0.30000   0.68655   0.10000   0.36218   0.49327   1.00000

g_res_qp =

   0.27971   0.38932   0.77647   0.17711   0.44235   0.57486   1.00000

g_res_qp_reg =

   0.11055   0.20359   0.57391   0.00000   0.25177   0.36018   1.00000 
		

Where the solver does the following

 
function [FMbinary] = fi_learn_measure_qp_reg( data_set_with_labels , reg )
	% use regularization?
	if (nargin == 1)
		reg = 0;
	end
	% prep our data set (strip it apart)
	data_set = data_set_with_labels(:,1:end-1);
	labels = data_set_with_labels(:,end);
	% how many inputs and what is the size of the fuzzy measure?
	NumOfInputs = size(data_set,2);
	g = 2^(NumOfInputs)-1; 
		

Now, we setup up our linear algebra structures (constraints, D, f, etc.). See our papers for details on their derivations and see our function [C,D,f, variablesInT] = QPmatrices(T,alpha) for how to compute them from the data.

 
	% Ceofficients and Constraints for the QP
	[C,D,f, variablesInO]=QPmatrices(data_set,labels);
		

Next, run the solver

 
	if( reg ≤ 0 )
	  FMbinary = quadprog(2*D,f,C,zeros(size(C,1),1),[],[],[zeros(g-1,1); 1],ones(g,1));
	else
	  regConstr = ones(1,g);
	  rhs = 1/reg;
	  FMbinary = quadprog(2*D,f,[C; regConstr] ,[zeros(size(C,1),1);rhs],[],[],[zeros(g-1,1); 1],ones(g,1));
	end