Skip to content

Commit

Permalink
Release v.0.11.0 (#270)
Browse files Browse the repository at this point in the history
As went to CRAN:

* More memory efficient and faster creation of repeat transactions in `clv.data`
* Use existing repeat transactions when calling `gg` with `remove.first.transaction = TRUE`
* Simplify the formula interfaces `latentAttrition()` and `spending()`
* Add `predicted.total.spending` to predictions
* Harmonize parameter names used in various S3 methods
* Bootstrapping: Add facilities to estimate parameter uncertainty for all models
* Ability to predict future transactions of customers with no existing transaction history
* New start parameters for all latent attrition models
* Pareto/NBD dyncov: Improved numeric stability of PAlive
* GGomNBD: Implement erratum by Jost Adler to predict CET correctly
* GGomNBD: Improve numerical stability and runtime of LL integral
* GGomNBD: Implement PMF as derived by Jost Adler
* lrtest(): Likelihood ratio testing for latent attrition models
* Accept `data.table::IDate` as data inputs to `clvdata`
* `summary.clv.data`:Much faster by improving the calculation of the mean inter-purchase time
* Reduced fitting times for all models by using a compressed CBS as input to the LL sum
* Faster hessian calculation if a model was using correlation
* Estimating the Pareto/NBD dyncov with correlation was not possible
* GGomNBD: Free workspace after it is not used anymore to avoid memory-leak
* `SetDynamicCovariates`: Verify there is no covariate data for nonexistent customers
* Fix docu for Pareto/NBD start parameters
  • Loading branch information
pschil authored Aug 17, 2024
2 parents 203d218 + ee0d596 commit af088c4
Show file tree
Hide file tree
Showing 147 changed files with 6,480 additions and 2,176 deletions.
46 changes: 40 additions & 6 deletions .github/workflows/Coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
name: coverage
# Following https://github.com/r-lib/actions/blob/v2-branch/examples/test-coverage.yaml

on: pull_request # default to types [opened, synchronize, reopened]

name: coverage

permissions: read-all

jobs:
coverage-ubuntu-latest:
runs-on: ubuntu-latest
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: covr
extra-packages: any::covr, any::xml2
needs: coverage

- 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()
Expand All @@ -30,5 +35,34 @@ jobs:
print("Not on release branch: Dont run all tests (skip_on_covr())")
}
covr::package_coverage(type = "tests", quiet = FALSE)
cov <- covr::package_coverage(
type = "tests",
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
31 changes: 14 additions & 17 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
name: R-CMD-check
# Following https://github.com/r-lib/actions/blob/v2-branch/examples/check-standard.yaml
on:
push:
branches:
- '*'
- '!master' # run on every branch except master (fails because same as on cran)

name: R-CMD-check

permissions: read-all

# CMD checks on win, mac, ubuntu
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: R-CMD-check-${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
Expand All @@ -22,12 +27,13 @@ jobs:
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand All @@ -37,31 +43,22 @@ jobs:
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

# Unfortunately still needed, despite setup-r-dependencies
- name: Install mac system dependencies
if: runner.os == 'macOS'
run: |
brew install gsl
- name: Install Windows system dependencies
if: runner.os == 'Windows'
run: |
pacman -Sy # Update repo index
pacman -S --noconfirm mingw-w64-x86_64-gsl mingw-w64-i686-gsl mingw-w64-ucrt-x86_64-gsl
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

# required to build the vignette
- uses: r-lib/actions/setup-tinytex@v2

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
args: 'c("--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
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
26 changes: 17 additions & 9 deletions .github/workflows/Tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: testthat-tests

# Following Coverage.yaml

# Run tests for every PR and when commiting (push) to development or to the release branch
# pull_request: defaults to types [opened, synchronize, reopened]
on:
Expand All @@ -10,29 +12,35 @@ on:
- 'release**'
- 'development'

name: testthat-tests

permissions: read-all

jobs:
tests-ubuntu-latest:
runs-on: macOS-latest
tests-macos-latest:
runs-on: macOS-latest # run on mac for parallel testing
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: devtools, testthat

# Unfortunately still needed, despite setup-r-dependencies
- name: Install mac system dependencies
if: runner.os == 'macOS'
run: |
brew install gsl
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: devtools

- name: diag output
- name: Diag output Num CPUS
run: sysctl hw.logicalcpu

- name: Run tests
Expand Down
20 changes: 15 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: CLVTools
Title: Tools for Customer Lifetime Value Estimation
Version: 0.10.0
Date: 2023-10-23
Version: 0.11.0
Date: 2024-08-15
Authors@R: c(
person(given="Patrick", family="Bachmann", email = "[email protected]", role = c("cre","aut")),
person(given="Niels", family="Kuebler", email = "[email protected]", role = "aut"),
Expand Down Expand Up @@ -33,9 +33,11 @@ Description:
Further, we provide an implementation of the Gamma/Gamma model to model the spending process of individuals.
Imports:
data.table (>= 1.12.0),
digest (>= 0.6.0),
Formula (>= 1.2-4),
ggplot2 (>= 3.2.0),
lubridate (>= 1.7.8),
numDeriv (>= 2016.8-1.1),
Matrix (>= 1.2-17),
MASS,
optimx (>= 2019-12.02),
Expand All @@ -47,12 +49,14 @@ Suggests:
knitr,
rmarkdown,
xml2,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
lmtest
License: GPL-3
URL: https://github.com/bachmannpatrick/CLVTools
BugReports: https://github.com/bachmannpatrick/CLVTools/issues
NeedsCompilation: yes
LinkingTo: Rcpp, RcppArmadillo (>= 0.9.500.2.0), RcppGSL (>= 0.3.7), testthat
LinkingTo: Rcpp, RcppArmadillo (>= 0.11.4.0.1), RcppGSL (>= 0.3.7), testthat
SystemRequirements: GNU GSL
LazyLoad: yes
Encoding: UTF-8
Collate:
Expand Down Expand Up @@ -101,6 +105,9 @@ Collate:
'f_DoExpectation.R'
'f_clvdata_inputchecks.R'
'f_clvfitted_inputchecks.R'
'f_generics_clvdata.R'
'f_generics_clvdatadyncov.R'
'f_generics_clvdatastaticcov.R'
'f_generics_clvfitted.R'
'f_generics_clvfitted_estimate.R'
'f_generics_clvfittedspending.R'
Expand All @@ -111,10 +118,13 @@ Collate:
'f_generics_clvpnbddyncov.R'
'f_interface_bgbb.R'
'f_interface_bgnbd.R'
'f_interface_bootstrappedapply.R'
'f_interface_clvdata.R'
'f_interface_gg.R'
'f_interface_ggomnbd.R'
'f_interface_latentattrition.R'
'f_interface_lrtest.R'
'f_interface_newcustomer.R'
'f_interface_pmf.R'
'f_interface_pnbd.R'
'f_interface_predict_clvfittedspending.R'
Expand Down Expand Up @@ -144,7 +154,7 @@ Collate:
'pnbd_dyncov_createwalks.R'
'pnbd_dyncov_expectation.R'
'pnbd_dyncov_palive.R'
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Config/testthat/parallel: false
Config/testthat/edition: 3
15 changes: 14 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ S3method(coef,clv.fitted.transactions.static.cov)
S3method(coef,summary.clv.fitted)
S3method(confint,clv.fitted)
S3method(fitted,clv.fitted)
S3method(lmtest::lrtest,clv.fitted)
S3method(logLik,clv.fitted)
S3method(nobs,clv.data)
S3method(nobs,clv.fitted)
Expand Down Expand Up @@ -40,13 +41,18 @@ S3method(vcov,summary.clv.fitted)
export(SetDynamicCovariates)
export(SetStaticCovariates)
export(as.clv.data)
export(clv.bootstrapped.apply)
export(clvdata)
export(latentAttrition)
export(newcustomer)
export(newcustomer.dynamic)
export(newcustomer.static)
export(spending)
exportMethods(bgbb)
exportMethods(bgnbd)
exportMethods(gg)
exportMethods(ggomnbd)
exportMethods(lrtest)
exportMethods(plot)
exportMethods(pmf)
exportMethods(pnbd)
Expand All @@ -59,6 +65,7 @@ importFrom(Formula,is.Formula)
importFrom(MASS,ginv)
importFrom(Matrix,nearPD)
importFrom(Rcpp,evalCpp)
importFrom(digest,digest)
importFrom(ggplot2,aes)
importFrom(ggplot2,element_blank)
importFrom(ggplot2,element_line)
Expand All @@ -85,13 +92,13 @@ importFrom(ggplot2,scale_x_discrete)
importFrom(ggplot2,stat_density)
importFrom(ggplot2,theme)
importFrom(ggplot2,xlab)
importFrom(ggplot2,ylab)
importFrom(ggplot2,ylim)
importFrom(graphics,plot)
importFrom(lubridate,ceiling_date)
importFrom(lubridate,days)
importFrom(lubridate,floor_date)
importFrom(lubridate,force_tz)
importFrom(lubridate,int_diff)
importFrom(lubridate,interval)
importFrom(lubridate,is.Date)
importFrom(lubridate,is.POSIXct)
Expand All @@ -105,10 +112,14 @@ importFrom(methods,as)
importFrom(methods,callNextMethod)
importFrom(methods,extends)
importFrom(methods,formalArgs)
importFrom(methods,getMethod)
importFrom(methods,is)
importFrom(methods,new)
importFrom(methods,setClass)
importFrom(methods,show)
importFrom(methods,signature)
importFrom(methods,slot)
importFrom(numDeriv,hessian)
importFrom(optimx,"coef<-")
importFrom(optimx,optimx)
importFrom(stats,AIC)
Expand All @@ -122,10 +133,12 @@ importFrom(stats,model.frame)
importFrom(stats,model.matrix)
importFrom(stats,na.omit)
importFrom(stats,nobs)
importFrom(stats,pchisq)
importFrom(stats,pnorm)
importFrom(stats,predict)
importFrom(stats,printCoefmat)
importFrom(stats,qnorm)
importFrom(stats,quantile)
importFrom(stats,reformulate)
importFrom(stats,sd)
importFrom(stats,setNames)
Expand Down
28 changes: 28 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# CLVTools 0.11.0

### NEW FEATURES
* More memory efficient and faster creation of repeat transactions in `clv.data`
* Use existing repeat transactions when calling `gg` with `remove.first.transaction = TRUE`
* Simplify the formula interfaces `latentAttrition()` and `spending()`
* Add `predicted.total.spending` to predictions
* Harmonize parameter names used in various S3 methods
* Bootstrapping: Add facilities to estimate parameter uncertainty for all models
* Ability to predict future transactions of customers with no existing transaction history
* New start parameters for all latent attrition models
* Pareto/NBD dyncov: Improved numeric stability of PAlive
* GGomNBD: Implement erratum by Jost Adler to predict CET correctly
* GGomNBD: Improve numerical stability and runtime of LL integral
* GGomNBD: Implement PMF as derived by Jost Adler
* lrtest(): Likelihood ratio testing for latent attrition models
* Accept `data.table::IDate` as data inputs to `clvdata`
* `summary.clv.data`:Much faster by improving the calculation of the mean inter-purchase time
* Reduced fitting times for all models by using a compressed CBS as input to the LL sum
* Faster hessian calculation if a model was using correlation

### BUG FIXES
* Estimating the Pareto/NBD dyncov with correlation was not possible
* GGomNBD: Free workspace after it is not used anymore to avoid memory-leak
* `SetDynamicCovariates`: Verify there is no covariate data for nonexistent customers



# CLVTools 0.10.0

### NEW FEATURES
Expand Down
Loading

0 comments on commit af088c4

Please sign in to comment.