lucidum is an open source R Shiny app to help users build and communicate GLMs and GBMs without writing code.
To see lucidum in action visit ShinyConf 2023 - lucidum app showcase.
lucidum works with standard R data.frames and data.tables and is designed to make model building more interactive, visual and insightful.
I originally wrote lucidum to automate the repetitive tasks involved when building the types of regression models common to UK personal lines insurers. More recently, I have used it as a tool to help insurers move from GLMs to GBMs (specifically LightGBM), using SHAP values to understand and communicate model features and interaction effects.
lucidum's functionality includes:
overlay SHAP value ribbons for GBMs to understand the underlying model effect
Interactive mapping of data at UK Postcode Area, Sector and Unit resolution
point plotting for postcode units based on latitude and longitude
Support a GLM build
export tabulated GLMs as Excel workbooks
Support a GBM build
You can install the development version of lucidum from GitHub with:
# install.packages("devtools")
devtools::install_github("SpeckledJim2/lucidum")
library(lucidum)
lucidum(your_dataframe_name)
To load the demo dataset into lucidum use:
library(lucidum)
lucidum(insurance)
To separate training and test rows in your dataset, include a numerical column called "train_test" with value 0 for training and 1 for test.
Include columns in your dataset called PostcodeArea and PostcodeSector to enable UK mapping.
Include columns called PostcodeUnit, lat (latitude) and long (longitude) to enable postcode unit level plotting.
Search for the "National Statistics Postcode Lookup" at https://geoportal.statistics.gov.uk to download the latest unit to lat,long mapping - updated versions are released quarterly.
Ensure postcode sector and unit contain a single character space between the outcode and incode with all letters in CAPITALS, e.g. PO15 7JT.
Specification files make lucidum more useful by specifying metadata to make model building faster.
Specification files are .csv files which can be created within lucidum itself or in a text editor. You don’t have to use specification files, but they make life easier if you are going to be working with a dataset on a regular basis.
There are three types of specification files:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.