Skip to content

Commit

Permalink
fixes default_constraining_bijector_fn of a1
Browse files Browse the repository at this point in the history
  • Loading branch information
MArpogaus committed Feb 6, 2024
1 parent 31a7059 commit 3bb49cf
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cml/bimodal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# author : Marcel Arpogaus <marcel dot arpogaus at gmail dot com>
#
# created : 2021-03-22 16:42:31 (Marcel Arpogaus)
# changed : 2024-02-06 13:55:44 (Marcel Arpogaus)
# changed : 2024-02-06 15:02:27 (Marcel Arpogaus)
# DESCRIPTION ############################################################
# ...
# LICENSE ################################################################
Expand Down Expand Up @@ -155,7 +155,7 @@ def fit_model(
train_y,
validation_data=(val_x, val_y),
epochs=epochs,
# shuffle=True,
shuffle=True,
batch_size=batch_size,
callbacks=callbacks,
**kwds,
Expand Down
7 changes: 2 additions & 5 deletions cml/old_faithful.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# author : Marcel Arpogaus <marcel dot arpogaus at gmail dot com>
#
# created : 2021-03-22 11:14:00 (Marcel Arpogaus)
# changed : 2024-02-06 14:42:02 (Marcel Arpogaus)
# changed : 2024-02-06 14:58:19 (Marcel Arpogaus)
# DESCRIPTION ############################################################
# ...
# LICENSE ################################################################
Expand Down Expand Up @@ -122,10 +122,7 @@ def negloglik(y_true, pv):

flow_model.compile(optimizer=tf.optimizers.Adam(learning_rate=0.01), loss=negloglik)

hist = flow_model.fit(
dataset,
epochs=1000,
)
hist = flow_model.fit(dataset, epochs=1000, shuffle=True)


# %% Result
Expand Down
1 change: 0 additions & 1 deletion cml/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ bimodal:
fit_kwds:
batch_size: 32
epochs: 1000
# steps_per_epoch: 2
model_kwds:
output_shape: 20
thetas_constrain_fn: !!python/object/apply:bernstein_flow.activations.get_thetas_constrain_fn
Expand Down
4 changes: 2 additions & 2 deletions metrics/bimodal/bm_metrics.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
loss: -0.8797889947891235
val_loss: -0.9052213430404663
loss: -0.8145940899848938
val_loss: -0.8566501140594482
2 changes: 1 addition & 1 deletion metrics/old_faithful/of_metrics.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Min of loss: -0.7447453737258911
Min of loss: -0.7492111325263977
6 changes: 5 additions & 1 deletion src/bernstein_flow/distributions/bernstein_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ def __init__(
@classmethod
def _parameter_properties(cls, dtype=None, num_classes=None):
return dict(
a1=tfb.Scale.parameter_properties(dtype)["scale"],
a1=tfp.util.ParameterProperties(
default_constraining_bijector_fn=lambda: tfb.Softplus(
low=dtype_util.eps(dtype)
)
),
b1=tfb.Shift.parameter_properties(dtype)["shift"],
thetas=BernsteinBijector.parameter_properties(dtype)["thetas"],
a2=tfp.util.ParameterProperties(
Expand Down

1 comment on commit 3bb49cf

@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.7894641160964966
val_loss: -0.8159165978431702

Results

Parameter Vector for x = 1

BernsteinFlow:
invert_chain_of_bpoly_of_scale1_of_shift1:
chain_of_bpoly_of_scale1_of_shift1:
bpoly: [-3.0000012e+00 -2.0594790e+00 -1.1189568e+00 -5.8296889e-01
-2.2562742e-03 -2.1699006e-03 -2.1599005e-03 -2.1499004e-03
-2.1399003e-03 -2.1299003e-03 -2.1199002e-03 -2.1099001e-03
-2.0999000e-03 -2.0899000e-03 -2.0798999e-03 -2.0698593e-03
6.2590384e+00 1.3928415e+01 2.1597792e+01]
scale1: 0.438262939453125
shift1: 0.6019636392593384

Flow



Bijector


Please sign in to comment.