GitHunt
AU

aungpyaeap/gower-distance-matlab

Gower Distance for MATLAB. This repository contains MATLAB implementation of Gower distance calculation for mixed numerical and categorical datasets.

Gower Distance MATLAB

The Gower distance is a measure of similarity and distance between two data points that can handle mixed data types [1].

$d(x_i,x_j) = \frac{\sum_{k=1}^p w_{ijk} d_{ijk}}{\sum_{k=1}^p w_{ijk}}$

where $w_{ijk}:= [0,1]$ and $d_{ij}:=\frac{|x_{i} - x_{j}|}{\max(x) - \min(x)}$ if $x_{i}$ and $x_{j}$ are numerical and $d_{ijk}:=\mathbb{I}(x_{i} \neq x_{j})$ if categorical.

This repository contains a MATLAB implementation of Gower distance calculation for mixed numerical and categorical datasets. The function returns $n \times n$ dissimilarity matrix.

Usage: Paste gower() function in MATLAB. Example usage is as follows.

X = readtable('dataset.csv',VariableNamingRule='preserve');
D = gower(X);
disp(D);

Citation

Pyae, A., Low, Y. C., & Chua, H. N. (2024, August). A Combined Distance Metric Approach with Weight Adjustment For Improving Mixed Data Clustering Quality. In 2024 IEEE International Conference on Artificial Intelligence in Engineering and Technology (IICAIET) (pp. 183-188). IEEE.

@INPROCEEDINGS{10730392,
  author={Pyae, Aung and Low, Yeh-Ching and Chua, Hui Na},
  booktitle={2024 IEEE International Conference on Artificial Intelligence in Engineering and Technology (IICAIET)}, 
  title={A Combined Distance Metric Approach with Weight Adjustment For Improving Mixed Data Clustering Quality}, 
  year={2024},
  volume={},
  number={},
  pages={183-188},
  keywords={Measurement;Refining;Clustering algorithms;Learning (artificial intelligence);Complexity theory;Optimization;Distance Metrics;Mixed Data;Hierarchical Clustering;Unsupervised Learning},
  doi={10.1109/IICAIET62352.2024.10730392}
}

References

  1. Gower, J. C. (1971). A general coefficient of similarity and some of its properties. Biometrics, 857-871.

Languages

MATLAB100.0%

Contributors

Created November 29, 2024
Updated April 8, 2025
aungpyaeap/gower-distance-matlab | GitHunt