# Proper visualization of a metric per all subsets of a set

I've been working with a set of few neural networks, and building bigger models by selecting a subset and combining them. I haven't been able to find a proper way to visualize the quality(value of objective function) of all the bigger models in a brief, sufficient and readable manner. I have tried bar-plots with a legend, parallel-coordinates-plots and parallel-categories-plots but none of them are quite readable. What other options are there?

TLDR; Given a set e.g. {A, B, C, ...} and a map from all possible subsets to real values e.g. {{} -> 0, {A} -> 0.5, {B} -> 1, {A, B} -> 1.5, ...} what good options are there to visualize the values of the map in a way that contains all the information and is readable?

Edit: I have added a sample of the code and visualization I have already tried.

import matplotlib.pyplot as plt
import numpy as np; np.random.seed(123123)
import pandas as pd
import plotly.express as px

def powerset(s: list) -> list:
l = len(s)
result = [
tuple([s[i] for i in range(l) if 2**i & j])
for j in range(2**l)
]
return result

eg_set = ['A', 'B', 'C', 'D']
eg_powerset = powerset(eg_set)
eg_map = {x: y for x, y in zip(eg_powerset, np.round(np.random.uniform(0, 100, len(eg_powerset)), 2))}

for x in eg_map:
print(x, ': ', eg_map[x])


() : 30.02
('A',) : 99.46
('B',) : 29.01
('A', 'B') : 83.02
('C',) : 72.14
('A', 'C') : 46.27
('B', 'C') : 17.68
('A', 'B', 'C') : 6.78
('D',) : 52.01
('A', 'D') : 23.23
('B', 'D') : 32.51
('A', 'B', 'D') : 72.2
('C', 'D') : 85.16
('A', 'C', 'D') : 53.26
('B', 'C', 'D') : 47.35
('A', 'B', 'C', 'D') : 78.38

# barplot
df = pd.DataFrame(eg_map.items(), columns=['subset', 'value'])
_, ax = plt.subplots(nrows=1, ncols=1, figsize=(5, 5))
df.plot.barh(x='subset', ax=ax) # parallel coordinates
for x in eg_set:
df[x] = df.subset.apply(lambda y: int(x in y))

dimensions = eg_set + ['value']
labels = {x: 'Contains \'{}\''.format(x) for x in eg_set}
labels['value'] = 'value'

fig = px.parallel_coordinates(df, dimensions=dimensions, labels=labels, color='value')
fig.show() # parallel categories
for x in eg_set:
df[x] = df.subset.apply(lambda y: x in y)

fig = px.parallel_categories(df, dimensions=dimensions, labels=labels, color='value')
fig.update_traces(dimensions=[{"categoryorder": "category descending"} for _ in dimensions])
fig.show() • Could you post examples of the visualizations you have already tried? Jul 20 at 8:47
• @liakoyras sure thing! Jul 20 at 14:56