Skip to content

Commit

Permalink
doc: ensure type annotations are python 3.7 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
MArpogaus committed Jul 12, 2024
1 parent 92afafc commit e1b3368
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bernstein_flow/activations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# author : Marcel Arpogaus <znepry.necbtnhf@tznvy.pbz>
#
# created : 2024-07-12 15:12:18 (Marcel Arpogaus)
# changed : 2024-07-12 15:20:43 (Marcel Arpogaus)
# changed : 2024-07-12 15:39:47 (Marcel Arpogaus)

# %% License ###################################################################
# Copyright 2024 Marcel Arpogaus
Expand All @@ -25,6 +25,8 @@
"""Activation functions applied to unconstrained outputs of neural networks."""

# %% imports ###################################################################
from typing import Tuple, Union

import tensorflow as tf
from tensorflow_probability.python.internal import (
dtype_util,
Expand All @@ -35,7 +37,7 @@

# %% functions #################################################################
def get_thetas_constrain_fn(
bounds: tuple[float | None, float | None] = (None, None),
bounds: Tuple[Union[float, None], Union[float, None]] = (None, None),
smooth_bounds: bool = True,
allow_flexible_bounds: bool = False,
fn=tf.math.softplus,
Expand Down

2 comments on commit e1b3368

@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.4883013963699341

Parameter Vector

a1 = array([3.560865], dtype=float32)
b1 = array([-0.6245746], dtype=float32)
thetas = array([-0.186067  , -0.10567413, -0.02528127,  0.8432188 ,  0.84526825,
    0.8498381 ,  1.0596194 ,  1.9891126 ,  2.2198832 ,  2.338063  ,
    2.7084022 ,  3.078741  ], dtype=float32)

Flow

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.7893052697181702
val_loss: -0.8364390730857849

Results

Parameter Vector for x = 1

BernsteinFlow:
invert_chain_of_bernstein_bijector_of_scale1_of_shift1:
chain_of_bernstein_bijector_of_scale1_of_shift1:
bernstein_bijector: [-3.0000312 -2.0835228 -1.1670144 -0.095999 -0.0589848 -0.05897476
-0.05896476 -0.05895476 -0.05894477 -0.05893477 -0.05892477 -0.05891477
-0.05890477 -0.05889475 -0.05888423 7.733051 19.739637 19.739773
19.739908 ]
scale1: 0.38340669870376587
shift1: 0.6324079632759094

Flow



Bijector


Please sign in to comment.