{"id":14069884,"url":"https://github.com/kasaai/deeptriangle","last_synced_at":"2025-07-30T06:33:14.150Z","repository":{"id":89957925,"uuid":"130874365","full_name":"kasaai/deeptriangle","owner":"kasaai","description":"DeepTriangle: A Deep Learning Approach to Loss Reserving","archived":false,"fork":false,"pushed_at":"2019-09-16T23:46:11.000Z","size":1090,"stargazers_count":46,"open_issues_count":2,"forks_count":23,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-04T11:38:01.060Z","etag":null,"topics":["actuarial-science","deep-learning","insurance","rstats"],"latest_commit_sha":null,"homepage":"https://www.mdpi.com/2227-9091/7/3/97","language":"TeX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kasaai.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-24T15:18:06.000Z","updated_at":"2024-11-19T21:15:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"362f68b5-2834-473e-9399-412d16e6b146","html_url":"https://github.com/kasaai/deeptriangle","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kasaai/deeptriangle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fdeeptriangle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fdeeptriangle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fdeeptriangle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fdeeptriangle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kasaai","download_url":"https://codeload.github.com/kasaai/deeptriangle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasaai%2Fdeeptriangle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267822959,"owners_count":24149728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actuarial-science","deep-learning","insurance","rstats"],"created_at":"2024-08-13T07:07:18.739Z","updated_at":"2025-07-30T06:33:13.871Z","avatar_url":"https://github.com/kasaai.png","language":"TeX","funding_links":[],"categories":["TeX"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\nlibrary(deeptriangle)\nlibrary(tidyverse)\n```\n\n[![Travis build status](https://travis-ci.org/kasaai/deeptriangle.svg?branch=master)](https://travis-ci.org/kasaai/deeptriangle)\n\n# DeepTriangle\n\nThis is the companion repository to the paper [*DeepTriangle: A Deep Learning Approach to Loss Reserving*](https://www.mdpi.com/2227-9091/7/3/97).\n\n\n## Experiments\n\nTo get started, either clone the repo and build the R package, or install with\n\n``` r\ndevtools::install_github(\"kasaai/deeptriangle\")\n```\n\nYou will also need the [insurance](https://github.com/kasaai/insurance) package, which can be installed with\n\n```r\ndevtools::install_github(\"kasaai/insurance\")\n```\n\nThe experiments can be found in `analysis/main.R`. It is recommended that you use a GPU since many instances of the models are fit.\n\nFor convenience, we provide a `predictions.feather` file in the release.\n\n```{r, message = FALSE}\npredictions \u003c- feather::read_feather(\"datasets/predictions.feather\")\n\nmodel_results \u003c- dt_compute_metrics(predictions) %\u003e%\n  bind_rows(stochastic_model_results) %\u003e%\n  bind_rows(read_csv(\"datasets/automl_results.csv\")) %\u003e%\n  gather(metric, value, mape, rmspe)\n\ndt_tabulate_metrics(model_results, metric = \"mape\") %\u003e%\n  knitr::kable(booktabs = \"T\", digits = 3)\n```\n\nTo create actual vs. predicted plots, use the `dt_plot_predictions()` function. Here are successful and unsuccessful examples of the model's forecasting attempts.\n\nCompany 1767 commercial auto.\n\n```{r, echo = FALSE, message = FALSE, out.width = \"80%\"}\nlibrary(cowplot)\n\np1 \u003c- dt_plot_predictions(predictions, \"1767\", \"commercial_auto\", \"paid_loss\") + xlab(\"\")\np2 \u003c- dt_plot_predictions(predictions, \"1767\", \"commercial_auto\", \"claims_outstanding\")\np12 \u003c- plot_grid(\n  p1 + theme(legend.position = \"none\"),\n  p2 + theme(legend.position = \"none\"),\n  align = \"v\",\n  ncol = 1\n)\nlegend \u003c- get_legend(p1)\nplot_grid(p12, legend, rel_widths = c(1, 0.2), nrow = 1)\n```\n\nCompany 337 workers' compensation.\n\n```{r, echo = FALSE, message = FALSE, out.width = \"80%\"}\nlibrary(cowplot)\n\np1 \u003c- dt_plot_predictions(predictions, \"337\", \"workers_compensation\", \"paid_loss\") + xlab(\"\")\np2 \u003c- dt_plot_predictions(predictions, \"337\", \"workers_compensation\", \"claims_outstanding\")\np12 \u003c- plot_grid(\n  p1 + theme(legend.position = \"none\"),\n  p2 + theme(legend.position = \"none\"),\n  align = \"v\",\n  ncol = 1\n)\nlegend \u003c- get_legend(p1)\nplot_grid(p12, legend, rel_widths = c(1, 0.2), nrow = 1)\n```\n\n## Testing different architectures\n\nIf you would like to try out different architectures or hyperparameters, you can do so by providing a function that returns a keras model. See the source code of `dt_model()` for a template.\n\nFor more details on the **keras** R package, visit [https://keras.rstudio.com/](https://keras.rstudio.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasaai%2Fdeeptriangle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkasaai%2Fdeeptriangle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasaai%2Fdeeptriangle/lists"}