{ "cells": [ { "cell_type": "code", "execution_count": 95, "id": "3d93276e-d83e-48b7-95be-aaaa89244ef9", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "import scipy\n", "\n", "import json\n", "import re\n", "from itertools import chain\n", "from collections import Counter" ] }, { "cell_type": "code", "execution_count": 156, "id": "f57c50ca-3581-4412-a160-774f998ce9df", "metadata": {}, "outputs": [], "source": [ "with open(\"./id_all_blip_clusters_12.json\") as f:\n", " d_12 = json.load(f)\n", "\n", "with open(\"./id_all_blip_clusters_24.json\") as f:\n", " d_24 = json.load(f)\n", "\n", "with open(\"./id_all_blip_clusters_48.json\") as f:\n", " d_48 = json.load(f)" ] }, { "cell_type": "code", "execution_count": 158, "id": "50727b12-9dcb-4f31-b914-801bcd721949", "metadata": {}, "outputs": [], "source": [ "def reduce_full_to_ethnicity_model(d):\n", " c = Counter()\n", " for k,v in d['labels_full']:\n", " k_without_gender = re.split(\"woman|man|person|non-binary\",k)\n", " k_without_gender = ''.join(k_without_gender)\n", " k_without_gender = k_without_gender.strip().replace(\" \", \" \")\n", " c[k_without_gender] = v\n", " return [[k,v] for k,v in c.items()]" ] }, { "cell_type": "code", "execution_count": 142, "id": "63830bef-085f-4847-b51a-b4157351a1a5", "metadata": {}, "outputs": [], "source": [ "def reduce_full_to_gender_model(d):\n", " c = Counter()\n", " for k,v in d['labels_full']:\n", " k_without_ethnicity = re.split(\"(woman|man|person|non-binary)\", k)\n", " k_without_ethnicity = ''.join(k_without_ethnicity[1:])\n", " k_without_ethnicity = k_without_ethnicity.strip().replace(\" \", \" \")\n", " c[k_without_ethnicity] = v\n", " return [[k,v] for k,v in c.items()]" ] }, { "cell_type": "code", "execution_count": 154, "id": "7edad0d1-3d6d-406e-87ef-a0a8c185a53f", "metadata": {}, "outputs": [], "source": [ "def reduce_full_to_ethnicity_gender(d):\n", " c = Counter()\n", " for k,v in d['labels_full']:\n", " k_without_model = re.split(\"(woman|man|person|non-binary)\", k)\n", " k_without_model = ''.join(k_without_model[:2])\n", " k_without_model = k_without_model.strip().replace(\" \", \" \")\n", " c[k_without_model] = v\n", " return [[k,v] for k,v in c.items()]" ] }, { "cell_type": "code", "execution_count": 159, "id": "da978f3b-8f94-4d1b-bae2-f3bb4e9986b4", "metadata": {}, "outputs": [], "source": [ "for cluster_dicts in [d_12, d_24, d_48]:\n", " for d in cluster_dicts:\n", " d[\"labels_ethnicity_model\"] = reduce_full_to_ethnicity_model(d)\n", " d[\"labels_gender_model\"] = reduce_full_to_gender_model(d)\n", " d[\"labels_ethnicity_gender\"] = reduce_full_to_ethnicity_gender(d)" ] }, { "cell_type": "code", "execution_count": 162, "id": "dcab249b-8c66-464f-a41c-a9ae5ab3ad71", "metadata": {}, "outputs": [], "source": [ "# p(cluster | ethnicity, model) DONE\n", "# p(cluster | gender, model) DONE\n", "# p(cluster | gender, ethnicity, model) DONE\n", "# p(cluster | ethnicity) DONE\n", "# p(cluster | gender) DONE\n", "# p(cluster | gender, ethnicity) DONE\n", "# p(cluster | model) ADDED, DONE" ] }, { "cell_type": "markdown", "id": "aff706c7-acb0-460a-bc09-4ce673f8a641", "metadata": {}, "source": [ "# Ethnicities" ] }, { "cell_type": "code", "execution_count": 74, "id": "84e4a4d4-d79b-4666-a7bf-a7532f143019", "metadata": {}, "outputs": [], "source": [ "entropies = []\n", "random_entropies = []\n", "for cluster_dicts in [d_12, d_24, d_48]:\n", " entropy = dict()\n", " random_entropy = dict()\n", " n_clusters = len(cluster_dicts)\n", " all_ethnicities = [list(dict(d['labels_ethnicity']).keys()) for d in cluster_dicts]\n", " all_ethnicities = list(set(chain(*all_ethnicities)))\n", " for ethnicity in all_ethnicities:\n", " h = []\n", " for i in cluster_dicts:\n", " h.append(dict(i['labels_ethnicity']).get(ethnicity, 0))\n", " h = np.array(h)\n", " r = np.ones_like(h)\n", " entropy[ethnicity] = scipy.stats.entropy(h / sum(h), base=2)\n", " random_entropy[ethnicity] = scipy.stats.entropy(r, base=2)\n", " entropies.append(entropy)\n", " random_entropies.append(random_entropy)" ] }, { "cell_type": "code", "execution_count": 79, "id": "0abbdcb0-b06a-4905-8d8e-c3340f8b7e05", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "5.584962500721156" ] }, "execution_count": 79, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.log2(48)" ] }, { "cell_type": "code", "execution_count": 75, "id": "fd938629-c0bf-48c2-b585-5e6a53b8c52d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'': 5.584962500721156,\n", " 'Latinx': 5.584962500721156,\n", " 'African-American': 5.584962500721156,\n", " 'Hispanic': 5.584962500721156,\n", " 'Indigenous American': 5.584962500721156,\n", " 'First Nations': 5.584962500721156,\n", " 'Black': 5.584962500721156,\n", " 'Multiracial': 5.584962500721156,\n", " 'Latino': 5.584962500721156,\n", " 'Southeast Asian': 5.584962500721156,\n", " 'American Indian': 5.584962500721156,\n", " 'South Asian': 5.584962500721156,\n", " 'Caucasian': 5.584962500721156,\n", " 'Native American': 5.584962500721156,\n", " 'East Asian': 5.584962500721156,\n", " 'Pacific Islander': 5.584962500721156,\n", " 'White': 5.584962500721156}" ] }, "execution_count": 75, "metadata": {}, "output_type": "execute_result" } ], "source": [ "random_entropy" ] }, { "cell_type": "code", "execution_count": 53, "id": "0bfc516f-53e0-4f41-bd46-7375913840d6", "metadata": { "collapsed": true, "jupyter": { "outputs_hidden": true }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Pacific Islander3.05
Latino2.75
Latinx2.70
Hispanic2.61
Multiracial2.50
Southeast Asian2.42
First Nations2.38
Indigenous American2.19
Caucasian2.08
White2.04
Native American1.91
American Indian1.88
1.69
East Asian1.62
Black1.54
African-American1.49
South Asian1.32
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Pacific Islander3.68
Latino3.51
First Nations3.25
Latinx3.23
Hispanic3.15
Multiracial3.00
Indigenous American3.00
Southeast Asian2.95
Caucasian2.86
White2.76
American Indian2.70
Native American2.68
2.53
Black2.01
African-American1.82
East Asian1.76
South Asian1.35
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Pacific Islander4.28
Latino4.26
Hispanic4.17
First Nations4.06
Indigenous American4.00
Native American3.88
Latinx3.88
American Indian3.74
Multiracial3.36
Caucasian3.22
White3.20
3.20
Southeast Asian3.18
African-American2.83
Black2.69
East Asian2.03
South Asian1.95
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for d in entropies:\n", " df = pd.DataFrame(pd.Series(d), columns=[\"entropy\"])\n", " display(df.sort_values(\"entropy\", ascending=False).style.background_gradient(\n", " axis=None,\n", " vmin=0,\n", " vmax=4,\n", " cmap=\"YlGnBu\"\n", ").format(precision=2))" ] }, { "cell_type": "markdown", "id": "a2dd2700-3a18-446b-883a-d7efaba9df43", "metadata": {}, "source": [ "# Ethnicities X Model" ] }, { "cell_type": "code", "execution_count": 128, "id": "95a27f11-db32-448f-9712-6b6f18457515", "metadata": {}, "outputs": [], "source": [ "entropies = []\n", "random_entropies = []\n", "for cluster_dicts in [d_12, d_24, d_48]:\n", " entropy = dict()\n", " random_entropy = dict()\n", " n_clusters = len(cluster_dicts)\n", " all_ethnicities_models = [list(dict(d['labels_ethnicity_model']).keys()) for d in cluster_dicts]\n", " all_ethnicities_models = list(set(chain(*all_ethnicities_models)))\n", " for ethnicity_model in all_ethnicities_models:\n", " h = []\n", " for i in cluster_dicts:\n", " h.append(dict(i['labels_ethnicity_model']).get(ethnicity_model, 0))\n", " h = np.array(h)\n", " r = np.ones_like(h)\n", " entropy[ethnicity_model] = scipy.stats.entropy(h / sum(h), base=2)\n", " entropies.append(entropy)" ] }, { "cell_type": "code", "execution_count": 130, "id": "6a1f1689-e59b-408b-8886-a42113fb6faa", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Multiracial DallE2.92
Pacific Islander SD_22.78
Latinx SD_22.76
Southeast Asian DallE2.75
Multiracial SD_142.72
Latino SD_22.69
Hispanic SD_22.66
Latinx DallE2.63
Latino DallE2.59
First Nations DallE2.57
Hispanic SD_142.50
Latino SD_142.45
Caucasian SD_142.44
Southeast Asian SD_142.30
Multiracial SD_22.28
Pacific Islander DallE2.27
American Indian SD_22.26
Latinx SD_142.22
Indigenous American DallE2.17
SD_22.16
White SD_142.16
Native American DallE2.16
Hispanic DallE2.15
Pacific Islander SD_142.13
Indigenous American SD_22.10
Native American SD_22.07
White SD_22.06
East Asian DallE1.99
African-American SD_141.96
First Nations SD_21.94
Caucasian SD_21.91
American Indian DallE1.91
Southeast Asian SD_21.88
SD_141.87
Caucasian DallE1.79
First Nations SD_141.78
South Asian DallE1.73
Indigenous American SD_141.66
White DallE1.59
African-American DallE1.58
Black DallE1.55
East Asian SD_21.50
Black SD_141.36
South Asian SD_21.36
Black SD_21.23
African-American SD_21.00
American Indian SD_140.97
South Asian SD_140.92
DallE0.87
East Asian SD_140.72
Native American SD_140.00
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Pacific Islander SD_23.75
Multiracial DallE3.57
Southeast Asian DallE3.36
Hispanic SD_143.32
Latino DallE3.27
Latino SD_23.21
Latinx DallE3.17
Native American SD_23.09
Multiracial SD_143.08
First Nations DallE3.06
Latinx SD_22.95
Native American DallE2.91
American Indian SD_22.91
Latino SD_142.91
White SD_142.87
Caucasian SD_142.84
Hispanic SD_22.80
SD_22.76
Latinx SD_142.73
Pacific Islander DallE2.71
Indigenous American SD_22.70
Multiracial SD_22.70
First Nations SD_142.66
Hispanic DallE2.62
First Nations SD_22.61
Indigenous American DallE2.61
Southeast Asian SD_142.60
Caucasian SD_22.54
White SD_22.54
American Indian DallE2.50
East Asian DallE2.45
Indigenous American SD_142.45
Pacific Islander SD_142.41
African-American SD_142.22
Southeast Asian SD_22.11
Caucasian DallE2.08
Black DallE2.08
White DallE2.06
SD_141.93
Black SD_141.83
South Asian DallE1.73
Black SD_21.62
African-American DallE1.58
American Indian SD_141.58
East Asian SD_21.50
African-American SD_21.47
South Asian SD_21.46
DallE1.28
East Asian SD_141.25
South Asian SD_140.92
Native American SD_140.47
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Multiracial DallE3.96
Pacific Islander SD_23.91
Hispanic SD_143.86
Native American DallE3.62
Latino SD_23.61
First Nations DallE3.61
Pacific Islander DallE3.54
Latinx DallE3.51
Latinx SD_143.46
Indigenous American DallE3.41
Southeast Asian DallE3.35
Latino DallE3.35
Pacific Islander SD_143.34
Latino SD_143.31
Hispanic SD_23.29
Native American SD_23.20
Multiracial SD_143.18
White SD_23.17
American Indian SD_23.16
Caucasian SD_143.08
American Indian DallE3.06
White SD_143.05
First Nations SD_143.03
Latinx SD_22.99
Multiracial SD_22.99
Indigenous American SD_142.97
Indigenous American SD_22.97
SD_22.97
SD_142.88
Hispanic DallE2.80
Caucasian SD_22.75
First Nations SD_22.71
African-American SD_142.54
American Indian SD_142.50
East Asian DallE2.50
African-American DallE2.50
South Asian DallE2.40
White DallE2.36
Southeast Asian SD_142.35
Black SD_142.28
Black SD_22.26
Southeast Asian SD_22.26
Black DallE2.26
Caucasian DallE2.21
African-American SD_22.18
Native American SD_141.97
DallE1.95
East Asian SD_21.92
South Asian SD_21.70
South Asian SD_141.66
East Asian SD_141.66
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for d in entropies:\n", " df = pd.DataFrame(pd.Series(d), columns=[\"entropy\"])\n", " display(df.sort_values(\"entropy\", ascending=False).style.background_gradient(\n", " axis=None,\n", " vmin=0,\n", " vmax=4,\n", " cmap=\"YlGnBu\"\n", ").format(precision=2))" ] }, { "cell_type": "markdown", "id": "014b36e8-9a21-4ceb-81b0-ce93a384ddbb", "metadata": {}, "source": [ "# Genders" ] }, { "cell_type": "code", "execution_count": 58, "id": "6633a33e-e9a9-48cf-ada7-76f2221b43fe", "metadata": {}, "outputs": [], "source": [ "entropies = []\n", "for cluster_dicts in [d_12, d_24, d_48]:\n", " entropy = dict()\n", " n_clusters = len(cluster_dicts)\n", " all_genders = [list(dict(d['labels_gender']).keys()) for d in cluster_dicts]\n", " all_genders = list(set(chain(*all_genders)))\n", " for gender in all_genders:\n", " h = []\n", " for i in cluster_dicts:\n", " h.append(dict(i['labels_gender']).get(gender, 0))\n", " h = np.array(h)\n", " entropy[gender] = scipy.stats.entropy(h / sum(h), base=2)\n", " entropies.append(entropy)" ] }, { "cell_type": "code", "execution_count": 59, "id": "abedb706-dfca-416f-af6a-c9e59f48215e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'woman': 2.4810719655716675,\n", " 'man': 2.7334846800371837,\n", " 'person': 3.2367086062758728,\n", " 'non-binary': 2.820571495642662},\n", " {'woman': 3.175925805050219,\n", " 'man': 3.6256634564832084,\n", " 'person': 4.1229292987043635,\n", " 'non-binary': 3.7329829916387802},\n", " {'woman': 4.424803401742995,\n", " 'man': 4.422651789402228,\n", " 'person': 4.812137497942508,\n", " 'non-binary': 4.421094043509409}]" ] }, "execution_count": 59, "metadata": {}, "output_type": "execute_result" } ], "source": [ "entropies" ] }, { "cell_type": "code", "execution_count": 60, "id": "d06e10c5-d6f0-412f-bba7-5583796ac98b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
person3.24
non-binary2.82
man2.73
woman2.48
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
person4.12
non-binary3.73
man3.63
woman3.18
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
person4.81
woman4.42
man4.42
non-binary4.42
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for d in entropies:\n", " df = pd.DataFrame(pd.Series(d), columns=[\"entropy\"])\n", " display(df.sort_values(\"entropy\", ascending=False).style.background_gradient(\n", " axis=None,\n", " vmin=0,\n", " vmax=4,\n", " cmap=\"YlGnBu\"\n", ").format(precision=2))" ] }, { "cell_type": "markdown", "id": "600e4ad8-d872-4e79-96d0-a843d232fe2e", "metadata": {}, "source": [ "# Models" ] }, { "cell_type": "code", "execution_count": 84, "id": "c63fabe7-dadc-4945-b69f-f81d4a9a7ba6", "metadata": {}, "outputs": [], "source": [ "entropies = []\n", "for cluster_dicts in [d_12, d_24, d_48]:\n", " entropy = dict()\n", " n_clusters = len(cluster_dicts)\n", " all_models = [list(dict(d['labels_model']).keys()) for d in cluster_dicts]\n", " all_models = list(set(chain(*all_models)))\n", " for model in all_models:\n", " h = []\n", " for i in cluster_dicts:\n", " h.append(dict(i['labels_model']).get(model, 0))\n", " h = np.array(h)\n", " entropy[model] = scipy.stats.entropy(h / sum(h), base=2)\n", " entropies.append(entropy)" ] }, { "cell_type": "code", "execution_count": 86, "id": "207c235e-7874-40b2-90e6-ec35bc789d0b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
SD_23.48
SD_143.41
DallE3.33
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
SD_24.31
SD_144.15
DallE4.12
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
SD_145.07
SD_25.01
DallE4.86
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for d in entropies:\n", " df = pd.DataFrame(pd.Series(d), columns=[\"entropy\"])\n", " display(df.sort_values(\"entropy\", ascending=False).style.background_gradient(\n", " axis=None,\n", " vmin=0,\n", " vmax=4,\n", " cmap=\"YlGnBu\"\n", ").format(precision=2))" ] }, { "cell_type": "markdown", "id": "66d9c1b9-9bce-4428-9149-b3782202cea5", "metadata": {}, "source": [ "# Gender X Model" ] }, { "cell_type": "code", "execution_count": 146, "id": "db5a4a11-8dbf-4178-b6fb-3ed28d779003", "metadata": {}, "outputs": [], "source": [ "entropies = []\n", "random_entropies = []\n", "for cluster_dicts in [d_12, d_24, d_48]:\n", " entropy = dict()\n", " random_entropy = dict()\n", " n_clusters = len(cluster_dicts)\n", " all_genders_models = [list(dict(d['labels_gender_model']).keys()) for d in cluster_dicts]\n", " all_genders_models = list(set(chain(*all_genders_models)))\n", " for gender_model in all_genders_models:\n", " h = []\n", " for i in cluster_dicts:\n", " h.append(dict(i['labels_gender_model']).get(gender_model, 0))\n", " h = np.array(h)\n", " r = np.ones_like(h)\n", " entropy[gender_model] = scipy.stats.entropy(h / sum(h), base=2)\n", " entropies.append(entropy)" ] }, { "cell_type": "code", "execution_count": 147, "id": "08617661-f71b-4ebd-837c-feae2c7b4bff", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
person SD_143.32
non-binary DallE3.24
person SD_23.20
non-binary SD_143.17
non-binary SD_23.00
woman DallE2.66
person DallE2.65
man SD_22.55
woman SD_142.52
man SD_142.46
man DallE2.41
woman SD_22.09
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
non-binary SD_144.24
person SD_23.90
person SD_143.90
non-binary SD_23.77
non-binary DallE3.73
person DallE3.47
woman DallE3.34
woman SD_143.25
man SD_143.15
man SD_23.08
man DallE2.88
woman SD_22.64
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
person SD_144.79
non-binary SD_144.70
non-binary DallE4.32
person SD_24.32
person DallE4.14
woman DallE3.96
non-binary SD_23.96
woman SD_143.88
man SD_143.86
man SD_23.72
man DallE3.69
woman SD_23.48
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for d in entropies:\n", " df = pd.DataFrame(pd.Series(d), columns=[\"entropy\"])\n", " display(df.sort_values(\"entropy\", ascending=False).style.background_gradient(\n", " axis=None,\n", " vmin=0,\n", " vmax=4,\n", " cmap=\"YlGnBu\"\n", ").format(precision=2))" ] }, { "cell_type": "markdown", "id": "45455786-7a17-440f-a82e-bd8e1663fdb0", "metadata": {}, "source": [ "# Ethnicity X Gender" ] }, { "cell_type": "code", "execution_count": 160, "id": "9f622b73-82f6-427c-a411-ccec7ca8dd70", "metadata": {}, "outputs": [], "source": [ "entropies = []\n", "random_entropies = []\n", "for cluster_dicts in [d_12, d_24, d_48]:\n", " entropy = dict()\n", " random_entropy = dict()\n", " n_clusters = len(cluster_dicts)\n", " all_ethnicities_genders = [list(dict(d['labels_ethnicity_gender']).keys()) for d in cluster_dicts]\n", " all_ethnicities_genders = list(set(chain(*all_ethnicities_genders)))\n", " for ethnicity_gender in all_ethnicities_genders:\n", " h = []\n", " for i in cluster_dicts:\n", " h.append(dict(i['labels_ethnicity_gender']).get(ethnicity_gender, 0))\n", " h = np.array(h)\n", " r = np.ones_like(h)\n", " entropy[ethnicity_gender] = scipy.stats.entropy(h / sum(h), base=2)\n", " entropies.append(entropy)" ] }, { "cell_type": "code", "execution_count": 161, "id": "a3844662-2a7c-49d0-972f-6f41a342c7c5", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Southeast Asian non-binary2.75
Hispanic non-binary2.59
Latino non-binary2.52
Latinx person2.50
Pacific Islander person2.37
Multiracial woman2.25
American Indian non-binary2.24
Native American non-binary2.24
African-American non-binary2.22
Latinx non-binary2.19
Pacific Islander woman2.16
Multiracial non-binary2.16
Pacific Islander man2.16
First Nations woman2.10
Latino person2.09
Hispanic person2.07
First Nations person2.07
Indigenous American non-binary2.06
Multiracial person2.05
woman2.04
First Nations non-binary1.95
Indigenous American person1.88
White person1.88
Pacific Islander non-binary1.87
person1.87
Native American person1.83
Latino woman1.77
Indigenous American woman1.76
Southeast Asian woman1.75
White woman1.74
Latinx man1.66
Caucasian non-binary1.66
Black person1.63
Latino man1.62
Caucasian woman1.62
Native American woman1.59
American Indian man1.56
American Indian woman1.56
American Indian person1.53
Native American man1.51
South Asian non-binary1.49
Hispanic man1.49
Southeast Asian person1.47
East Asian non-binary1.45
Multiracial man1.45
Black non-binary1.38
East Asian person1.38
White non-binary1.37
First Nations man1.37
Indigenous American man1.36
Caucasian person1.30
Caucasian man1.16
Latinx woman1.10
Hispanic woman0.92
Southeast Asian man0.92
Black woman0.88
African-American person0.72
South Asian person0.72
East Asian man0.72
East Asian woman0.47
White man0.47
South Asian man0.47
man0.47
African-American woman0.00
South Asian woman0.00
Black man0.00
African-American man0.00
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Southeast Asian non-binary3.38
Latino non-binary3.12
Pacific Islander non-binary3.04
First Nations non-binary3.02
Hispanic non-binary3.02
Latinx person2.87
Indigenous American non-binary2.79
First Nations person2.77
Pacific Islander person2.75
Multiracial non-binary2.73
First Nations woman2.66
Pacific Islander woman2.66
Latinx non-binary2.60
Pacific Islander man2.58
Multiracial person2.57
Native American person2.52
Multiracial woman2.52
Latinx man2.50
American Indian non-binary2.50
Indigenous American person2.47
Latino woman2.47
Multiracial man2.45
Southeast Asian woman2.45
person2.42
woman2.37
Native American non-binary2.36
American Indian person2.34
Hispanic person2.33
American Indian man2.30
Caucasian non-binary2.29
Latino man2.28
Native American man2.28
Latino person2.25
Caucasian man2.25
African-American non-binary2.22
White woman2.18
Caucasian woman2.11
East Asian non-binary2.11
White person2.06
First Nations man2.05
Indigenous American woman2.03
Indigenous American man2.01
Native American woman2.00
American Indian woman1.97
White non-binary1.96
Black person1.87
Hispanic man1.85
Caucasian person1.75
Black non-binary1.75
Latinx woman1.69
South Asian non-binary1.68
Southeast Asian person1.47
East Asian person1.38
Hispanic woman1.36
East Asian man1.10
Black man0.95
African-American person0.92
Southeast Asian man0.92
Black woman0.88
man0.87
White man0.87
South Asian person0.72
African-American man0.65
South Asian man0.47
East Asian woman0.47
South Asian woman0.00
African-American woman0.00
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Hispanic non-binary3.57
Pacific Islander person3.45
First Nations person3.41
Multiracial non-binary3.38
Pacific Islander woman3.35
Pacific Islander non-binary3.33
Native American person3.28
Indigenous American person3.27
Latino non-binary3.25
Native American non-binary3.24
Latinx person3.10
Indigenous American non-binary3.06
American Indian non-binary3.06
American Indian man3.05
First Nations non-binary3.03
Latino person3.01
person2.98
Multiracial person2.97
First Nations woman2.97
Latinx man2.95
Hispanic person2.95
Indigenous American man2.95
Latinx non-binary2.93
Native American man2.91
woman2.90
Latino woman2.87
African-American non-binary2.85
Pacific Islander man2.82
Hispanic man2.78
Latino man2.76
Latinx woman2.75
Multiracial woman2.73
Multiracial man2.72
Southeast Asian non-binary2.66
Caucasian non-binary2.64
Native American woman2.62
American Indian person2.58
White woman2.54
Indigenous American woman2.49
South Asian non-binary2.46
White non-binary2.45
Caucasian woman2.35
White person2.33
First Nations man2.27
American Indian woman2.19
Hispanic woman2.03
Black person2.02
Caucasian man2.00
African-American person1.96
Southeast Asian woman1.94
East Asian non-binary1.88
Black non-binary1.88
Southeast Asian man1.86
Caucasian person1.72
White man1.66
Black man1.55
East Asian man1.49
Southeast Asian person1.43
East Asian person1.41
South Asian woman1.36
Black woman1.23
man1.21
African-American woman1.14
African-American man0.99
South Asian person0.92
East Asian woman0.87
South Asian man0.47
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for d in entropies:\n", " df = pd.DataFrame(pd.Series(d), columns=[\"entropy\"])\n", " display(df.sort_values(\"entropy\", ascending=False).style.background_gradient(\n", " axis=None,\n", " vmin=0,\n", " vmax=4,\n", " cmap=\"YlGnBu\"\n", ").format(precision=2))" ] }, { "cell_type": "markdown", "id": "0a12146d-ce28-419d-9fe9-7987284d437d", "metadata": {}, "source": [ "# Genders X Ethnicities X Model" ] }, { "cell_type": "code", "execution_count": 66, "id": "78cc3ec7-c32e-408f-a0c6-c121135f9449", "metadata": {}, "outputs": [], "source": [ "entropies = []\n", "for cluster_dicts in [d_12, d_24, d_48]:\n", " entropy = dict()\n", " n_clusters = len(cluster_dicts)\n", " all_labels = [list(dict(d['labels_full']).keys()) for d in cluster_dicts]\n", " all_labels = list(set(chain(*all_labels)))\n", " for label in all_labels:\n", " h = []\n", " for i in cluster_dicts:\n", " h.append(dict(i['labels_full']).get(label, 0))\n", " h = np.array(h)\n", " entropy[label] = scipy.stats.entropy(h / sum(h), base=2)\n", " entropies.append(entropy)" ] }, { "cell_type": "code", "execution_count": 67, "id": "08b5912c-6add-428e-8fcc-1232ef17112e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Hispanic non-binary SD_142.37
Latinx person SD_22.25
Multiracial woman DallE2.12
Latino non-binary DallE2.12
Native American non-binary DallE2.12
Hispanic non-binary SD_22.05
Southeast Asian non-binary SD_142.05
American Indian non-binary SD_21.96
White person SD_141.96
African-American non-binary SD_141.96
Southeast Asian non-binary DallE1.96
Pacific Islander woman SD_21.90
Hispanic non-binary DallE1.85
Latinx person DallE1.85
Multiracial non-binary DallE1.85
Pacific Islander person SD_141.85
Native American non-binary SD_21.85
Southeast Asian woman DallE1.85
Latinx non-binary SD_141.76
woman SD_21.76
American Indian non-binary DallE1.76
Pacific Islander person SD_21.76
First Nations non-binary DallE1.72
First Nations person DallE1.72
Indigenous American non-binary SD_21.72
Indigenous American person DallE1.69
Latino non-binary SD_21.69
Multiracial person DallE1.69
Caucasian non-binary SD_141.69
Latino woman DallE1.57
Latino woman SD_141.57
Pacific Islander non-binary SD_141.57
person SD_141.57
Latino non-binary SD_141.57
Pacific Islander non-binary SD_21.57
Indigenous American non-binary DallE1.52
Native American woman DallE1.52
Pacific Islander non-binary DallE1.52
First Nations woman DallE1.49
Latinx non-binary SD_21.49
Hispanic man SD_141.49
White non-binary SD_21.37
Multiracial man SD_141.37
Pacific Islander woman SD_141.36
First Nations non-binary SD_141.36
Latinx man SD_21.36
Native American person DallE1.36
Black non-binary SD_141.36
Latino person SD_21.36
Latino person SD_141.36
Latinx man DallE1.36
Pacific Islander man SD_21.36
Caucasian woman DallE1.30
East Asian non-binary DallE1.30
Caucasian person SD_141.30
Indigenous American woman DallE1.30
Latino man SD_21.30
White woman SD_141.16
Latinx person SD_141.16
East Asian non-binary SD_21.16
Hispanic person SD_21.16
East Asian person DallE1.16
Hispanic person SD_141.16
Multiracial non-binary SD_141.16
Pacific Islander man DallE1.16
Multiracial man SD_21.16
African-American non-binary DallE1.16
Multiracial person SD_141.16
Caucasian man SD_141.16
Latino man DallE1.16
First Nations non-binary SD_21.16
Indigenous American man DallE1.00
South Asian non-binary DallE1.00
First Nations person SD_141.00
Native American person SD_21.00
East Asian person SD_140.97
Native American man SD_20.97
American Indian person SD_20.97
Hispanic person DallE0.97
South Asian non-binary SD_140.97
First Nations man DallE0.97
Latino man SD_140.97
Indigenous American woman SD_140.97
Latino person DallE0.97
Caucasian person SD_20.97
Black person SD_140.97
Indigenous American man SD_140.97
White woman DallE0.97
American Indian woman DallE0.97
Hispanic man SD_20.97
American Indian man SD_20.97
American Indian man DallE0.97
Multiracial person SD_20.97
American Indian woman SD_140.97
Latinx non-binary DallE0.97
White person SD_20.92
Multiracial man DallE0.92
Multiracial woman SD_140.92
Indigenous American non-binary SD_140.92
Hispanic woman SD_20.92
Southeast Asian man DallE0.92
Southeast Asian non-binary SD_20.88
Native American man DallE0.88
Pacific Islander woman DallE0.88
American Indian person DallE0.88
Pacific Islander man SD_140.88
East Asian person SD_20.88
Black woman DallE0.88
East Asian man DallE0.72
First Nations woman SD_140.72
Black non-binary DallE0.72
First Nations man SD_20.72
African-American person SD_140.72
Hispanic woman SD_140.72
First Nations man SD_140.72
South Asian non-binary SD_20.72
Multiracial woman SD_20.72
White non-binary DallE0.72
person SD_20.72
Caucasian non-binary DallE0.72
South Asian person SD_140.72
Latinx woman DallE0.72
Indigenous American person SD_20.47
Hispanic woman DallE0.47
Indigenous American person SD_140.47
Caucasian man DallE0.47
East Asian non-binary SD_140.47
Latinx woman SD_140.47
Multiracial non-binary SD_20.47
White man DallE0.47
Native American woman SD_20.47
person DallE0.47
Indigenous American man SD_20.47
Latino woman SD_20.47
man SD_140.47
Southeast Asian person SD_140.47
Latinx man SD_140.47
East Asian woman SD_20.47
man SD_20.47
White woman SD_20.47
woman DallE0.47
Caucasian woman SD_140.47
Black person DallE0.47
Southeast Asian person DallE0.47
Southeast Asian woman SD_140.47
Black person SD_20.47
Latinx woman SD_20.47
South Asian man DallE0.47
Southeast Asian woman SD_20.00
American Indian man SD_140.00
Southeast Asian man SD_140.00
African-American person SD_20.00
man DallE0.00
White man SD_20.00
White non-binary SD_140.00
South Asian person SD_20.00
Black man SD_140.00
South Asian woman DallE0.00
American Indian non-binary SD_140.00
Caucasian non-binary SD_20.00
East Asian man SD_140.00
Caucasian man SD_20.00
African-American man SD_20.00
Black man SD_20.00
Black woman SD_140.00
Southeast Asian person SD_20.00
African-American man DallE0.00
East Asian man SD_20.00
Hispanic man DallE0.00
Black non-binary SD_20.00
Native American man SD_140.00
Black man DallE0.00
Pacific Islander person DallE0.00
woman SD_140.00
African-American woman SD_20.00
East Asian woman SD_140.00
First Nations woman SD_20.00
American Indian person SD_140.00
African-American man SD_140.00
East Asian woman DallE0.00
African-American woman SD_140.00
South Asian woman SD_20.00
Indigenous American woman SD_20.00
South Asian man SD_140.00
Native American person SD_140.00
American Indian woman SD_20.00
South Asian man SD_20.00
Southeast Asian man SD_20.00
White person DallE0.00
First Nations person SD_20.00
African-American person DallE0.00
African-American non-binary SD_20.00
White man SD_140.00
Caucasian woman SD_20.00
Native American woman SD_140.00
Native American non-binary SD_140.00
South Asian woman SD_140.00
African-American woman DallE0.00
Caucasian person DallE0.00
South Asian person DallE0.00
Black woman SD_20.00
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Southeast Asian non-binary SD_142.72
Hispanic non-binary SD_142.65
Native American non-binary SD_22.52
Multiracial non-binary DallE2.45
Pacific Islander woman SD_22.45
Southeast Asian woman DallE2.45
Latino non-binary DallE2.45
Multiracial person DallE2.45
Pacific Islander non-binary SD_22.45
Multiracial woman DallE2.45
Southeast Asian non-binary DallE2.32
American Indian non-binary SD_22.32
Latinx person SD_22.25
Pacific Islander person SD_22.25
Latinx person DallE2.17
First Nations woman DallE2.17
First Nations non-binary SD_142.17
Native American non-binary DallE2.12
Latinx man DallE2.12
woman SD_22.12
Hispanic non-binary DallE2.12
Hispanic non-binary SD_22.05
Latino non-binary SD_22.05
First Nations person DallE2.05
First Nations non-binary DallE2.05
Indigenous American non-binary SD_22.05
Indigenous American person DallE2.05
Pacific Islander man SD_22.05
Multiracial man SD_21.96
White non-binary SD_21.96
White person SD_141.96
Caucasian non-binary SD_141.96
First Nations non-binary SD_21.96
African-American non-binary SD_141.96
Pacific Islander non-binary DallE1.92
East Asian non-binary DallE1.90
Latino person SD_21.85
White woman SD_141.85
Latinx man SD_21.85
Pacific Islander person SD_141.85
Pacific Islander man DallE1.85
Hispanic man SD_141.85
Pacific Islander woman SD_141.85
Latino non-binary SD_141.77
Multiracial man SD_141.76
Latinx non-binary SD_141.76
American Indian non-binary DallE1.76
Latino man DallE1.76
Latino person SD_141.72
Latino man SD_21.69
American Indian man DallE1.69
Native American person DallE1.69
Caucasian person SD_141.69
Caucasian man SD_141.57
Latino woman SD_141.57
Multiracial non-binary SD_141.57
Hispanic person SD_141.57
Indigenous American non-binary SD_141.57
Hispanic person SD_21.57
person SD_141.57
Latino woman DallE1.57
Native American man DallE1.57
Southeast Asian non-binary SD_21.57
Pacific Islander non-binary SD_141.57
Native American man SD_21.52
Caucasian person SD_21.52
American Indian person SD_21.52
Indigenous American non-binary DallE1.52
Native American woman DallE1.52
Latinx non-binary SD_21.49
First Nations person SD_141.49
person SD_21.49
Latinx woman DallE1.37
First Nations man SD_141.37
Indigenous American woman SD_141.37
Black non-binary SD_141.36
Latinx man SD_141.36
Indigenous American person SD_21.36
Black person SD_21.36
Latino woman SD_21.36
Native American person SD_21.36
Hispanic person DallE1.36
Latino person DallE1.30
Indigenous American woman DallE1.30
Caucasian woman DallE1.30
American Indian man SD_21.30
Indigenous American man SD_141.30
White woman SD_21.30
Caucasian woman SD_141.30
Latinx non-binary DallE1.30
East Asian non-binary SD_21.16
African-American non-binary DallE1.16
Latinx woman SD_141.16
East Asian person DallE1.16
Hispanic woman SD_141.16
American Indian person DallE1.16
Latinx person SD_141.16
Multiracial person SD_141.16
Black non-binary DallE1.16
First Nations man SD_21.16
First Nations woman SD_141.16
Black man SD_141.00
American Indian non-binary SD_141.00
South Asian non-binary DallE1.00
African-American man SD_21.00
Indigenous American man DallE1.00
First Nations person SD_20.97
Latino man SD_140.97
First Nations man DallE0.97
White woman DallE0.97
East Asian person SD_140.97
African-American person SD_20.97
American Indian woman DallE0.97
Multiracial person SD_20.97
American Indian woman SD_140.97
South Asian non-binary SD_140.97
Black person SD_140.97
Hispanic man SD_20.97
Multiracial man DallE0.92
Southeast Asian man DallE0.92
Caucasian man DallE0.92
White person SD_20.92
African-American person SD_140.92
Hispanic woman SD_20.92
Black person DallE0.92
person DallE0.92
Multiracial woman SD_140.92
South Asian non-binary SD_20.92
Black man SD_20.88
Caucasian non-binary SD_20.88
East Asian person SD_20.88
White person DallE0.88
Pacific Islander woman DallE0.88
Black woman DallE0.88
Pacific Islander man SD_140.88
White non-binary DallE0.72
Multiracial woman SD_20.72
White non-binary SD_140.72
East Asian man DallE0.72
Caucasian non-binary DallE0.72
South Asian person SD_140.72
African-American man SD_140.47
Hispanic woman DallE0.47
woman SD_140.47
White man DallE0.47
East Asian non-binary SD_140.47
Native American non-binary SD_140.47
Southeast Asian person SD_140.47
White man SD_140.47
Indigenous American man SD_20.47
East Asian man SD_140.47
White man SD_20.47
man DallE0.47
Caucasian woman SD_20.47
Southeast Asian woman SD_140.47
Indigenous American person SD_140.47
man SD_20.47
man SD_140.47
Latinx woman SD_20.47
Native American woman SD_20.47
South Asian man DallE0.47
East Asian woman SD_20.47
Southeast Asian person DallE0.47
Multiracial non-binary SD_20.47
woman DallE0.47
Pacific Islander person DallE0.47
Hispanic man DallE0.47
American Indian man SD_140.00
Southeast Asian woman SD_20.00
African-American man DallE0.00
Black woman SD_140.00
South Asian person SD_20.00
South Asian woman DallE0.00
Caucasian man SD_20.00
Black non-binary SD_20.00
East Asian man SD_20.00
African-American woman DallE0.00
Caucasian person DallE0.00
Black man DallE0.00
American Indian person SD_140.00
African-American woman SD_20.00
First Nations woman SD_20.00
Southeast Asian man SD_140.00
East Asian woman DallE0.00
South Asian man SD_20.00
Indigenous American woman SD_20.00
East Asian woman SD_140.00
Native American woman SD_140.00
Native American person SD_140.00
American Indian woman SD_20.00
Southeast Asian man SD_20.00
African-American person DallE0.00
Black woman SD_20.00
African-American non-binary SD_20.00
African-American woman SD_140.00
South Asian man SD_140.00
South Asian person DallE0.00
South Asian woman SD_140.00
Native American man SD_140.00
Southeast Asian person SD_20.00
South Asian woman SD_20.00
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
 entropy
Hispanic non-binary SD_142.92
Indigenous American person DallE2.72
Pacific Islander woman SD_22.65
First Nations person DallE2.65
Multiracial non-binary DallE2.65
Pacific Islander non-binary SD_142.52
Multiracial non-binary SD_142.52
Native American man DallE2.52
Native American person DallE2.52
Multiracial woman DallE2.45
Multiracial person DallE2.45
Pacific Islander person SD_142.45
Pacific Islander non-binary SD_22.37
Latino non-binary DallE2.32
African-American non-binary SD_142.32
Hispanic person SD_142.32
Latinx man DallE2.32
Pacific Islander man DallE2.32
First Nations non-binary DallE2.32
Pacific Islander person SD_22.25
Latinx person SD_22.25
woman SD_22.25
Native American non-binary SD_22.25
American Indian man DallE2.25
First Nations woman DallE2.17
Latinx man SD_142.17
Hispanic man SD_142.17
Latino person SD_142.17
Pacific Islander non-binary DallE2.17
Latinx person DallE2.16
Caucasian non-binary SD_142.16
person SD_142.16
Indigenous American non-binary SD_22.16
Latino person SD_22.12
White person SD_142.12
Latino non-binary SD_22.12
American Indian person SD_22.12
Native American non-binary DallE2.12
American Indian non-binary SD_22.12
Latinx woman SD_142.12
Southeast Asian woman DallE2.05
Native American person SD_22.05
Hispanic non-binary DallE2.05
Hispanic non-binary SD_22.05
Indigenous American man DallE2.05
Pacific Islander man SD_22.05
First Nations non-binary SD_142.05
First Nations person SD_141.97
Native American woman DallE1.97
Latinx non-binary SD_141.96
White non-binary SD_21.96
White woman SD_141.96
East Asian non-binary DallE1.96
Southeast Asian non-binary DallE1.96
Indigenous American person SD_141.96
Indigenous American non-binary DallE1.90
Latino woman SD_21.90
Latino man DallE1.85
Indigenous American man SD_141.85
Southeast Asian non-binary SD_141.85
Pacific Islander woman SD_141.85
Multiracial man DallE1.85
American Indian man SD_21.85
South Asian non-binary DallE1.85
Indigenous American person SD_21.85
Latino non-binary SD_141.77
Latinx woman DallE1.77
Multiracial man SD_21.77
First Nations non-binary SD_21.76
Latino woman SD_141.76
White man SD_141.72
Caucasian person SD_141.72
Pacific Islander woman DallE1.72
person SD_21.69
First Nations person SD_21.69
Multiracial man SD_141.69
Hispanic woman SD_21.69
Latino person DallE1.69
Latino man SD_21.69
African-American non-binary DallE1.69
Caucasian woman DallE1.69
White person SD_21.57
Caucasian man SD_141.57
White woman DallE1.57
Indigenous American non-binary SD_141.57
African-American person SD_141.57
American Indian non-binary DallE1.57
Southeast Asian man DallE1.57
Multiracial person SD_141.57
Latino woman DallE1.57
African-American person DallE1.52
woman SD_141.52
Caucasian woman SD_141.52
Native American man SD_21.52
East Asian person SD_141.52
Caucasian person SD_21.52
Latinx man SD_21.52
Pacific Islander man SD_141.49
African-American person SD_21.49
Latinx non-binary SD_21.49
American Indian non-binary SD_141.49
Hispanic woman SD_141.37
American Indian woman SD_141.37
Multiracial woman SD_21.37
Hispanic person SD_21.37
First Nations woman SD_141.37
First Nations man SD_21.37
Hispanic person DallE1.36
South Asian non-binary SD_141.36
man SD_141.36
Black person SD_21.36
Native American non-binary SD_141.36
Caucasian man SD_21.36
Indigenous American woman DallE1.36
Hispanic man DallE1.36
Black man SD_141.36
Black non-binary SD_141.36
Black person DallE1.36
Hispanic man SD_21.30
Latinx non-binary DallE1.30
Southeast Asian person SD_141.30
Latinx woman SD_21.30
Southeast Asian non-binary SD_21.30
East Asian person SD_21.30
Indigenous American woman SD_141.30
American Indian man SD_141.30
woman DallE1.16
Multiracial non-binary SD_21.16
Black man SD_21.16
East Asian man DallE1.16
First Nations man SD_141.16
Black non-binary DallE1.16
American Indian person DallE1.16
East Asian non-binary SD_21.16
African-American man DallE1.16
Caucasian non-binary DallE1.16
Latinx person SD_141.16
American Indian woman DallE1.00
Black non-binary SD_21.00
African-American man SD_21.00
Black person SD_140.97
Multiracial person SD_20.97
American Indian woman SD_20.97
Latino man SD_140.97
White man SD_20.92
South Asian non-binary SD_20.92
person DallE0.92
East Asian non-binary SD_140.92
Black man DallE0.92
South Asian person SD_140.92
Pacific Islander person DallE0.92
White non-binary SD_140.92
White woman SD_20.92
Multiracial woman SD_140.92
man SD_20.92
White person DallE0.88
African-American woman SD_20.88
African-American non-binary SD_20.88
Native American woman SD_140.88
African-American woman SD_140.88
First Nations woman SD_20.88
First Nations man DallE0.88
Native American woman SD_20.88
Caucasian non-binary SD_20.88
Southeast Asian man SD_20.72
South Asian woman DallE0.72
White non-binary DallE0.72
Caucasian woman SD_20.72
South Asian man DallE0.47
Indigenous American man SD_20.47
Southeast Asian person DallE0.47
Native American man SD_140.47
Native American person SD_140.47
man DallE0.47
Indigenous American woman SD_20.47
Black woman SD_140.47
Southeast Asian woman SD_140.47
East Asian man SD_140.47
American Indian person SD_140.47
Caucasian man DallE0.47
South Asian man SD_20.47
East Asian woman SD_140.47
Black woman SD_20.47
East Asian woman SD_20.47
Hispanic woman DallE0.47
East Asian person DallE0.47
White man DallE0.47
African-American man SD_140.47
African-American woman DallE0.47
Southeast Asian woman SD_20.00
Southeast Asian man SD_140.00
South Asian woman SD_20.00
South Asian person SD_20.00
South Asian woman SD_140.00
South Asian person DallE0.00
East Asian woman DallE0.00
East Asian man SD_20.00
Southeast Asian person SD_20.00
South Asian man SD_140.00
Caucasian person DallE0.00
Black woman DallE0.00
\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for d in entropies:\n", " df = pd.DataFrame(pd.Series(d), columns=[\"entropy\"])\n", " display(df.sort_values(\"entropy\", ascending=False).style.background_gradient(\n", " axis=None,\n", " vmin=0,\n", " vmax=4,\n", " cmap=\"YlGnBu\"\n", ").format(precision=2))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.5" } }, "nbformat": 4, "nbformat_minor": 5 }