Skip to content

Instantly share code, notes, and snippets.

View jefische's full-sized avatar

Jeremy Fischer jefische

View GitHub Profile
@program--
program-- / build_tree.R
Last active February 27, 2022 22:19
Convert gbm regression tree to data.tree
#' @title Build GBM Tree
#' @description Create a `data.tree` object from a GBM tree.
#' @param gbm_model Object of class `gbm`
#' @param i.tree Tree iteration to build from
#' @return A `data.tree` object from the `i.tree` tree of `gbm_model`.
build_tree <- function(gbm_model, i.tree = 1) {
gbm_tree <- gbm::pretty.gbm.tree(gbm_model, i.tree = i.tree)
pathString <- c("0" = "0")
for (node in seq(1, nrow(gbm_tree) - 1)) {
@sdwfrost
sdwfrost / counties.geojson
Created September 23, 2019 17:54
US Counties data in geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.