Samuel Mueller commited on
Commit
0a04eb5
1 Parent(s): f50f696

more description, larger font

Browse files
Files changed (2) hide show
  1. SettingUpTheWebiste.ipynb +0 -0
  2. app.py +8 -4
SettingUpTheWebiste.ipynb CHANGED
The diff for this file is too large to render. See raw diff
 
app.py CHANGED
@@ -51,7 +51,6 @@ def mean_and_bounds_for_pnf(x,y,test_xs, choice):
51
  sys.path.append('prior-fitting/')
52
  model = torch.load(f'onefeature_gp_ls.1_pnf_{choice}.pt')
53
 
54
-
55
  logits = model((torch.cat([x,test_xs],0).unsqueeze(1),y.unsqueeze(1)),single_eval_pos=len(x))
56
  bounds = model.criterion.quantile(logits,center_prob=.682).squeeze(1)
57
  return model.criterion.mean(logits).squeeze(1), bounds[:,0], bounds[:,1]
@@ -75,7 +74,7 @@ def infer(table, choice):
75
  return excuse, None
76
  x = torch.tensor(table[:,0]).unsqueeze(1)
77
  y = torch.tensor(table[:,1])
78
- fig = plt.figure()
79
 
80
  if len(x) > 4:
81
  return excuse_max_examples, None
@@ -95,10 +94,15 @@ def infer(table, choice):
95
 
96
  return '', plt.gcf()
97
 
98
- iface = gr.Interface(fn=infer,
 
 
 
 
 
99
  inputs=[
100
  gr.inputs.Dataframe(headers=["x", "y"], datatype=["number", "number"], row_count=2, type='numpy', default=[['.25','.1'],['.75','.4']]),
101
- gr.inputs.Radio(['160K','800K','4M'], type="value", default='4M', label='Training Costs')
102
  ], outputs=["text","plot"])
103
  iface.launch()
104
 
 
51
  sys.path.append('prior-fitting/')
52
  model = torch.load(f'onefeature_gp_ls.1_pnf_{choice}.pt')
53
 
 
54
  logits = model((torch.cat([x,test_xs],0).unsqueeze(1),y.unsqueeze(1)),single_eval_pos=len(x))
55
  bounds = model.criterion.quantile(logits,center_prob=.682).squeeze(1)
56
  return model.criterion.mean(logits).squeeze(1), bounds[:,0], bounds[:,1]
 
74
  return excuse, None
75
  x = torch.tensor(table[:,0]).unsqueeze(1)
76
  y = torch.tensor(table[:,1])
77
+ fig = plt.figure(figsize=(4,2),dpi=1000)
78
 
79
  if len(x) > 4:
80
  return excuse_max_examples, None
 
94
 
95
  return '', plt.gcf()
96
 
97
+ iface = gr.Interface(fn=infer,
98
+ title='GP Posterior Approximation with Transformers',
99
+ description='''This is a demo of PFNs as we describe them in our recent paper (https://openreview.net/forum?id=KSugKcbNf9).
100
+ Lines represent means and shaded areas are the confidence interval (68.2% quantile). In green, we have the ground truth GP posterior and in blue we have our approximation.
101
+ We provide three models that are architecturally the same, but with different training budgets.
102
+ ''',
103
  inputs=[
104
  gr.inputs.Dataframe(headers=["x", "y"], datatype=["number", "number"], row_count=2, type='numpy', default=[['.25','.1'],['.75','.4']]),
105
+ gr.inputs.Radio(['160K','800K','4M'], type="value", default='4M', label='Number of Sampled Datasets in Training (Training Costs)')
106
  ], outputs=["text","plot"])
107
  iface.launch()
108