# Gower distance

For features $$x_i=\{x_{i1},\dots,x_{ip}\}$$ and $$x_j=\{x_{j1},\dots,x_{jp}\}$$, the Gower similarity matrix 1 can be defined as

$S_{\text{Gower}}(x_i, x_j) = \frac{\sum_{k=1}^p s_{ijk}\delta_{ijk}}{\sum_{k=1}^p \delta_{ijk}}.$

For each feature $$k=1,\dots,p$$ a score $$s_{ijk}$$ is calculated. A quantity $$\delta_{ijk}$$ is also calculated having possible values $$\{0,1\}$$ depending on whether the variables $$x_i$$ and $$x_j$$ can be compared or not (e.g. if they have different types).

A special case2 for when no missing values exist can be formulated as the mean of the Gower similarity scores, that is:

$S_{\text{Gower}}(x_i, x_j) = \frac{\sum_{k=1}^p s_{ijk}}{p}.$

The score $$s_{ijk}$$ calculation will depend on the type of variable and below we will see some examples.

This similarity score will take values between $$0 \leq s_{ijk} \leq 1$$ with $$0$$ representing maximum similarity and $$1$$ no similarity.

## Scoring

### Numerical variables

For numerical variables the score can be calculated as

$s_{ijk} = 1 - \frac{|x_{ik}-x_{jk}|}{R_k}.$

This is simply a Manhattan distance distance between the two values normalised by a quantity $$R_k$$. The quantity $$R_k$$ refers to the range of feature (population or sample).

### Categorical variables

For categorical variables we will use following score:

$s_{ijk} = 1\{x_{ik}=x_{jk}\}$

This score will be $$1$$ if the categories are the same and $$0$$ if they are not.

In reality the score $$S_{\text{Gower}}(x_i, x_j)$$ will be a similarity score taking values between $$1$$ (for equal points) and $$0$$ for extremely dissimilar points. In order to turn this value into a distance metric we can convert it using (for instance)

$d_{\text{Gower}} = \sqrt{1-S_{\text{Gower}}}.$

This will take values of $$1$$ for the furthest points and $$0$$ for the same points.

## Example

Here we will use the special case when no missing values exist. A test dataset can be:

import pandas as pd

df = pd.DataFrame({
"Sex1": ['M', 'M', 'F', 'F', 'F', 'M', 'M', 'F', 'F', 'F'],
"Sex2": ['M', 'M', 'F', 'F', 'F', 'F', 'F', 'M', 'M', 'M'],
"Age1": [15, 15, 15, 15, 15, 15, 15, 15, 15, 15],
"Age2": [15, 36, 58, 78, 100, 15, 36, 58, 78, 100]
})
df

Sex1 Sex2 Age1 Age2
0 M M 15 15
1 M M 15 36
2 F F 15 58
3 F F 15 78
4 F F 15 100
5 M F 15 15
6 M F 15 36
7 F M 15 58
8 F M 15 78
9 F M 15 100

For the numerical variable (age) we can define the range as $$R_{\text{age}}=\left(\max{\text{age}}-\min{\text{age}}\right)$$.

age_min = df["Age1", "Age2"](/"age1",-"age2".html).min().min()
age_max = df["Age1", "Age2"](/"age1",-"age2".html).max().max()
R_age = age_max - age_min
print(f"R_age = {R_age}")

R_age = 85


We can now calculate the score for each numerical field

def s_numeric(x1, x2, R):
return 1 - abs(x1-x2)/R

df['s_age'] = df.apply(lambda x: s_numeric(x['Age1'], x['Age2'], R_age), axis=1)
df

Sex1 Sex2 Age1 Age2 s_age
0 M M 15 15 1.000000
1 M M 15 36 0.752941
2 F F 15 58 0.494118
3 F F 15 78 0.258824
4 F F 15 100 0.000000
5 M F 15 15 1.000000
6 M F 15 36 0.752941
7 F M 15 58 0.494118
8 F M 15 78 0.258824
9 F M 15 100 0.000000

For categorical variables we can define the following score function:

def s_categorical(x1, x2):
return 1 if x1==x2 else 0

df['s_sex'] = df.apply(lambda x: s_categorical(x['Sex1'], x['Sex2']), axis=1)
df

Sex1 Sex2 Age1 Age2 s_age s_sex
0 M M 15 15 1.000000 1
1 M M 15 36 0.752941 1
2 F F 15 58 0.494118 1
3 F F 15 78 0.258824 1
4 F F 15 100 0.000000 1
5 M F 15 15 1.000000 0
6 M F 15 36 0.752941 0
7 F M 15 58 0.494118 0
8 F M 15 78 0.258824 0
9 F M 15 100 0.000000 0

