Generalized linear regression models with network-regularization in R. Now with TensorFlow.


Modelling dependencies using linear regression models is often complicated when the analysed data-sets are high-dimensional and less observations than variables are available (n << p). netReg implements generalized linear models that utilize network penalties for regularization. Network regularization uses graphs or trees to incorporate information about interactions of covariables, or responses, into the loss function of a GLM. Ideally this allows better (i.e., lower variance) estimation of regression coefficients.

For instance, in R, you could fit a network-regularized model like that:

> library(netReg)

> X <- matrix(rnorm(100 * 10), 100)
> Y <- matrix(rnorm(100 * 10), 100)

> G.X <- abs(rWishart(1, 10, diag(10))[,,1])
> G.Y <- abs(rWishart(1, 10, diag(10))[,,1])

> fit <- edgenet(X, Y, G.X, G.Y)

> summary(fit)

#>edgenet(X = X, Y = Y, G.X = G.X, G.Y = G.Y)

#>lambda  psigx  psigy 
#>     1      1      1 

#>family:  gaussian
#>link:  identity 

#>-> call coef(x) for coefficients

From version v1.9.0 on, we use TensorFlow, instead of custom C++ and Dlib, for estimation of regression coefficients replacing a custom cyclic coordinate descent. This allowed deleting of major parts of the code base. netReg still uses some RcppArmadillo for some matrix algebra.

In order to estimate the optimal hyperparameters, i.e., the regularization parameters of the network models, we use Powell’s BOBYQA algorithm in a standard cross-validation framework.

For more details, please check out the respective vignettes of the single models.


Before installing the package, make sure to have these Python dependencies installed:

  • tensorflow>=2.2.0,
  • tensorflow-probabiltiy>=0.10.0

The easiest way is probably to install TensorFlow from R

install.packages(c("tensorflow", "tfprobability"))
tensorflow::install_tensorflow(extra_packages = "tensorflow-probability")

Then install netReg by downloading the latest release, for instance



  • Load the package using library(netReg). We provide vignettes for the package that can be called using: vignette(package="netReg").
  • You can also use the online vignette.


If netReg was useful for you or your work, it would be great if you cited it like this:

  title={netReg: network-regularized linear models for biological association studies},
  author={Dirmeier, Simon and Fuchs, Christiane and Mueller, Nikola S and Theis, Fabian J},
  publisher={Oxford University Press}


Simon Dirmeier <simon.dirmeier @>