Welcome to my blog
2024-03-31
2 / 3
R package
Notes on writing an R package
Yang Liu
/
2019-07-28
Although ‘SHAPforxgboost’ is not a package too complicated, it took me some time to get the package pass all the cran check. Now (Aug.03,2019) it is available on cran. Install by either install.packages("SHAPforxgboost") or devtools::install_github("liuyanguu/SHAPforxgboost") Use the ‘usethis’ package https://usethis.r-lib.org/ to set up the structure of the package. […]…
R package
SHAP for XGBoost in R: SHAPforxgboost
Yang Liu
/
2019-07-18
I wrote the R package SHAPforxgboost to cover all the plotting functions illustrated in this post. This post serves as the vignette for the package. Please install from CRAN or Github. install.packages("SHAPforxgboost") # or devtools::install_github("liuyanguu/SHAPforxgboost") Why SHAP values SHAP’s main advantages are local explanation and consistency in global model…
Data Visualization
Shiny in Blogdown
Yang Liu
/
2019-02-24
Since Blogdown is for static websites, it cannot run Shiny in rmarkdown directly. According to discussion here and document here. The only way to do it is using iframe and write outside the chunk: <iframe src="https://liuyanguu.shinyapps.io/bcl_app/" width=1000 height=800"></iframe> There is also a built-in function in knitr to do the same thing and write in the chunk. The only…
Machine Learning
Study shrinkage and DART in xgboost modeling using a simple dataset
Yang Liu
/
2018-11-15
It is always a good idea to study the packaged algorithm with a simple example. Inspired by my colleague Kodi’s excellent work showing how xgboost handles missing values, I tried a simple 5x2 dataset to show how shrinkage and DART influence the growth of trees in the model. […] set.seed(123) n0 <- 5 X <- data.frame(x1 = runif(n0), x2 = runif(n0)) Y <- c(1, 5, 20, 50, 100) cbind(X,…
Machine Learning
SHAP Visualization in R (first post)
Yang Liu
/
2018-10-14
Update 19/07/21: Since my R Package SHAPforxgboost has been released on CRAN, I updated this post using the new functions and illustrate how to use these functions using two datasets. For more information, please refer to: SHAP visualization for XGBoost in R […] This is the example I used in the package SHAPforxgboost # Example use iris suppressPackageStartupMessages({…
Data Visualization
Spatial data in R: Dividing raster layers into equal-area rings
Yang Liu
/
2018-07-20
This data visualization example include: * Import .img file as a raster * Turn raster into a data.frame of points (coordinates) and values * Dividing the points into 100 equal-area rings * Calculate Built-up Area/Urban Extent for each ring * Turn dataframe into raster * Plot multiple figures on the same color scale […] […] list.of.packages <- c("raster",…
««
«
1
2
3
»
»»