Skip to content

Commit

Permalink
increases order of f1 bijectors
Browse files Browse the repository at this point in the history
  • Loading branch information
MArpogaus committed Sep 15, 2023
1 parent bee520a commit 3d1f498
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cml/old_faithful.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def negloglik(y_true, y_hat):

a2 = flow.bijector.bijector.bijectors[0].scale
thetas = flow.bijector.bijector.bijectors[1].thetas
b1 = flow.bijector.bijector.bijectors[3].shift
a1 = flow.bijector.bijector.bijectors[4].scale
a1 = flow.bijector.bijector.bijectors[3].scale
b1 = flow.bijector.bijector.bijectors[4].shift


with open(result_path + "of_pvector.txt", "w") as pvector:
Expand Down
6 changes: 3 additions & 3 deletions src/bernstein_flow/distributions/bernstein_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ def init_bijectors(
bijectors = []

# f1: ŷ = sigma(a1(x)*y - b1(x))
if tf.is_tensor(a1):
f1_scale = tfb.Scale(a1, name="scale1")
bijectors.append(f1_scale)
if tf.is_tensor(b1):
f1_shift = tfb.Shift(b1, name="shift1")
bijectors.append(f1_shift)
if tf.is_tensor(a1):
f1_scale = tfb.Scale(a1, name="scale1")
bijectors.append(f1_scale)

# clip to domain [0, 1]
if clip_to_bernstein_domain:
Expand Down

2 comments on commit 3d1f498

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old Faithful

Learning Curve

Metrics

Min of loss: -0.7430018782615662

Parameter Vector

a1 = array([7.399017], dtype=float32)
b1 = array([-0.52731043], dtype=float32)
thetas = array([-4.        , -0.30206275, -0.29629907, -0.29544288, -0.29515794,
   -0.29501364, -0.29491523, -0.29314813, -0.26503685,  3.9999893 ],
  dtype=float32)
a2 = array([1.3188093], dtype=float32)

Results

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bimodal Model

Learning Curve

Learning Curve

Metrics

loss: -0.89259272813797
val_loss: -0.938466489315033

Results

Parameter Vector for x = 1

BernsteinFlow:
invert_chain_of_bpoly_of_scale1_of_shift1:
chain_of_bpoly_of_scale1_of_shift1:
bpoly: [-3.0000417e+00 -2.1808119e+00 -1.3615819e+00 -1.3305326e+00
-6.8045139e-02 -7.4016601e-03 -7.3861834e-03 -7.3707066e-03
-7.3552299e-03 -7.3397532e-03 -7.3242765e-03 -7.3087998e-03
-7.2933231e-03 -7.2778463e-03 -7.2623696e-03 -7.2468929e-03
-6.3020019e-03 6.5172625e+00 1.3040827e+01]
scale1: 0.46643325686454773
shift1: 0.6817902326583862

Flow



Bijector


Please sign in to comment.