We can now calculate the final score using

import math

df['s'] = df.apply(lambda x: (x['s_age'] + x['s_sex'])/2.0, axis=1)
df['d'] = df.apply(lambda x: math.sqrt(1.0 - x['s']), axis=1)
df

Sex1 Sex2 Age1 Age2 s_age s_sex s d
0 M M 15 15 1.000000 1 1.000000 0.000000
1 M M 15 36 0.752941 1 0.876471 0.351468
2 F F 15 58 0.494118 1 0.747059 0.502933
3 F F 15 78 0.258824 1 0.629412 0.608760
4 F F 15 100 0.000000 1 0.500000 0.707107
5 M F 15 15 1.000000 0 0.500000 0.707107
6 M F 15 36 0.752941 0 0.376471 0.789639
7 F M 15 58 0.494118 0 0.247059 0.867722
8 F M 15 78 0.258824 0 0.129412 0.933053
9 F M 15 100 0.000000 0 0.000000 1.000000

## Range impact

### Varying bounds

Let's visualise how the choice of range can affect the scoring, if can set it arbitrarily. First let's pick two random points, $$x_1=(30, M)$$ and $$x_2=(35, F)$$.

We will vary the bounds from a $$15\leq x_{min}<30$$ and $$35< x_{max} \leq 100$$.

def score(x1, x2, R):
s_0 = 1-abs(x1[0]-x2[0])/R
s_1 = 1 if x1[1]==x2[1] else 0
return (s_0 + s_1)/2.0

def distance(s):
return math.sqrt(1.0-s)

import numpy as np

x1 = (30, 'M')
x2 = (35, 'F')
bmin = np.linspace(15, 30, num=1000)
bmax = np.linspace(36, 100, num=1000)
scores_min = [distance(score(x1, x2, 100-bm)) for bm in bmin]
scores_max = [distance(score(x1, x2, bm-15)) for bm in bmax]

import seaborn as sns
import matplotlib.pyplot as plt
from plotutils import *

fig, ax =plt.subplots(1,2)

sns.scatterplot(bmin, scores_min, ax=ax[0])
ax[0].set(xlabel="Range minimum", ylabel="Score",
title="Gower distance\nfor varying minimum bound")
ax[0].set(ylim=(0, 1))
sns.scatterplot(bmax, scores_max, ax=ax[1])
ax[1].set(xlabel="Range maximum", ylabel="Score",
title="Gower distance\nfor varying maximum bound")
ax[1].set(ylim=(0, 1))
plt.show()


Let's try with more separated points

x1 = (16, 'M')
x2 = (90, 'F')
bmin = np.linspace(15, 16, num=1000, endpoint=False)
bmax = np.linspace(91, 100, num=1000)
scores_min = [distance(score(x1, x2, 100-bm)) for bm in bmin]
scores_max = [distance(score(x1, x2, bm-16)) for bm in bmax]

fig, ax =plt.subplots(1,2)

sns.scatterplot(bmin, scores_min, ax=ax[0])
ax[0].set(xlabel="Range minimum", ylabel="Score",
title="Gower distance\nfor varying minimum bound")
ax[0].set(ylim=(0, 1))
sns.scatterplot(bmax, scores_max, ax=ax[1])
ax[1].set(xlabel="Range maximum", ylabel="Score",
title="Gower distance\nfor varying maximum bound")
ax[1].set(ylim=(0, 1))
plt.show()


### Varying range directly

We will now try to see how the distance between two point comparisons (very close, very far) changes when varying the range directly. We will choose two sets of points, $$x_1=(1000, M), x_2=(1001, F)$$ and $$x_1=(500, M), x_2=(50000, F)$$. The range will vary between

$\max(x_1, x_2)-\min(x_1, x_2)<R<100000.$

We are also interested on the weight the categorical variable will have on the final distance with varying bounds, so we will also calculate them for an alternative $$x_2'=(1001, M)$$ anf $$x_2'=(50000, M)$$.

For the first set of points we will have:

x1 = (1000.0, 'M')
x2 = (1001.0, 'F')
MAX_RANGE = 100000
R = np.linspace(max(x1[0], x2[0])-min(x1[0], x2[0]), MAX_RANGE, num=100000)

distances_M = [distance(score(x1, x2, i)) for i in R]
distances_F = [distance(score(x1, (x2[0], 'M'), i)) for i in R]

