From 62801bfe2828ba65030657b12cf36d0f3666c414 Mon Sep 17 00:00:00 2001
From: bastien-mva <bastien.batardiere@gmail.com>
Date: Tue, 4 Jun 2024 19:21:50 +0200
Subject: [PATCH 1/3] do not divide by the running times anymore when computing
 the derivative     of the criterion.

---
 pyPLNmodels/_utils.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/pyPLNmodels/_utils.py b/pyPLNmodels/_utils.py
index 98ca47db..57315497 100644
--- a/pyPLNmodels/_utils.py
+++ b/pyPLNmodels/_utils.py
@@ -59,7 +59,6 @@ class _CriterionArgs:
         if self.iteration_number > 1:
             current_derivative = np.abs(
                 (self.normalized_elbo_list[-2] - self.normalized_elbo_list[-1])
-                / (self.running_times[-2] - self.running_times[-1])
             )
             old_derivative = self.new_derivative
             self.new_derivative = (
-- 
GitLab


From 89bdbfd87f30eb1a92b1d37013d8ce8363b3b38c Mon Sep 17 00:00:00 2001
From: bastien-mva <bastien.batardiere@gmail.com>
Date: Tue, 4 Jun 2024 19:32:53 +0200
Subject: [PATCH 2/3] change tolerance to 1e-4.

---
 pyPLNmodels/models.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/pyPLNmodels/models.py b/pyPLNmodels/models.py
index 85089bad..5570c395 100644
--- a/pyPLNmodels/models.py
+++ b/pyPLNmodels/models.py
@@ -404,7 +404,7 @@ class _model(ABC):
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-3,
+        tol: float = 1e-4,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
@@ -418,7 +418,7 @@ class _model(ABC):
         lr : float, optional(keyword-only)
             The learning rate. Defaults to 0.01.
         tol : float, optional(keyword-only)
-            The tolerance for convergence. Defaults to 1e-8.
+            The tolerance for convergence. Defaults to 1e-4.
         do_smart_init : bool, optional(keyword-only)
             Whether to perform smart initialization. Defaults to True.
         verbose : bool, optional(keyword-only)
@@ -1669,7 +1669,7 @@ class Pln(_model):
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-3,
+        tol: float = 1e-4,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
@@ -2494,7 +2494,7 @@ class PlnPCAcollection:
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-3,
+        tol: float = 1e-4,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
@@ -2508,7 +2508,7 @@ class PlnPCAcollection:
         lr : float, optional(keyword-only)
             The learning rate, by default 0.01.
         tol : float, optional(keyword-only)
-            The tolerance, by default 1e-8.
+            The tolerance, by default 1e-4.
         do_smart_init : bool, optional(keyword-only)
             Whether to do smart initialization, by default True.
         verbose : bool, optional(keyword-only)
@@ -3024,7 +3024,7 @@ class PlnPCA(_model):
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-3,
+        tol: float = 1e-4,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
@@ -3808,7 +3808,7 @@ class ZIPln(_model):
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-3,
+        tol: float = 1e-4,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
-- 
GitLab


From 3a5cac9bdddcb91c0f47b70afe9d7eed33303930 Mon Sep 17 00:00:00 2001
From: bastien-mva <bastien.batardiere@gmail.com>
Date: Wed, 5 Jun 2024 08:39:56 +0200
Subject: [PATCH 3/3] change tolerance from 1e-4 to 1e-5.

---
 pyPLNmodels/models.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/pyPLNmodels/models.py b/pyPLNmodels/models.py
index 5570c395..a8deabcc 100644
--- a/pyPLNmodels/models.py
+++ b/pyPLNmodels/models.py
@@ -404,7 +404,7 @@ class _model(ABC):
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-4,
+        tol: float = 1e-5,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
@@ -418,7 +418,7 @@ class _model(ABC):
         lr : float, optional(keyword-only)
             The learning rate. Defaults to 0.01.
         tol : float, optional(keyword-only)
-            The tolerance for convergence. Defaults to 1e-4.
+            The tolerance for convergence. Defaults to 1e-5.
         do_smart_init : bool, optional(keyword-only)
             Whether to perform smart initialization. Defaults to True.
         verbose : bool, optional(keyword-only)
@@ -1669,7 +1669,7 @@ class Pln(_model):
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-4,
+        tol: float = 1e-5,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
@@ -2494,7 +2494,7 @@ class PlnPCAcollection:
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-4,
+        tol: float = 1e-5,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
@@ -2508,7 +2508,7 @@ class PlnPCAcollection:
         lr : float, optional(keyword-only)
             The learning rate, by default 0.01.
         tol : float, optional(keyword-only)
-            The tolerance, by default 1e-4.
+            The tolerance, by default 1e-5.
         do_smart_init : bool, optional(keyword-only)
             Whether to do smart initialization, by default True.
         verbose : bool, optional(keyword-only)
@@ -3024,7 +3024,7 @@ class PlnPCA(_model):
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-4,
+        tol: float = 1e-5,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
@@ -3808,7 +3808,7 @@ class ZIPln(_model):
         nb_max_epoch: int = 400,
         *,
         lr: float = 0.01,
-        tol: float = 1e-4,
+        tol: float = 1e-5,
         do_smart_init: bool = True,
         verbose: bool = False,
     ):
-- 
GitLab