Skip to content

Commit

Permalink
Release v0.9.0
Browse files Browse the repository at this point in the history
* clv.data as.data.frame / as.data.table (#184)
* as.clv.data (#187)
* clv.data subset() (#185)
* clv.data summary for selected customers (#196)
* PNBD DERT numerical stability (#186)
* clv.data: plot spending density, interpurchase time density, num transactions barplot (#188 #190 #192) 
* PMF and PMF plot (#193 #194) 
* Github actions: best practices (#195)
* Vignette
* Update maintainer email

Co-authored-by: Patrick Bachmann <[email protected]>
  • Loading branch information
pschil and bachmannpatrick authored Jan 10, 2022
2 parents d8709cc + 40f0af4 commit 7b2cebb
Show file tree
Hide file tree
Showing 130 changed files with 4,084 additions and 1,184 deletions.
31 changes: 11 additions & 20 deletions .github/workflows/Coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
name: coverage
on: pull_request # default to types [opened, synchronize, reopened]
jobs:
coverage-ubuntu-16-04-R-release:
runs-on: ubuntu-16.04
coverage-ubuntu-latest:
runs-on: ubuntu-latest
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
# to install binaries on ubuntu
RSPM: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@master

- uses: r-lib/actions/setup-r@v1
with:
r-version: 'release'
- name: Install system dependencies
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "install.packages(c('remotes', 'rcmdcheck'))"
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install package dependencies
run: |
remotes::install_deps(dependencies = TRUE) # installs binaries
# testthat and covr are part of package's Suggests and installed as package dependency.
shell: Rscript {0}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: covr

- name: Test coverage
# run: covr::codecov() # uploads to codecov.io
run: |
# If on a release branch (name starts with 'release'),
# run all tests, including lengthy ones marked with skip_on_ci/skip_on_covr()
if(grepl(pattern = "^release", x = Sys.getenv("GITHUB_HEAD_REF"))){
Expand Down
87 changes: 38 additions & 49 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- '*'
- '!master' # run on every branch except master
- '!master' # run on every branch except master (fails because same as on cran)

# CMD checks on win, mac, ubuntu
jobs:
Expand All @@ -16,71 +16,60 @@ jobs:
matrix:
config:
- {os: macOS-latest, r: 'devel'}
- {os: windows-latest, r: 'devel'}
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'devel'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-16.04, r: 'release', rspm: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@master
with:
r-version: ${{ matrix.config.r }}
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v1
- uses: r-lib/actions/setup-pandoc@v1

- uses: r-lib/actions/setup-r@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- name: Install system dependencies
- name: Install linux system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
sudo apt-get install -y qpdf # qpdf needed on ubuntu
sudo apt-get install texlive-xetex # for tinytex
sudo apt-get update
sudo apt-get install -y qpdf texlive-xetex ghostscript
- name: Install tinytex for linux (to build vignettes)
if: runner.os == 'Linux'
run: |
install.packages('tinytex')
tinytex::install_tinytex()
shell: Rscript {0}

- name: Install gsl for mac
- name: Install mac system dependencies
if: runner.os == 'macOS'
run: |
brew install gsl
brew install gsl openssl ghostscript
- name: Install package dependencies
- name: Install Windows system dependencies
if: runner.os == 'Windows'
run: |
remotes::install_deps(dependencies = TRUE)
# remotes::install_cran(c("RcppGSL", "stringi"), repos = "https://cran.rstudio.com")
remotes::install_cran("rcmdcheck", repos = "https://cran.rstudio.com")
# remove because leads to NOTE. Does not exist on windows
if(file.exists('depends.Rds')) {file.remove('depends.Rds')}
shell: Rscript {0}
pacman -Sy # Update repo index
pacman -S --noconfirm mingw-w64-x86_64-gsl mingw-w64-i686-gsl mingw-w64-ucrt-x86_64-gsl
# pacman -S --noconfirm mingw-w64-{i686,x86_64}-gsl
- name: Check on Mac / ubuntu
if: runner.os != 'Windows'
run: rcmdcheck::rcmdcheck(args = c("--no-tests", "--as-cran", "--no-manual"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: rcmdcheck

- name: Check on Windows, without install and vignette
if: runner.os == 'Windows'
run: rcmdcheck::rcmdcheck(args = c("--no-install", "--no-build-vignettes","--no-vignettes","--ignore-vignettes","--no-tests", "--as-cran", "--no-manual"), build_args = c("--no-build-vignettes"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- uses: r-lib/actions/setup-tinytex@v1

- uses: r-lib/actions/check-r-package@v1
with:
args: '"--no-manual", "--as-cran", "--no-tests"'

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
32 changes: 12 additions & 20 deletions .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,24 @@ on:
branches:
- 'release**'
- 'development'

jobs:
tests-ubuntu-16-04-R-release:
runs-on: ubuntu-16.04
tests-ubuntu-latest:
runs-on: ubuntu-latest
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
# to install binaries on ubuntu
RSPM: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@master

- uses: r-lib/actions/setup-r@v1
with:
r-version: 'release'
- name: Install system dependencies
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "install.packages(c('remotes', 'rcmdcheck'))"
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install package dependencies
run: |
remotes::install_deps(dependencies = TRUE) # installs binaries
# Install testing stuff (testthat and covr are part of package's Suggests and installed as package dependency)
remotes::install_cran("devtools")
shell: Rscript {0}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: devtools

- name: Run tests
run: |
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ name: pkgdown
jobs:
pkgdown:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master

- uses: r-lib/actions/setup-pandoc@master

- name: Install gsl for mac
- uses: r-lib/actions/setup-r@master

- name: Install dependencies for mac
run: |
brew install gsl
brew install gsl openssl
- name: Query dependencies
run: |
Expand Down
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Package: CLVTools
Title: Tools for Customer Lifetime Value Estimation
Version: 0.8.1
Date: 2021-10-13
Version: 0.9.0
Date: 2022-01-07
Authors@R: c(
person(given="Patrick", family="Bachmann", email = "[email protected].ch", role = c("cre","aut")),
person(given="Patrick", family="Bachmann", email = "pbachma@ethz.ch", role = c("cre","aut")),
person(given="Niels", family="Kuebler", email = "[email protected]", role = "aut"),
person(given="Markus", family="Meierer", email = "[email protected]", role = "aut"),
person(given="Jeffrey", family="Naef", email = "[email protected]",role = "aut"),
Expand Down Expand Up @@ -43,7 +43,6 @@ Imports:
utils
Suggests:
covr,
future,
knitr,
rmarkdown,
testthat
Expand Down Expand Up @@ -94,12 +93,12 @@ Collate:
'class_clv_time_weeks.R'
'class_clv_time_years.R'
'clv_template_controlflow_estimate.R'
'clv_template_controlflow_pmf.R'
'clv_template_controlflow_predict.R'
'data.R'
'f_DoExpectation.R'
'f_clvdata_inputchecks.R'
'f_clvfitted_inputchecks.R'
'f_generics_clvdata.R'
'f_generics_clvfitted.R'
'f_generics_clvfitted_estimate.R'
'f_generics_clvfittedspending.R'
Expand All @@ -113,6 +112,7 @@ Collate:
'f_interface_clvdata.R'
'f_interface_gg.R'
'f_interface_ggomnbd.R'
'f_interface_pmf.R'
'f_interface_pnbd.R'
'f_interface_predict_clvfittedspending.R'
'f_interface_predict_clvfittedtransactions.R'
Expand Down
13 changes: 13 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Generated by roxygen2: do not edit by hand

S3method(as.clv.data,data.frame)
S3method(as.clv.data,data.table)
S3method(as.data.frame,clv.data)
S3method(as.data.table,clv.data)
S3method(coef,clv.fitted)
S3method(coef,clv.fitted.transactions.static.cov)
S3method(coef,summary.clv.fitted)
Expand All @@ -24,6 +28,7 @@ S3method(print,summary.clv.data.dynamic.covariates)
S3method(print,summary.clv.data.static.covariates)
S3method(print,summary.clv.fitted)
S3method(print,summary.clv.time)
S3method(subset,clv.data)
S3method(summary,clv.data)
S3method(summary,clv.data.dynamic.covariates)
S3method(summary,clv.data.static.covariates)
Expand All @@ -34,12 +39,14 @@ S3method(vcov,clv.fitted)
S3method(vcov,summary.clv.fitted)
export(SetDynamicCovariates)
export(SetStaticCovariates)
export(as.clv.data)
export(clvdata)
exportMethods(bgbb)
exportMethods(bgnbd)
exportMethods(gg)
exportMethods(ggomnbd)
exportMethods(plot)
exportMethods(pmf)
exportMethods(pnbd)
exportMethods(predict)
exportMethods(show)
Expand All @@ -49,18 +56,24 @@ importFrom(MASS,ginv)
importFrom(Matrix,nearPD)
importFrom(Rcpp,evalCpp)
importFrom(ggplot2,aes)
importFrom(ggplot2,aes_string)
importFrom(ggplot2,element_blank)
importFrom(ggplot2,element_line)
importFrom(ggplot2,element_rect)
importFrom(ggplot2,element_text)
importFrom(ggplot2,geom_col)
importFrom(ggplot2,geom_line)
importFrom(ggplot2,geom_text)
importFrom(ggplot2,geom_vline)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,guide_legend)
importFrom(ggplot2,labs)
importFrom(ggplot2,position_dodge)
importFrom(ggplot2,position_dodge2)
importFrom(ggplot2,rel)
importFrom(ggplot2,scale_colour_manual)
importFrom(ggplot2,scale_fill_manual)
importFrom(ggplot2,scale_x_discrete)
importFrom(ggplot2,stat_density)
importFrom(ggplot2,theme)
importFrom(graphics,plot)
Expand Down
17 changes: 15 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# CLVTools 0.9.0

### NEW FEATURES
* Three new diagnostic plots for transaction data to analyse frequency, spending and interpurchase time
* New diagnostic plot for fitted transaction models (PMF plot)
* New function to calculate the probability mass function of selected models
* Calculate summary statistics only for the transaction data of selected customers
* Canonical transformation from data.frame/data.table to transaction data object and vice-versa
* Canonical subset for the data stored in the transaction data object
* Pareto/NBD DERT: Improved numerical stability



# CLVTools 0.8.1

### BUG FIXES
Expand Down Expand Up @@ -25,7 +38,7 @@
* Improved documentation and walkthrough

### BUG FIXES
* Pareto/NBD LogLikelihood: For the case Tcal = t.x and for the case alpha == beta
* Pareto/NBD log-likelihood: For the case Tcal = t.x and for the case alpha == beta
* Static or dynamic covariates with syntactically invalid names (spaces, start with numbers, etc) could not be fit


Expand All @@ -44,5 +57,5 @@
* Pareto/NBD model to predict repeat transactions without and with static or dynamic covariates
* Gamma-Gamma model to predict average spending
* Predicting CLV and future transactions per customer
* Data class to pre-process transaction data and to provide summary statistics
* Data class to preprocess transaction data and to provide summary statistics
* Plot of expected repeat transactions as by the fitted model compared against actuals
Loading

0 comments on commit 7b2cebb

Please sign in to comment.