ax = sns.scatterplot(R, distances_M, label="$x_2$")
sns.scatterplot(R, distances_F, label="$x_2'$")
ax.set(xlabel="Range", ylabel="Distance",
title="Gower distance\nfor varying range (close points)")
ax.set(ylim=(0, 1), xscale="log")
plt.show()


And for far away points we will have:

x1 = (500.0, 'M')
x2 = (50000.0, 'F')
MAX_RANGE = 100000
R = np.linspace(max(x1[0], x2[0])-min(x1[0], x2[0]), MAX_RANGE, num=100000)

distances_M = [distance(score(x1, x2, i)) for i in R]
distances_F = [distance(score(x1, (x2[0], 'M'), i)) for i in R]

ax = sns.scatterplot(R, distances_M, label="$x_2$")
sns.scatterplot(R, distances_F, label="$x_2'$")
ax.set(xlabel="Range", ylabel="Distance",
title="Gower distance\nfor varying range (far away points)")
ax.set(ylim=(0, 1), xscale="log")
plt.show()


## Categorical impact

Predictably, in the scenario where we calculate the mean of the Gower distances, for a point $$x$$ with $$p$$ features, $$x=(x_{1},\dots,x_{p})$$, the contribution to the final distance of a categorial variable will be either $$0$$ or $$1/p$$, regardless of the range.

## Missing range

For the previous examples the range $$R$$ was available, but how to calculate the mixed distance when the numerical range is absent?

A possible way is to use scale each feature using unit scaling:

$f_u(x) = \frac{x}{||x||}$

We will visualise how a difference varying from $$-1000 \leq \delta \leq 1000$$ varies with the $$f_u(\delta)$$ transformation.

def f_unit(x):
return np.exp(x)/(np.exp(x)+1.0)

delta = np.linspace(-10, 10, num=20000)
transformed = [ilogit(abs(x)) for x in delta]

ax = sns.scatterplot(delta, transformed)
ax.set(xlabel="Range", ylabel="Distance",
title="Gower distance\nfor varying range (far away points)")
# ax.set(ylim=(0, 1), xscale="log")
plt.show()
transformed


