Practical thinking about AI tools and everyday work.

Gower distance compares records that mix numbers and categories

An analyst comparing records in a spreadsheet
AI-generated photographic illustration; not documentary photography.

A customer or service record may contain a number, a category and a yes-or-no field. Comparing such records is not as simple as subtracting every column. Gower dissimilarity offers a way to combine differences across mixed variable types.

The R cluster package’s daisy documentation describes its implementation, including numerical, nominal, ordered and binary variables. The declared type affects how a field contributes to the comparison.

Suppose an illustrative dataset contains delivery distance, service type and whether special handling was required. Distance is numerical. Service type is a category, even if someone exported it as codes 1, 2 and 3. Treating those codes as ordinary numbers would imply an ordering and spacing that may not exist.

For numerical fields, Gower’s approach commonly scales differences using a range. For a nominal category, matching and differing values are handled differently from numerical subtraction. Contributions are then combined according to the implementation and any chosen weights.

Missing values also need attention. A pair compared on fewer available fields may not be supported by the same amount of information as another pair. Record the missingness rather than treating every resulting number as equally informative.

Take a few records and inspect which neighbours the method finds. Can you explain why each pair is close? Does one field dominate because of its weighting or coding? Does an extreme numerical value change the scaling in an unhelpful way?

These checks are especially useful before feeding a distance matrix into a clustering method. A neat cluster plot cannot repair a mistaken definition of a variable.

Keep a data dictionary with the type and weight of each field, the treatment of missing values and the software version used. If the result supports a business decision, review whether the chosen notion of similarity is appropriate for that decision.

Gower dissimilarity is a tool for expressing a comparison, not a discovery that two people or businesses are inherently alike. Its value comes from making the comparison explicit enough to inspect, challenge and improve.