# HG changeset patch
# User Zoltan Szabo
# Date 1355562569 -3600
# Node ID 933410b35abece4089c472cc4ebed67bedb47d75
# Parent 064dbc4ba5c5246950bf08c7d2ae429b32da83c2
Distance covariance, distance correlation estimation: added; see 'IdCov_initialization.m', 'IdCov_estimation.m', 'IdCor_initialization.m', 'IdCor_estimation.m'. Temporarily the homepage of the downloaded ARfit website seems to be unavailable. Download link changed to 'http://www.mathworks.com/matlabcentral/fileexchange/174-arfit?download=true'; see 'ITE_install.m'.
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,7 @@
+v0.25 (Dec 15, 2012):
+-Distance covariance, distance correlation estimation: added; see 'IdCov_initialization.m', 'IdCov_estimation.m', 'IdCor_initialization.m', 'IdCor_estimation.m'.
+-Temporarily the homepage of the downloaded ARfit website seems to be unavailable. Download link changed to 'http://www.mathworks.com/matlabcentral/fileexchange/174-arfit?download=true'; see 'ITE_install.m'.
+
v0.24 (Dec 12, 2012):
-MMD estimation based on U- and V-statistics: added; see 'DMMD_Ustat_initialization.m', 'DMMD_Ustat_estimation.m', 'DMMD_Vstat_initialization.m', 'DMMD_Vstat_estimation.m'.
-Notes on HSIC, MMD and measures of concordance: added (doc).
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@
ITE can estimate
- `entropy (H)`: Shannon entropy, Rényi entropy, Tsallis entropy (Havrda and Charvát entropy), complex entropy,
-- `mutual information (I)`: generalized variance, kernel canonical correlation analysis, kernel generalized variance, Hilbert-Schmidt independence criterion, Shannon mutual information, L2 mutual information, Rényi mutual information, Tsallis mutual information, copula-based kernel dependency, multivariate version of Hoeffding's Phi, Schweizer-Wolff's sigma and kappa, complex mutual information, Cauchy-Schwartz quadratic mutual information, Euclidean distance based quadratic mutual information,
+- `mutual information (I)`: generalized variance, kernel canonical correlation analysis, kernel generalized variance, Hilbert-Schmidt independence criterion, Shannon mutual information, L2 mutual information, Rényi mutual information, Tsallis mutual information, copula-based kernel dependency, multivariate version of Hoeffding's Phi, Schweizer-Wolff's sigma and kappa, complex mutual information, Cauchy-Schwartz quadratic mutual information, Euclidean distance based quadratic mutual information, distance covariance, distance correlation,
- `divergence (D)`: Kullback-Leibler divergence (relative entropy), L2 divergence, Rényi divergence, Tsallis divergence, Hellinger distance, Bhattacharyya distance, maximum mean discrepancy (kernel distance, an integral probability metric), J-distance (symmetrised Kullback-Leibler divergence), Cauchy-Schwartz divergence, Euclidean distance based divergence,
- `association measures (A)`, including `measures of concordance`: multivariate extensions of Spearman's rho (Spearman's rank correlation coefficient, grade correlation coefficient),
- `cross quantities (C)`: cross-entropy.
@@ -37,7 +37,7 @@
**Download** the latest release:
-- code: [zip](https://bitbucket.org/szzoli/ite/downloads/ITE-0.24_code.zip), [tar.bz2](https://bitbucket.org/szzoli/ite/downloads/ITE-0.24_code.tar.bz2),
-- [documentation (pdf)](https://bitbucket.org/szzoli/ite/downloads/ITE-0.24_documentation.pdf).
+- code: [zip](https://bitbucket.org/szzoli/ite/downloads/ITE-0.25_code.zip), [tar.bz2](https://bitbucket.org/szzoli/ite/downloads/ITE-0.25_code.tar.bz2),
+- [documentation (pdf)](https://bitbucket.org/szzoli/ite/downloads/ITE-0.25_documentation.pdf).
diff --git a/code/H_I_D_A_C/base_estimators/IdCor_estimation.m b/code/H_I_D_A_C/base_estimators/IdCor_estimation.m
new file mode 100644
--- /dev/null
+++ b/code/H_I_D_A_C/base_estimators/IdCor_estimation.m
@@ -0,0 +1,45 @@
+function [I] = IdCor_estimation(Y,ds,co)
+%Estimates distance correlation (I) using pairwise distances of the sample points.
+%
+%We use the naming convention 'I_estimation' to ease embedding new mutual information estimation methods.
+%
+%INPUT:
+% Y: Y(:,t) is the t^th sample.
+% ds: subspace dimensions.
+% co: mutual information estimator object.
+%
+%REFERENCE:
+% Gabor J. Szekely and Maria L. Rizzo and. Brownian distance covariance. The Annals of Applied Statistics, 3:1236-1265, 2009.
+% Gabor J. Szekely, Maria L. Rizzo, and Nail K. Bakirov. Measuring and testing dependence by correlation of distances. The Annals of Statistics, 35:2769-2794, 2007.
+%
+%Copyright (C) 2012 Zoltan Szabo ("http://nipg.inf.elte.hu/szzoli", "szzoli (at) cs (dot) elte (dot) hu")
+%
+%This file is part of the ITE (Information Theoretical Estimators) Matlab/Octave toolbox.
+%
+%ITE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
+%the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+%
+%This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+%
+%You should have received a copy of the GNU General Public License along with ITE. If not, see .
+
+%co.mult:OK.
+
+[d,num_of_samples] = size(Y); %dimension, number of samples
+
+%verification:
+ if sum(ds)~=d;
+ error('The subspace dimensions are not compatible with Y.');
+ end
+ if length(ds)~=2
+ error('There must be two subspaces for this estimator.');
+ end
+
+A = compute_dCov_dCor_statistics(Y(1:ds(1),:),co.alpha);
+B = compute_dCov_dCor_statistics(Y(ds(1)+1:ds(1)+ds(2),:),co.alpha);
+
+I = sum(sum(A.*B)) / sqrt(sum(sum(A.^2)) * sum(sum(B.^2))); % / sqrt(**)
+
+
+
diff --git a/code/H_I_D_A_C/base_estimators/IdCor_initialization.m b/code/H_I_D_A_C/base_estimators/IdCor_initialization.m
new file mode 100644
--- /dev/null
+++ b/code/H_I_D_A_C/base_estimators/IdCor_initialization.m
@@ -0,0 +1,30 @@
+function [co] = IdCor_initialization(mult)
+%Initialization of the distance correlation estimator. The estimation is based on pairwise distances of the sample points.
+%
+%Note:
+% 1)The estimator is treated as a cost object (co).
+% 2)We use the naming convention 'I_initialization' to ease embedding new mutual information estimation methods.
+%
+%INPUT:
+% mult: is a multiplicative constant relevant (needed) in the estimation; '=1' means yes, '=0' no.
+%OUTPUT:
+% co: cost object (structure).
+%
+%Copyright (C) 2012 Zoltan Szabo ("http://nipg.inf.elte.hu/szzoli", "szzoli (at) cs (dot) elte (dot) hu")
+%
+%This file is part of the ITE (Information Theoretical Estimators) Matlab/Octave toolbox.
+%
+%ITE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
+%the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+%
+%This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+%
+%You should have received a copy of the GNU General Public License along with ITE. If not, see .
+
+%mandatory fields:
+ co.name = 'dCor';
+ co.mult = mult;
+
+%other fields:
+ co.alpha = 1;%\in (0,2)
diff --git a/code/H_I_D_A_C/base_estimators/IdCov_estimation.m b/code/H_I_D_A_C/base_estimators/IdCov_estimation.m
new file mode 100644
--- /dev/null
+++ b/code/H_I_D_A_C/base_estimators/IdCov_estimation.m
@@ -0,0 +1,41 @@
+function [I] = IdCov_estimation(Y,ds,co)
+%Estimates distance covariance (I) using pairwise distances of the sample points.
+%
+%We use the naming convention 'I_estimation' to ease embedding new mutual information estimation methods.
+%
+%INPUT:
+% Y: Y(:,t) is the t^th sample.
+% ds: subspace dimensions.
+% co: mutual information estimator object.
+%
+%REFERENCE:
+% Gabor J. Szekely and Maria L. Rizzo and. Brownian distance covariance. The Annals of Applied Statistics, 3:1236-1265, 2009.
+% Gabor J. Szekely, Maria L. Rizzo, and Nail K. Bakirov. Measuring and testing dependence by correlation of distances. The Annals of Statistics, 35:2769-2794, 2007.
+%
+%Copyright (C) 2012 Zoltan Szabo ("http://nipg.inf.elte.hu/szzoli", "szzoli (at) cs (dot) elte (dot) hu")
+%
+%This file is part of the ITE (Information Theoretical Estimators) Matlab/Octave toolbox.
+%
+%ITE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
+%the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+%
+%This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+%
+%You should have received a copy of the GNU General Public License along with ITE. If not, see .
+
+%co.mult:OK.
+
+[d,num_of_samples] = size(Y); %dimension, number of samples
+
+%verification:
+ if sum(ds)~=d;
+ error('The subspace dimensions are not compatible with Y.');
+ end
+ if length(ds)~=2
+ error('There must be two subspaces for this estimator.');
+ end
+
+A = compute_dCov_dCor_statistics(Y(1:ds(1),:),co.alpha);
+B = compute_dCov_dCor_statistics(Y(ds(1)+1:ds(1)+ds(2),:),co.alpha);
+I = sqrt(sum(sum(A.*B))) / num_of_samples;
diff --git a/code/H_I_D_A_C/base_estimators/IdCov_initialization.m b/code/H_I_D_A_C/base_estimators/IdCov_initialization.m
new file mode 100644
--- /dev/null
+++ b/code/H_I_D_A_C/base_estimators/IdCov_initialization.m
@@ -0,0 +1,30 @@
+function [co] = IdCov_initialization(mult)
+%Initialization of the distance covariance estimator. The estimation is based on pairwise distances of the sample points.
+%
+%Note:
+% 1)The estimator is treated as a cost object (co).
+% 2)We use the naming convention 'I_initialization' to ease embedding new mutual information estimation methods.
+%
+%INPUT:
+% mult: is a multiplicative constant relevant (needed) in the estimation; '=1' means yes, '=0' no.
+%OUTPUT:
+% co: cost object (structure).
+%
+%Copyright (C) 2012 Zoltan Szabo ("http://nipg.inf.elte.hu/szzoli", "szzoli (at) cs (dot) elte (dot) hu")
+%
+%This file is part of the ITE (Information Theoretical Estimators) Matlab/Octave toolbox.
+%
+%ITE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
+%the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+%
+%This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+%
+%You should have received a copy of the GNU General Public License along with ITE. If not, see .
+
+%mandatory fields:
+ co.name = 'dCov';
+ co.mult = mult;
+
+%other fields:
+ co.alpha = 1;%\in (0,2)
diff --git a/code/H_I_D_A_C/utilities/compute_dCov_dCor_statistics.m b/code/H_I_D_A_C/utilities/compute_dCov_dCor_statistics.m
new file mode 100644
--- /dev/null
+++ b/code/H_I_D_A_C/utilities/compute_dCov_dCor_statistics.m
@@ -0,0 +1,25 @@
+function [C] = compute_dCov_dCor_statistics(X,a)
+%Computes the statistics (C; matrix A or B in the paper) to distance covariance/correlation.
+%
+%INPUT:
+% X: X(:,t) is the t^th sample.
+% a: alpha.
+%
+%Copyright (C) 2012 Zoltan Szabo ("http://nipg.inf.elte.hu/szzoli", "szzoli (at) cs (dot) elte (dot) hu")
+%
+%This file is part of the ITE (Information Theoretical Estimators) Matlab/Octave toolbox.
+%
+%ITE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
+%the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+%
+%This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+%
+%You should have received a copy of the GNU General Public License along with ITE. If not, see .
+
+d = (sqdistance(X)).^(a/2);%squared pairwise distances => alpha/2
+ck = mean(d,2);
+cl = mean(d,1);
+c = mean(ck); %=mean(cl)
+
+C = bsxfun(@minus,bsxfun(@minus,d,ck),cl) + c;
\ No newline at end of file
diff --git a/code/ITE_install.m b/code/ITE_install.m
--- a/code/ITE_install.m
+++ b/code/ITE_install.m
@@ -49,7 +49,8 @@
if download_ARfit %download and extract the ARfit package to '/shared/embedded/ARfit':
disp('ARfit package: downloading, extraction: started.');
- [FN,status] = urlwrite('http://www.gps.caltech.edu/~tapio/arfit/arfit.zip','arfit.zip');
+ %[FN,status] = urlwrite('http://www.gps.caltech.edu/~tapio/arfit/arfit.zip','arfit.zip');%this webpage seems to unavailable temporarily
+ [FN,status] = urlwrite('http://www.mathworks.com/matlabcentral/fileexchange/174-arfit?download=true','arfit.zip');
if status %downloading: successful
%create 'shared/downloaded/ARfit', if needed:
if ~exist('shared/downloaded/ARfit')
**