[0.9999546021312976,
0.9999545567105143,
0.9999545112442892,
0.9999544657325772,
0.9999544201753325,
0.9999543745725097,
0.9999543289240632,
0.9999542832299472,
0.9999542374901161,
0.9999541917045244,
0.9999541458731259,
0.999954099995875,
0.999954054072726,
0.9999540081036327,
0.9999539620885493,
0.9999539160274296,
0.9999538699202277,
0.9999538237668976,
0.999953777567393,
0.9999537313216678,
0.9999536850296756,
0.9999536386913703,
0.9999535923067056,
0.9999535458756348,
0.9999534993981118,
0.9999534528740901,
0.999953406303523,
0.9999533596863641,
0.9999533130225668,
0.9999532663120844,
0.99995321955487,
0.9999531727508773,
0.9999531259000591,
0.9999530790023687,
0.9999530320577592,
0.9999529850661837,
0.9999529380275952,
0.9999528909419467,
0.999952843809191,
0.9999527966292812,
0.9999527494021698,
0.9999527021278098,
0.999952654806154,
0.999952607437155,
0.9999525600207654,
0.9999525125569378,
0.9999524650456248,
0.9999524174867789,
0.9999523698803524,
0.9999523222262979,
0.9999522745245677,
0.9999522267751141,
0.9999521789778892,
0.9999521311328455,
0.9999520832399349,
0.9999520352991097,
0.999951987310322,
0.9999519392735235,
0.9999518911886666,
0.9999518430557028,
0.9999517948745844,
0.9999517466452629,
0.9999516983676903,
0.9999516500418181,
0.9999516016675982,
0.9999515532449822,
0.9999515047739215,
0.9999514562543679,
0.9999514076862727,
0.9999513590695874,
0.9999513104042634,
0.9999512616902521,
0.9999512129275047,
0.9999511641159725,
0.9999511152556066,
0.9999510663463583,
0.9999510173881787,
0.9999509683810187,
0.9999509193248294,
0.9999508702195617,
0.9999508210651666,
0.999950771861595,
0.9999507226087975,
0.9999506733067249,
0.9999506239553281,
0.9999505745545575,
0.9999505251043639,
0.9999504756046977,
0.9999504260555097,
0.99995037645675,
0.9999503268083693,
0.9999502771103177,
0.9999502273625458,
0.9999501775650036,
0.9999501277176415,
0.9999500778204096,
0.9999500278732579,
0.9999499778761366,
0.9999499278289957,
0.9999498777317851,
0.9999498275844548,
0.9999497773869547,
0.9999497271392344,
0.9999496768412438,
0.9999496264929326,
0.9999495760942505,
0.999949525645147,
0.9999494751455719,
0.9999494245954744,
0.9999493739948041,
0.9999493233435105,
0.9999492726415429,
0.9999492218888505,
0.9999491710853827,
0.9999491202310886,
0.9999490693259174,
0.9999490183698183,
0.9999489673627402,
0.9999489163046321,
0.9999488651954431,
0.999948814035122,
0.9999487628236178,
0.9999487115608789,
0.9999486602468546,
0.9999486088814932,
0.9999485574647434,
0.9999485059965539,
0.9999484544768732,
0.9999484029056498,
0.9999483512828321,
0.9999482996083686,
0.9999482478822075,
0.9999481961042971,
0.9999481442745858,
0.9999480923930215,
0.9999480404595525,
0.9999479884741269,
0.9999479364366927,
0.9999478843471978,
0.9999478322055902,
0.9999477800118178,
0.9999477277658284,
0.9999476754675696,
0.9999476231169894,
0.9999475707140352,
0.9999475182586547,
0.9999474657507955,
0.999947413190405,
0.9999473605774308,
0.9999473079118203,
0.9999472551935207,
0.9999472024224793,
0.9999471495986434,
0.9999470967219602,
0.9999470437923769,
0.9999469908098405,
0.999946937774298,
0.9999468846856964,
0.9999468315439827,
0.9999467783491036,
0.999946725101006,
0.9999466717996368,
0.9999466184449425,
0.99994656503687,
0.9999465115753655,
0.9999464580603761,
0.9999464044918478,
0.9999463508697273,
0.9999462971939609,
0.999946243464495,
0.9999461896812759,
0.9999461358442497,
0.9999460819533628,
0.999946028008561,
0.9999459740097907,
0.9999459199569977,
0.9999458658501279,
0.9999458116891274,
0.9999457574739421,
0.9999457032045176,
0.9999456488807996,
0.999945594502734,
0.9999455400702664,
0.9999454855833422,
0.9999454310419071,
0.9999453764459065,
0.9999453217952858,
0.9999452670899905,
0.9999452123299657,
0.9999451575151568,
0.999945102645509,
0.9999450477209673,
0.9999449927414769,
0.9999449377069828,
0.99994488261743,
0.9999448274727634,
0.9999447722729279,
0.9999447170178684,
0.9999446617075294,
0.9999446063418558,
0.9999445509207922,
0.9999444954442832,
0.9999444399122733,
0.9999443843247071,
0.9999443286815289,
0.9999442729826831,
0.999944217228114,
0.999944161417766,
0.9999441055515831,
0.9999440496295094,
0.9999439936514893,
0.9999439376174666,
0.9999438815273853,
0.9999438253811894,
0.9999437691788228,
0.9999437129202291,
0.9999436566053522,
0.9999436002341359,
0.9999435438065236,
0.9999434873224591,
0.9999434307818859,
0.9999433741847473,
0.9999433175309869,
0.999943260820548,
0.9999432040533739,
0.9999431472294078,
0.999943090348593,
0.9999430334108725,
0.9999429764161895,
0.999942919364487,
0.9999428622557078,
0.999942805089795,
0.9999427478666915,
0.9999426905863398,
0.9999426332486828,
0.9999425758536633,
0.9999425184012237,
0.9999424608913067,
0.9999424033238548,
0.9999423456988104,
0.9999422880161158,
0.9999422302757136,
0.9999421724775458,
0.9999421146215547,
0.9999420567076825,
0.9999419987358713,
0.9999419407060631,
0.9999418826182,
0.9999418244722238,
0.9999417662680763,
0.9999417080056995,
0.9999416496850351,
0.9999415913060247,
0.99994153286861,
0.9999414743727326,
0.999941415818334,
0.9999413572053556,
0.9999412985337388,
0.9999412398034251,
0.9999411810143557,
0.9999411221664717,
0.9999410632597144,
0.999941004294025,
0.9999409452693443,
0.9999408861856135,
0.9999408270427734,
0.9999407678407649,
0.9999407085795289,
0.999940649259006,
0.9999405898791371,
0.9999405304398628,
0.9999404709411234,
0.9999404113828597,
0.9999403517650121,
0.9999402920875209,
0.9999402323503266,
0.9999401725533693,
0.9999401126965893,
0.9999400527799268,
0.9999399928033219,
0.9999399327667146,
0.9999398726700448,
0.9999398125132525,
0.9999397522962776,
0.9999396920190599,
0.999939631681539,
0.9999395712836547,
0.9999395108253466,
0.9999394503065543,
0.9999393897272172,
0.9999393290872748,
0.9999392683866664,
0.9999392076253314,
0.9999391468032091,
0.9999390859202385,
0.9999390249763589,
0.9999389639715094,
0.9999389029056289,
0.9999388417786563,
0.9999387805905308,
0.9999387193411908,
0.9999386580305754,
0.9999385966586231,
0.9999385352252725,
0.9999384737304625,
0.9999384121741314,
0.9999383505562177,
0.9999382888766597,
0.9999382271353959,
0.9999381653323645,
0.9999381034675037,
0.9999380415407516,
0.9999379795520464,
0.9999379175013262,
0.9999378553885288,
0.9999377932135921,
0.999937730976454,
0.9999376686770522,
0.9999376063153246,
0.9999375438912088,
0.9999374814046422,
0.9999374188555625,
0.9999373562439072,
0.9999372935696137,
0.9999372308326192,
0.9999371680328611,
0.9999371051702766,
0.9999370422448028,
0.9999369792563769,
0.9999369162049359,
0.9999368530904166,
0.999936789912756,
0.9999367266718912,
0.9999366633677585,
0.999936600000295,
0.9999365365694373,
0.9999364730751217,
0.999936409517285,
0.9999363458958637,
0.9999362822107939,
0.9999362184620122,
0.9999361546494547,
0.9999360907730579,
0.9999360268327575,
0.99993596282849,
0.9999358987601911,
0.9999358346277969,
0.9999357704312433,
0.999935706170466,
0.9999356418454008,
0.9999355774559835,
0.9999355130021497,
0.9999354484838349,
0.9999353839009746,
0.9999353192535043,
0.9999352545413592,
0.9999351897644749,
0.9999351249227865,
0.999935060016229,
0.9999349950447377,
0.9999349300082477,
0.9999348649066939,
0.9999347997400112,
0.9999347345081344,
0.9999346692109984,
0.9999346038485378,
0.9999345384206875,
0.9999344729273818,
0.9999344073685554,
0.9999343417441426,
0.999934276054078,
0.9999342102982959,
0.9999341444767305,
0.9999340785893159,
0.9999340126359864,
0.9999339466166759,
0.9999338805313186,
0.9999338143798482,
0.9999337481621988,
0.9999336818783041,
0.9999336155280978,
0.9999335491115137,
0.9999334826284851,
0.9999334160789459,
0.9999333494628294,
0.999933282780069,
0.999933216030598,
0.9999331492143498,
0.9999330823312576,
0.9999330153812543,
0.9999329483642733,
0.9999328812802474,
0.9999328141291095,
0.9999327469107926,
0.9999326796252295,
0.9999326122723527,
0.9999325448520953,
0.9999324773643895,
0.999932409809168,
0.9999323421863633,
0.9999322744959077,
0.9999322067377336,
0.9999321389117732,
0.9999320710179588,
0.9999320030562224,
0.9999319350264961,
0.999931866928712,
0.9999317987628019,
0.9999317305286978,
0.9999316622263312,
0.9999315938556341,
0.999931525416538,
0.9999314569089746,
0.9999313883328752,
0.9999313196881715,
0.9999312509747947,
0.9999311821926763,
0.9999311133417473,
0.999931044421939,
0.9999309754331825,
0.9999309063754088,
0.9999308372485489,
0.9999307680525338,
0.999930698787294,
0.9999306294527606,
0.999930560048864,
0.9999304905755351,
0.9999304210327042,
0.9999303514203021,
0.9999302817382588,
0.9999302119865049,
0.9999301421649706,
0.9999300722735861,
0.9999300023122816,
0.9999299322809871,
0.9999298621796325,
0.999929792008148,
0.9999297217664631,
0.9999296514545079,
0.9999295810722119,
0.9999295106195047,
0.9999294400963161,
0.9999293695025754,
0.9999292988382121,
0.9999292281031557,
0.9999291572973351,
0.9999290864206799,
0.9999290154731192,
0.9999289444545818,
0.999928873364997,
0.9999288022042936,
0.9999287309724005,
0.9999286596692465,
0.9999285882947602,
0.9999285168488704,
0.9999284453315056,
0.9999283737425945,
0.9999283020820652,
0.9999282303498462,
0.9999281585458659,
0.9999280866700524,
0.999928014722334,
0.9999279427026385,
0.999927870610894,
0.9999277984470287,
0.9999277262109703,
0.9999276539026464,
0.9999275815219849,
0.9999275090689134,
0.9999274365433595,
0.9999273639452507,
0.9999272912745143,
0.9999272185310779,
0.9999271457148685,
0.9999270728258136,
0.99992699986384,
0.9999269268288751,
0.9999268537208457,
0.9999267805396788,
0.9999267072853011,
0.9999266339576395,
0.9999265605566207,
0.9999264870821711,
0.9999264135342176,
0.9999263399126865,
0.9999262662175042,
0.9999261924485972,
0.9999261186058914,
0.9999260446893132,
0.9999259706987887,
0.999925896634244,
0.999925822495605,
0.9999257482827976,
0.9999256739957475,
0.9999255996343807,
0.9999255251986225,
0.9999254506883988,
0.9999253761036349,
0.9999253014442564,
0.9999252267101886,
0.9999251519013568,
0.9999250770176862,
0.9999250020591021,
0.9999249270255293,
0.9999248519168928,
0.9999247767331179,
0.9999247014741289,
0.999924626139851,
0.9999245507302088,
0.9999244752451267,
0.9999243996845296,
0.9999243240483416,
0.9999242483364873,
0.999924172548891,
0.9999240966854769,
0.9999240207461692,
0.9999239447308919,
0.9999238686395691,
0.9999237924721247,
0.9999237162284825,
0.9999236399085665,
0.9999235635123002,
0.9999234870396072,
0.9999234104904112,
0.9999233338646357,
0.999923257162204,
0.9999231803830394,
0.9999231035270653,
0.9999230265942046,
0.9999229495843807,
0.9999228724975164,
0.9999227953335348,
0.9999227180923586,
0.9999226407739107,
0.9999225633781138,
0.9999224859048905,
0.9999224083541635,
0.999922330725855,
0.9999222530198876,
0.9999221752361835,
0.9999220973746652,
0.9999220194352546,
0.9999219414178738,
0.9999218633224449,
0.9999217851488899,
0.9999217068971306,
0.9999216285670885,
0.9999215501586858,
0.9999214716718439,
0.9999213931064841,
0.9999213144625282,
0.9999212357398974,
0.9999211569385131,
0.9999210780582966,
0.9999209990991689,
0.999920920061051,
0.9999208409438641,
0.9999207617475291,
0.9999206824719666,
0.9999206031170975,
0.9999205236828426,
0.9999204441691223,
0.9999203645758572,
0.9999202849029678,
0.9999202051503744,
0.9999201253179971,
0.9999200454057564,
0.9999199654135723,
0.9999198853413648,
0.9999198051890538,
0.9999197249565593,
0.9999196446438011,
0.9999195642506988,
0.9999194837771722,
0.9999194032231407,
0.9999193225885239,
0.9999192418732411,
0.9999191610772116,
0.9999190802003548,
0.9999189992425896,
0.9999189182038354,
0.9999188370840109,
0.9999187558830351,
0.999918674600827,
0.999918593237305,
0.9999185117923881,
0.9999184302659948,
0.9999183486580435,
0.9999182669684527,
0.9999181851971407,
0.9999181033440258,
0.9999180214090262,
0.9999179393920599,
0.999917857293045,
0.9999177751118995,
0.999917692848541,
0.9999176105028876,
0.9999175280748568,
0.9999174455643661,
0.9999173629713333,
0.9999172802956756,
0.9999171975373105,
0.9999171146961552,
0.9999170317721269,
0.9999169487651427,
0.9999168656751196,
0.9999167825019747,
0.9999166992456247,
0.9999166159059865,
0.9999165324829766,
0.9999164489765118,
0.9999163653865085,
0.9999162817128833,
0.9999161979555523,
0.999916114114432,
0.9999160301894386,
0.9999159461804881,
0.9999158620874966,
0.99991577791038,
0.9999156936490541,
0.9999156093034347,
0.9999155248734376,
0.9999154403589784,
0.9999153557599724,
0.9999152710763353,
0.9999151863079823,
0.9999151014548286,
0.9999150165167896,
0.9999149314937802,
0.9999148463857155,
0.9999147611925104,
0.9999146759140799,
0.9999145905503385,
0.9999145051012011,
0.999914419566582,
0.999914333946396,
0.9999142482405573,
0.9999141624489803,
0.9999140765715794,
0.9999139906082685,
0.9999139045589619,
0.9999138184235734,
0.999913732202017,
0.9999136458942065,
0.9999135595000556,
0.999913473019478,
0.9999133864523871,
0.9999132997986966,
0.9999132130583198,
0.9999131262311699,
0.9999130393171602,
0.9999129523162038,
0.9999128652282138,
0.9999127780531031,
0.9999126907907844,
0.9999126034411707,
0.9999125160041746,
0.9999124284797087,
0.9999123408676855,
0.9999122531680176,
0.999912165380617,
0.9999120775053962,
0.9999119895422673,
0.9999119014911424,
0.9999118133519335,
0.9999117251245524,
0.9999116368089109,
0.9999115484049209,
0.9999114599124939,
0.9999113713315414,
0.9999112826619749,
0.9999111939037059,
0.9999111050566456,
0.9999110161207051,
0.9999109270957955,
0.999910837981828,
0.9999107487787133,
0.9999106594863625,
0.9999105701046861,
0.9999104806335948,
0.9999103910729993,
0.99991030142281,
0.9999102116829373,
0.9999101218532913,
0.9999100319337826,
0.9999099419243209,
0.9999098518248166,
0.9999097616351795,
0.9999096713553194,
0.999909580985146,
0.9999094905245692,
0.9999093999734984,
0.9999093093318431,
0.9999092185995128,
0.9999091277764167,
0.999909036862464,
0.999908945857564,
0.9999088547616255,
0.9999087635745576,
0.9999086722962691,
0.9999085809266688,
0.9999084894656654,
0.9999083979131673,
0.9999083062690832,
0.9999082145333215,
0.9999081227057902,
0.9999080307863979,
0.9999079387750526,
0.9999078466716621,
0.9999077544761347,
0.999907662188378,
0.9999075698082999,
0.9999074773358079,
0.9999073847708096,
0.9999072921132126,
0.9999071993629243,
0.9999071065198518,
0.9999070135839025,
0.9999069205549833,
0.9999068274330015,
0.9999067342178637,
0.999906640909477,
0.9999065475077479,
0.9999064540125833,
0.9999063604238895,
0.999906266741573,
0.9999061729655403,
0.9999060790956975,
0.999905985131951,
0.9999058910742067,
0.9999057969223706,
0.9999057026763486,
0.9999056083360465,
0.9999055139013701,
0.9999054193722248,
0.9999053247485163,
0.99990523003015,
0.9999051352170312,
0.999905040309065,
0.9999049453061568,
0.9999048502082114,
0.999904755015134,
0.9999046597268291,
0.9999045643432017,
0.9999044688641565,
0.9999043732895979,
0.9999042776194306,
0.9999041818535587,
0.9999040859918866,
0.9999039900343185,
0.9999038939807585,
0.9999037978311106,
0.9999037015852786,
0.9999036052431665,
0.9999035088046777,
0.9999034122697161,
0.999903315638185,
0.999903218909988,
0.9999031220850283,
0.9999030251632091,
0.9999029281444336,
0.9999028310286048,
0.9999027338156257,
0.9999026365053989,
0.9999025390978274,
0.9999024415928137,
0.9999023439902605,
0.99990224629007,
0.9999021484921446,
0.9999020505963868,
0.9999019526026985,
0.9999018545109819,
0.9999017563211388,
0.9999016580330712,
0.9999015596466807,
0.9999014611618692,
0.999901362578538,
0.9999012638965888,
0.9999011651159229,
0.9999010662364414,
0.9999009672580457,
0.9999008681806366,
0.9999007690041154,
0.9999006697283828,
0.9999005703533396,
0.9999004708788863,
0.9999003713049238,
0.9999002716313524,
0.9999001718580725,
0.9999000719849843,
0.9998999720119881,
0.9998998719389839,
0.9998997717658716,
0.9998996714925513,
0.9998995711189226,
0.9998994706448852,
0.9998993700703387,
0.9998992693951827,
0.9998991686193163,
0.999899067742639,
0.9998989667650499,
0.999898865686448,
0.9998987645067324,
0.999898663225802,
0.9998985618435554,
0.9998984603598915,
0.9998983587747086,
0.9998982570879053,
0.99989815529938,
0.9998980534090308,
0.9998979514167561,
0.9998978493224538,
0.999897747126022,
0.9998976448273584,
0.9998975424263608,
0.9998974399229269,
0.9998973373169542,
0.9998972346083401,
0.999897131796982,
0.9998970288827772,
0.9998969258656228,
0.9998968227454158,
0.9998967195220532,
0.9998966161954318,
0.9998965127654482,
0.9998964092319992,
0.9998963055949813,
0.9998962018542908,
0.9998960980098242,
0.9998959940614774,
0.9998958900091469,
0.9998957858527284,
0.999895681592118,
0.9998955772272113,
0.9998954727579041,
0.999895368184092,
0.9998952635056705,
0.9998951587225349,
0.9998950538345804,
0.9998949488417024,
0.9998948437437958,
0.9998947385407556,
0.9998946332324766,
0.9998945278188537,
0.9998944222997813,
0.9998943166751542,
0.9998942109448666,
0.999894105108813,
0.9998939991668875,
0.9998938931189844,
0.9998937869649974,
0.9998936807048207,
0.9998935743383479,
0.9998934678654727,
0.999893361286089,
0.9998932546000898,
0.9998931478073687,
0.999893040907819,
0.9998929339013339,
0.9998928267878064,
0.9998927195671293,
0.9998926122391957,
0.999892504803898,
0.9998923972611292,
0.9998922896107816,
0.9998921818527475,
0.9998920739869194,
0.9998919660131894,
0.9998918579314497,
0.9998917497415922,
0.9998916414435087,
0.999891533037091,
0.9998914245222308,
0.9998913158988196,
0.999891207166749,
0.99989109832591,
0.9998909893761941,
0.9998908803174923,
0.9998907711496956,
0.9998906618726949,
0.9998905524863811,
0.9998904429906447,
0.9998903333853764,
0.9998902236704664,
0.9998901138458054,
0.9998900039112835,
0.9998898938667906,
0.9998897837122172,
0.9998896734474527,
0.9998895630723872,
0.9998894525869103,
0.9998893419909115,
0.9998892312842805,
0.9998891204669065,
0.9998890095386787,
0.9998888984994863,
0.9998887873492182,
0.9998886760877636,
0.999888564715011,
0.9998884532308492,
0.9998883416351668,
0.9998882299278524,
0.9998881181087941,
0.9998880061778803,
0.9998878941349991,
0.9998877819800386,
0.9998876697128865,
0.9998875573334307,
0.999887444841559,
0.9998873322371589,
0.9998872195201178,
0.9998871066903231,
0.999886993747662,
0.9998868806920217,
0.9998867675232891,
0.9998866542413511,
0.9998865408460947,
0.9998864273374064,
0.9998863137151727,
0.9998861999792801,
0.9998860861296149,
0.9998859721660635,
0.9998858580885117,
0.9998857438968457,
0.9998856295909514,
0.9998855151707144,
0.9998854006360205,
0.9998852859867551,
0.9998851712228037,
0.9998850563440517,
0.999884941350384,
0.999884826241686,
0.9998847110178424,
0.9998845956787381,
0.999884480224258,
0.9998843646542867,
0.9998842489687084,
0.9998841331674078,
0.9998840172502689,
0.9998839012171761,
0.9998837850680133,
0.9998836688026645,
0.9998835524210135,
0.9998834359229438,
0.9998833193083393,
0.9998832025770832,
0.9998830857290588,
0.9998829687641496,
0.9998828516822384,
0.9998827344832084,
0.9998826171669425,
0.9998824997333232,
0.9998823821822334,
0.9998822645135554,
0.9998821467271718,
0.9998820288229647,
0.9998819108008165,
0.9998817926606091,
0.9998816744022243,
0.9998815560255442,
0.9998814375304503,
0.9998813189168243,
0.9998812001845475,
0.9998810813335015,
0.9998809623635672,
0.9998808432746259,
0.9998807240665586,
0.999880604739246,
0.999880485292569,
0.9998803657264083,
0.9998802460406442,
0.9998801262351571,
0.9998800063098274,
0.9998798862645353,
0.9998797660991605,
0.9998796458135834,
0.9998795254076833,
0.9998794048813402,
0.9998792842344335,
0.9998791634668427,
0.9998790425784472,
0.9998789215691258,
0.999878800438758,
0.9998786791872226,
0.9998785578143983,
0.9998784363201639,
0.9998783147043981,
0.9998781929669792,
0.9998780711077856,
0.9998779491266955,
0.999877827023587,
0.999877704798338,
0.9998775824508265,
0.9998774599809301,
0.9998773373885266,
0.9998772146734932,
0.9998770918357074,
0.9998769688750465,
0.9998768457913877,
0.9998767225846077,
...]




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

2. This is for instance the case we deal with in the Counterfactuals with Constraint Solvers