Skip to content

Error with own distance function when calculating Davies Bouldin #2

@bamaly

Description

@bamaly

I wanted to use my own distance function, as below:

distfun = @(XI,XJ)(1-abs(MyCorr(XI',XJ')));

MyCorr function:
function c = MyCorr(in1,in2)

% Average reference both sets of input maps
nO = size(in1,1);
Centering = eye(nO) - 1/nO;

in1 = Centering * in1;

if nargin < 2
    in2 = in1;
else
    in2 = Centering * in2;
end

% Compute covariance matrix between sets of input maps
covar = in1' * in2;
var1 = diag(in1' * in1);
var2 = diag(in2' * in2);

c = covar./sqrt(var1*var2');

While it works with the silhouette coefficient function, I get following error with Davies Bouldin:

Error using internal.stats.parseArgs
Invalid parameter name: Distance.

Error in clustering.evaluation.DaviesBouldinEvaluation (line 53)
      internal.stats.parseArgs(basePnames, baseDflts, varargin{:});

Error in evalclusters (line 190)
           obj = clustering.evaluation.DaviesBouldinEvaluation(X,YorFun,varargin{:});

Does someone no the whats the issue?
Thanks a lot in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions