Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in paid_out and recovery_out layer #20

Open
medamineskou opened this issue Jan 17, 2022 · 0 comments
Open

Error in paid_out and recovery_out layer #20

medamineskou opened this issue Jan 17, 2022 · 0 comments

Comments

@medamineskou
Copy link

Hello,

I'm working on individual claims reserving and your work is incredible ! Thank you so much for sharing your code.

I came across an error and I can't fix it (is the problem coming from the new version of tfprobabilty or tensorflow or something else ?)
It's related to this lines of code (model.R) :

paid_out <- out_sequence %>%
    layer_dense_variational(units = 4,
                            make_posterior_fn = posterior_mean_field,
                            make_prior_fn = prior,
                            kl_weight = 1 / n_rows,
                            activation = "linear") %>%
    layer_distribution_lambda(
      function(x) {
       

        d <- tfd_mixture(
          cat = tfd_categorical(logits = x[,,1:2]),
          components = list(
            tfd_transformed_distribution(
              tfd_log_normal(x[,,3], 1e-3 + ln_scale_bound * k_sigmoid(scale_c * x[,,4])),
              tfb_affine_scalar(shift = -1e-3)
            ),
            tfd_deterministic(loc = k_zeros_like(x[,,3]))
          )
        )
      },
      name = "paid_out_"
    )

Am getting this error :

Warning message in tfb_affine_scalar(shift = -0.001):
“tfb_affine_scalar() is deprecated, please use tfb_shift(shift)(tfb_scale(scale)) instead”
Error in py_call_impl(callable, dots$args, dots$keywords): RuntimeError: Exception encountered when calling layer "paid_out_" (type DistributionLambda).

Evaluation error: TypeError: got an unexpected keyword argument 'use_static_graph'

Detailed traceback:

File "/miniconda/envs/r-reticulate/lib/python3.8/site-packages/decorator.py", line 231, in fun
args, kw = fix(args, kw, sig)
File "/miniconda/envs/r-reticulate/lib/python3.8/site-packages/decorator.py", line 203, in fix
ba = sig.bind(*args, **kwargs)
File "/miniconda/envs/r-reticulate/lib/python3.8/inspect.py", line 3037, in bind
return self._bind(args, kwargs)
File "/miniconda/envs/r-reticulate/lib/python3.8/inspect.py", line 3026, in _bind
raise TypeError(

Call arguments received:

• inputs=tf.Tensor(shape=(None, 11, 4), dtype=float32)
• args=<class 'inspect._empty'>
• kwargs={'training': 'None'}

Thank you so much !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant