Spaces:
Sleeping
Sleeping
increase font size
Browse files
README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
---
|
2 |
title: FEIR Viz Tool
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.32.0
|
8 |
app_file: app.py
|
|
|
1 |
---
|
2 |
title: FEIR Viz Tool
|
3 |
+
emoji: 💻
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: purple
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.32.0
|
8 |
app_file: app.py
|
app.py
CHANGED
@@ -79,7 +79,7 @@ def user_interface(Ufile, Pfile, Sfile=None, job_meta_file=None, user_meta_file=
|
|
79 |
envy = ret_dict['envy'].sum(-1)
|
80 |
envy_user = envy[user]
|
81 |
# plot envy histogram
|
82 |
-
n, bins, patches = ax1.hist(envy, bins=
|
83 |
ax1.set_yscale('symlog')
|
84 |
sns.kdeplot(envy, color='grey', bw_adjust=0.3, cut=0, ax=ax1)
|
85 |
# mark this user's envy
|
@@ -88,9 +88,9 @@ def user_interface(Ufile, Pfile, Sfile=None, job_meta_file=None, user_meta_file=
|
|
88 |
# print(envy_user, idx)
|
89 |
patches[idx-1].set_fc('r')
|
90 |
ax1.legend(handles=[Patch(facecolor='r', edgecolor='r', alpha=0.5,
|
91 |
-
label='Your envy group')])
|
92 |
-
ax1.set_xlabel('Envy')
|
93 |
-
ax1.set_ylabel('Number of users (log scale)')
|
94 |
|
95 |
return fig
|
96 |
|
@@ -137,6 +137,7 @@ def user_interface(Ufile, Pfile, Sfile=None, job_meta_file=None, user_meta_file=
|
|
137 |
legend=False, s=100, hue='y', palette="summer") #monotone color palette
|
138 |
sns.scatterplot(y=my_scores, x=range(k), ax=ax,
|
139 |
alpha=0.8, s=200, ec='r', fc='none', label='Your rank')
|
|
|
140 |
# add ranking of this user's score for each job
|
141 |
# find score gaps
|
142 |
gaps = np.diff(np.sort(scores[0])).mean()
|
@@ -147,14 +148,14 @@ def user_interface(Ufile, Pfile, Sfile=None, job_meta_file=None, user_meta_file=
|
|
147 |
ax.set_xticks(range(k))
|
148 |
# shorten the job title
|
149 |
titles = [recdata.job_metadata[jb] for jb in users_rec]
|
150 |
-
titles = [t[:
|
151 |
-
ax.set_xticklabels(titles, rotation=
|
152 |
ax.set_xlabel('')
|
153 |
ax.set_xlim(-1, k)
|
154 |
# ax.grid(False)
|
155 |
-
ax.set_ylabel('Score')
|
156 |
# ax.set_ylim(-0.09, 1.2)
|
157 |
-
ax.legend()
|
158 |
return fig
|
159 |
|
160 |
|
@@ -270,15 +271,17 @@ def developer_interface(Ufile, Pfile, Sfile=None, job_meta_file=None, user_meta_
|
|
270 |
plt.close('all')
|
271 |
envy = metrics_dict['envy'].numpy()
|
272 |
inferiority = metrics_dict['inferiority'].numpy()
|
273 |
-
fig, (ax1, ax2) = plt.subplots(ncols=2)
|
274 |
-
fig.tight_layout()
|
275 |
ax1.boxplot(envy)
|
276 |
-
ax1.set_ylabel('
|
277 |
-
ax1.set_title('Envy')
|
278 |
ax1.set_xticks([])
|
279 |
ax2.boxplot(inferiority)
|
280 |
-
ax2.
|
281 |
-
ax2.
|
|
|
|
|
282 |
ax2.set_xticks([])
|
283 |
return fig
|
284 |
|
@@ -297,8 +300,11 @@ def developer_interface(Ufile, Pfile, Sfile=None, job_meta_file=None, user_meta_
|
|
297 |
'inferiority': metrics_dict['inferiority']}
|
298 |
data = pd.DataFrame(data)
|
299 |
data = data.join(recdata.user_metadata)
|
300 |
-
fig, ax = plt.subplots()
|
301 |
sns.scatterplot(data=data, x='log(envy+1)', y='inferiority', hue=group, ax=ax)
|
|
|
|
|
|
|
302 |
return fig
|
303 |
|
304 |
def lorenz_curve(X, ax, label):
|
@@ -321,11 +327,11 @@ def developer_interface(Ufile, Pfile, Sfile=None, job_meta_file=None, user_meta_
|
|
321 |
labels, counts = np.unique(rec_per_job, return_counts=True)
|
322 |
ax1.bar(labels, counts, align='center')
|
323 |
|
324 |
-
ax1.set_xlabel('Number of times a job is recommended')
|
325 |
-
ax1.set_ylabel('Number of jobs')
|
326 |
-
ax1.set_title('Distribution of job exposure')
|
327 |
ax2 = lorenz_curve(rec_per_job, ax2,'')
|
328 |
-
ax2.set_title('Lorenz Curve')
|
329 |
return fig
|
330 |
|
331 |
|
|
|
79 |
envy = ret_dict['envy'].sum(-1)
|
80 |
envy_user = envy[user]
|
81 |
# plot envy histogram
|
82 |
+
n, bins, patches = ax1.hist(envy, bins=30, color='grey', alpha=0.5)
|
83 |
ax1.set_yscale('symlog')
|
84 |
sns.kdeplot(envy, color='grey', bw_adjust=0.3, cut=0, ax=ax1)
|
85 |
# mark this user's envy
|
|
|
88 |
# print(envy_user, idx)
|
89 |
patches[idx-1].set_fc('r')
|
90 |
ax1.legend(handles=[Patch(facecolor='r', edgecolor='r', alpha=0.5,
|
91 |
+
label='Your envy group')], fontsize=15)
|
92 |
+
ax1.set_xlabel('Envy', fontsize=18)
|
93 |
+
ax1.set_ylabel('Number of users (log scale)', fontsize=18)
|
94 |
|
95 |
return fig
|
96 |
|
|
|
137 |
legend=False, s=100, hue='y', palette="summer") #monotone color palette
|
138 |
sns.scatterplot(y=my_scores, x=range(k), ax=ax,
|
139 |
alpha=0.8, s=200, ec='r', fc='none', label='Your rank')
|
140 |
+
|
141 |
# add ranking of this user's score for each job
|
142 |
# find score gaps
|
143 |
gaps = np.diff(np.sort(scores[0])).mean()
|
|
|
148 |
ax.set_xticks(range(k))
|
149 |
# shorten the job title
|
150 |
titles = [recdata.job_metadata[jb] for jb in users_rec]
|
151 |
+
titles = [t[:15] + '...' if len(t) > 15 else t for t in titles]
|
152 |
+
ax.set_xticklabels(titles, rotation=25, ha='right', fontsize=15)
|
153 |
ax.set_xlabel('')
|
154 |
ax.set_xlim(-1, k)
|
155 |
# ax.grid(False)
|
156 |
+
ax.set_ylabel('Score', fontsize=18)
|
157 |
# ax.set_ylim(-0.09, 1.2)
|
158 |
+
ax.legend(fontsize=15)
|
159 |
return fig
|
160 |
|
161 |
|
|
|
271 |
plt.close('all')
|
272 |
envy = metrics_dict['envy'].numpy()
|
273 |
inferiority = metrics_dict['inferiority'].numpy()
|
274 |
+
fig, (ax1, ax2) = plt.subplots(ncols=2, constrained_layout = True)
|
275 |
+
# fig.tight_layout()
|
276 |
ax1.boxplot(envy)
|
277 |
+
ax1.set_ylabel('Envy', fontsize=18)
|
278 |
+
# ax1.set_title('Envy', fontsize=18)
|
279 |
ax1.set_xticks([])
|
280 |
ax2.boxplot(inferiority)
|
281 |
+
ax2.yaxis.set_label_position("right")
|
282 |
+
ax2.yaxis.tick_right()
|
283 |
+
ax2.set_ylabel('Inferiority', fontsize=18)
|
284 |
+
# ax2.set_title('Inferiority', fontsize=18)
|
285 |
ax2.set_xticks([])
|
286 |
return fig
|
287 |
|
|
|
300 |
'inferiority': metrics_dict['inferiority']}
|
301 |
data = pd.DataFrame(data)
|
302 |
data = data.join(recdata.user_metadata)
|
303 |
+
fig, ax = plt.subplots(constrained_layout = True)
|
304 |
sns.scatterplot(data=data, x='log(envy+1)', y='inferiority', hue=group, ax=ax)
|
305 |
+
ax.set_xlabel('Log(envy+1)', fontsize=18)
|
306 |
+
ax.set_ylabel('Inferiority', fontsize=18)
|
307 |
+
ax.legend(fontsize=15)
|
308 |
return fig
|
309 |
|
310 |
def lorenz_curve(X, ax, label):
|
|
|
327 |
labels, counts = np.unique(rec_per_job, return_counts=True)
|
328 |
ax1.bar(labels, counts, align='center')
|
329 |
|
330 |
+
ax1.set_xlabel('Number of times a job is recommended', fontsize=18)
|
331 |
+
ax1.set_ylabel('Number of jobs', fontsize=18)
|
332 |
+
ax1.set_title('Distribution of job exposure', fontsize=18)
|
333 |
ax2 = lorenz_curve(rec_per_job, ax2,'')
|
334 |
+
ax2.set_title('Lorenz Curve', fontsize=18)
|
335 |
return fig
|
336 |
|
337 |
|