Skip to content

ELBO Diverged During Optimization with PLNnetwork and Torch Backend #155

@EngineerDanny

Description

@EngineerDanny

Problem Description

When using PLNnetwork() with the torch backend on the barents dataset, I encounter an ELBO divergence error during the optimization procedure.

Error Message

Error in (function (data, params, config)  : 
  The ELBO diverged during the optimization procedure.
Consider using:
* a different optimizer (current optimizer: RPROP)
* a smaller learning rate (current rate: 0.100)
with `control = PLN_param(backend = 'torch', config_optim = list(algorithm = ..., lr = ...))`

Minimal Reproducible Example

library(PLNmodels)
library(data.table)
library(glmnet)
set.seed(1)
data("barents", package = "PLNmodels")
task.dt <- as.data.table(t(barents$Abundance))
Y <- as.matrix(task.dt)
sample_names <- paste0("s", seq_len(nrow(Y)))
rownames(Y) <- sample_names
prepared_data <- prepare_data(counts = Y, 
                              covariates = data.frame(row.names = sample_names))
input_cols <- colnames(Y)[1:(ncol(Y)-1)]
output_col <- colnames(Y)[ncol(Y)]
fit <- PLNnetwork(
  Abundance ~ 1,
  data    = prepared_data,
  penalties = 0.1, 
  control = PLNnetwork_param(
    backend = "torch"
  ) 
)

Environment Information

  • R version: 4.5.0 (2025-04-11)
  • Platform: aarch64-apple-darwin20
  • Operating System: macOS Sequoia 15.5
  • PLNmodels version: 1.2.2
  • torch version: 0.14.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions