Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37768276
en ru br
Репозитории ALT

Группа :: Науки/Прочее
Пакет: python3-module-seaborn

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: seaborn-0.12.2-alt-statsmodels-0.14-fix.patch
Скачать


--- python3-module-seaborn/seaborn/regression.py.orig	2023-09-11 10:57:15.725198223 +0000
+++ python3-module-seaborn/seaborn/regression.py	2023-09-11 15:05:43.455450574 +0000
@@ -264,14 +264,20 @@ class _RegressionPlotter(_LinearPlotter)
 
     def fit_statsmodels(self, grid, model, **kwargs):
         """More general regression function using statsmodels objects."""
-        import statsmodels.genmod.generalized_linear_model as glm
+        import statsmodels.tools.sm_exceptions as sme
         X, y = np.c_[np.ones(len(self.x)), self.x], self.y
         grid = np.c_[np.ones(len(grid)), grid]
 
         def reg_func(_x, _y):
+            err_classes = (sme.PerfectSeparationError,)
             try:
-                yhat = model(_y, _x, **kwargs).fit().predict(grid)
-            except glm.PerfectSeparationError:
+                with warnings.catch_warnings():
+                    if hasattr(sme, "PerfectSeparationWarning"):
+                        # statsmodels>=0.14.0
+                        warnings.simplefilter("error", sme.PerfectSeparationWarning)
+                        err_classes = (*err_classes, sme.PerfectSeparationWarning)
+                    yhat = model(_y, _x, **kwargs).fit().predict(grid)
+            except err_classes:
                 yhat = np.empty(len(grid))
                 yhat.fill(np.nan)
             return yhat
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin