Git Product home page Git Product logo

rp-bnn-claims's Introduction

bnn-claims

Travis build status

Repository for the paper "Individual Claims Forecasting with Bayesian Mixture Density Networks." This work is supported by the Casualty Actuarial Society.

Data

The data files used in the code are part of the release. They can be downloaded after cloning the repo by running

# remotes::install_github("ropensci/piggyback")
piggyback::pb_download()

The raw data file Simulated.Cashflow.txt was created using the simulation machine available at https://people.math.ethz.ch/~wueth/simulation.html.

Dependencies

(GPU only) To install the necessary dependencies, install the latest dev version of renv using

remotes::install_github("rstudio/renv")

then run renv::init() followed by renv::restore().

rp-bnn-claims's People

Contributors

kevinykuo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rp-bnn-claims's Issues

Virtual environment

I'm an renv novice, so apologies if this is an obvious question. When running renv::restore, I get the message * The library is already synchronized with the lockfile.. Yet RStudio tells me that I don't have recipes, tfdatasets and two others. I know that I have recipes installed globally, but it doesn't look as though it appears in the file renv.lock.

Does the lockfile simply need to be updated?

Error in paid_out and recovery_out layer

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 !

Out-of-date package version for pkg-resources

In requirements.txt, line 14: pkg-resources==0.0.0

I do not believe this to be a valid PyPI package number.

To the original author(s), please ensure that package numbers are valid in order for users to build the project.

I'll try to create a PR to correct this and any other package version issues soon.

Thank you! :D

Error in `piggyback::download()`

After addressing the renv issue #14, I'm now having an issue with piggyback::download(). It worked earlier, but I'm not getting the error:

Error in df[update, ] : incorrect number of dimensions
In addition: Warning message:
In get_token() : Using default public GITHUB_TOKEN.
                     Please set your own token

Is the repo missing a .pbattributes file?

Move to cas-actuarial

@PirateGrunt added you as admin, not sure if that's enough to transfer ownership but worth a shot (so I don't need to obtain unnecessary permissions on the cas org)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.