{"id":25305980,"url":"https://github.com/bonstats/eatmyshorts","last_synced_at":"2025-10-28T10:31:45.718Z","repository":{"id":153801648,"uuid":"222612461","full_name":"bonStats/eatmyshorts","owner":"bonStats","description":"Visualisation methods and functions for exploring Bayesian Additive Regression Trees","archived":false,"fork":false,"pushed_at":"2020-05-29T00:09:33.000Z","size":2600,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-09T18:31:38.110Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bonStats.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-11-19T05:02:20.000Z","updated_at":"2020-11-17T09:57:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"7e82fddc-cf1c-4ce6-b3d8-f4290f25173d","html_url":"https://github.com/bonStats/eatmyshorts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bonStats/eatmyshorts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonStats%2Featmyshorts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonStats%2Featmyshorts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonStats%2Featmyshorts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonStats%2Featmyshorts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bonStats","download_url":"https://codeload.github.com/bonStats/eatmyshorts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonStats%2Featmyshorts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281424751,"owners_count":26499021,"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-10-28T02:00:06.022Z","response_time":60,"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":[],"created_at":"2025-02-13T09:56:07.005Z","updated_at":"2025-10-28T10:31:45.713Z","avatar_url":"https://github.com/bonStats.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(\n  echo = T,\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n  )\n```\n\n```{r print-comment, results='asis', echo = FALSE}\n# included to warn users viewing README.md to edit THIS document. \ncat(\"\u003c!--- README.md is generated by rmarkdown: README.Rmd. Please edit that file. --\u003e\")\n```\n\n# `eatmyshorts`\n\nVisualisation methods and functions for exploring Bayesian Additive Regression Trees (BART). See [BART on CRAN](https://CRAN.R-project.org/package=BART), in particular the vignette.\n\nThis package is currently under development. Slides from OzViz 2019 workshop on `eatmyshorts` are available [here](https://bonstats.github.io/ozviz2019/slides.html).\n\nThe first occurrence of the famous \"eat my shorts\" catch phrase was in S01E02 of The Simpsons. In this episode Edna Krabappel also says \"visualise it BART\" when Bart is having problems with a aptitude test. [This clip](https://youtu.be/6Jq_9ghf-jI) from the episode summarises how I sometimes feel about visualising BART models.\n\n# Example usage of package\n\nBelow is a walk through of the packages current capabilities, and will be updated as the package develops.\n\n## Boston Housing example (from `BART` vignette)\n\nFirst we fit the BART model on two variables (for simplicity). Note that we are only returning 5 trees from the 1000 post-burnin samples, and only using 10 trees in total.\n\n```{r boston, echo=T, results='hide'}\n\nsuppressPackageStartupMessages({\nlibrary(eatmyshorts)\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(BART)\nlibrary(tidytree)\n})\n\nBoston \u003c- MASS::Boston\n\nX \u003c- Boston[, c(6, 13)]\ny \u003c- Boston$medv\n\nset.seed(99)\nbart_model \u003c- wbart(x.train = X, \n                  y.train = y, \n                  nskip = 1000, \n                  ndpost = 1000,\n                  nkeeptreedraws = 5, # keep only 5 mcmc iteration sum-of-trees\n                  ntree = 10, # use only 10 trees in each iteration (default 200)\n                  printevery = 1000\n                  ) \n\n```\n\nThe current methods for extracting the trees from the `BART` models are summarise below.\n\n```{r tree-extract}\n# Current methods for extracting trees:\n\ntidytree_simple \u003c- as_tidytree(bart_model)\n\ntidytree_simple\n\ntidytree_detailed \u003c- as_tidytree(\n  bart_model, \n  extra_cols = c(\"var\", \"cut\", \"leaf_value\", \"is_leaf\")\n  )\n\ntidytree_detailed\n\ntidygraph_detailed \u003c- as_tidygraph_list(\n  bart_model, \n  extra_cols = c(\"var\", \"cut\", \"leaf_value\", \"is_leaf\"))\n\ntidygraph_detailed[1:2]\n\n```\n\n\nThe `tidytree` method returns a `tbl_tree` (special `tibble`) grouped by MCMC iteration and tree number, whilst the `tidygraph` method returns a list of `tbl_graph` which inherit from the `igraph` structure.\n\nBy using the `ggraph` and `tidygraph` package together, we can do some simple plotting.\n\n```{r boston-plot, fig.height=5, fig.width=5, cache = F}\n\nlibrary(ggraph)\n\n  ggraph(tidygraph_detailed[[31]], 'dendrogram') + \n    geom_edge_elbow() + \n    geom_node_label(aes(label = label)) +\n    theme_graph()\n\n```\n\nThis only plots 1 tree from 1 iteration of the BART MCMC. How do we extend it?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbonstats%2Featmyshorts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbonstats%2Featmyshorts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbonstats%2Featmyshorts/lists"}