Emily McMilin commited on
Commit
f0fee2a
·
1 Parent(s): bae4168

removing baseline results not inplace

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -307,14 +307,14 @@ def get_figure(results, dataset, gender, indie_var_name, include_baseline=True):
307
  colors = ['b', 'g', 'c', 'm', 'y', 'r', 'k'] # assert no
308
 
309
  # Grab then remove baselines from df
310
- baseline = results.loc[BASELINE_MARKER]
311
- results.drop(index=BASELINE_MARKER, axis=1, inplace=True)
312
 
313
  fig, ax = plt.subplots()
314
  for i, col in enumerate(results.columns):
315
- ax.plot(results[col], color=colors[i])#, color=colors)
316
 
317
  if include_baseline == True:
 
318
  for i, (name, value) in enumerate(baseline.items()):
319
  if name == indie_var_name:
320
  continue
@@ -327,7 +327,7 @@ def get_figure(results, dataset, gender, indie_var_name, include_baseline=True):
327
  ax.set_xlabel("Date injected into input text")
328
  ax.set_title(f"Softmax probability of pronouns predicted {gender}\n by model type vs {indie_var_name}.")
329
  ax.set_ylabel(f"Avg softmax prob for {gender} pronouns")
330
- ax.legend(list(results.columns))
331
  return fig
332
 
333
 
 
307
  colors = ['b', 'g', 'c', 'm', 'y', 'r', 'k'] # assert no
308
 
309
  # Grab then remove baselines from df
310
+ results_to_plot = results.drop(index=BASELINE_MARKER, axis=1)
 
311
 
312
  fig, ax = plt.subplots()
313
  for i, col in enumerate(results.columns):
314
+ ax.plot(results_to_plot[col], color=colors[i])#, color=colors)
315
 
316
  if include_baseline == True:
317
+ baseline = results.loc[BASELINE_MARKER]
318
  for i, (name, value) in enumerate(baseline.items()):
319
  if name == indie_var_name:
320
  continue
 
327
  ax.set_xlabel("Date injected into input text")
328
  ax.set_title(f"Softmax probability of pronouns predicted {gender}\n by model type vs {indie_var_name}.")
329
  ax.set_ylabel(f"Avg softmax prob for {gender} pronouns")
330
+ ax.legend(list(results_to_plot.columns))
331
  return fig
332
 
333