In this tutorial, we demonstrate a cool way to visualize a fuzzy measure learned from data. This code was generated by Dr. Tony Pinar.

First, clear your path and figures.


close all; 
clear all;

Next, we create a problem with 7 inputs and we generate some random data sampled from a Sugeno lambda fuzzy measure with densities [0 0.2 0.2 0 0.6 0 0 ]. Based on our rand call to select the data, we get a spread out sampling of walks. Instead, to show what we encounter more often in reality, we kill some pathways. For example, we find every data point that starts with a 1, 4, 6 or 7 (the densities with value 0) and we remove those walks.


% how many inputs
N = 7;

% how many instances?
I = 1000;

% lets generate some data (last column is the 'label')
D = rand( I , N+1 );
% lets make some paths a no go
[Sv Si] = sort(D(:,1:N)');
Si = Si';
Inds = [ find( Si(:,1) == 1 ) ; find( Si(:,1) == 4 ) ; find( Si(:,1) == 6 ) ; find( Si(:,1) == 7 ) ];
D(Inds,:) = [];
I = size(D,1);

% 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 0.2 0.2 0 0.6 0 0 ] );
for i=1:I
    D(i,end) = fi_choquet_integral_h_and_g_form( D(i,1:end-1) , g ) + NoiseLevel * rand();

Now, call the QP learner with no regularization


% call the QP learner
[ g_res_qp ] = fi_learn_measure_qp_reg_matlab( D , 0 )';

Now, view it. First, we look at what the data sorting orders are. Then, we call the plot function.


% draw it
[Sv Si] = sort(D(:,1:N)');
SortOrder = Si';

%% This block is all optional--just setting up the figure window
hFig = figure(1);

% Set if you want the value of the FM to be printed on the viz.
showFMvals = 0;

% Set if you want the fraction of the number of touched nodes per level of
% the lattice printed on the viz (along the right side of the viz, next to
% each respective level). The top right of the viz also shows a percentage
% indicating the percentage of the entire lattice that is used.
% The text generated by this may overlap with the FM values in the viz.
showStats = 0;

% Set if you want the paths up the lattice taken by the ChI (this is why
% the sorting orders are needed above in line 11).
showPaths = 1;
fi_prettyLattice( SortOrder, g_res_qp, showFMvals, showStats, showPaths);

Example output is as follows. Note, the size of the FM variables indcate their value, e.g., g(x1)=0.5 is larger than g(x2)=0.1. Also, the brighter the curves the greater the frequency of path visitation. You can see the fi_view_lattice.m if you want to see how we generate the image.

Now, if we use regularization, fi_learn_measure_qp_reg_matlab( D , 0.05 ), then we obtain the following.

Last, the following is an example for training on the benchmark Ionosphere data set using 10 base kernels. Note, there are numerous untouched nodes. Furthermore, this means their subsequent values are not supported by data but instead are driven by the monotonicity constraints and the specifics of the underlying solver (see our papers for more details).