From a753761675ae4a75fb88676bd2b9a6ab9fe4f36e Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Fri, 14 Oct 2022 20:08:01 +1100 Subject: [PATCH] Style fixups --- yli/__init__.py | 2 +- yli/bayes_factors.py | 4 +--- yli/distributions.py | 4 +--- yli/sig_tests.py | 6 ++---- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/yli/__init__.py b/yli/__init__.py index 3ce936f..e92de2e 100644 --- a/yli/__init__.py +++ b/yli/__init__.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from .bayes_factors import BayesFactor, bayesfactor_afbf +from .bayes_factors import bayesfactor_afbf from .distributions import beta_oddsratio, beta_ratio, hdi, transformed_dist from .fs import pickle_read_compressed, pickle_read_encrypted, pickle_write_compressed, pickle_write_encrypted from .regress import PenalisedLogit, regress, vif diff --git a/yli/bayes_factors.py b/yli/bayes_factors.py index c47ebdf..ed3cfa4 100644 --- a/yli/bayes_factors.py +++ b/yli/bayes_factors.py @@ -15,9 +15,7 @@ # along with this program. If not, see . class BayesFactor: - """ - A Bayes factor - """ + """A Bayes factor""" def __init__(self, factor, num_symbol, num_desc, denom_symbol, denom_desc): self.factor = factor diff --git a/yli/distributions.py b/yli/distributions.py index 0c8312a..8af37b3 100644 --- a/yli/distributions.py +++ b/yli/distributions.py @@ -284,9 +284,7 @@ transformed_dist = transformed_gen(name='transformed') ConfidenceInterval = collections.namedtuple('ConfidenceInterval', ['lower', 'upper']) def hdi(distribution, level=0.95): - """ - Get the highest density interval for the distribution, e.g. for a Bayesian posterior, the highest posterior density interval (HPD/HDI) - """ + """Get the highest density interval for the distribution, e.g. for a Bayesian posterior, the highest posterior density interval (HPD/HDI)""" # For a given lower limit, we can compute the corresponding 95% interval def interval_width(lower): diff --git a/yli/sig_tests.py b/yli/sig_tests.py index e6b12b2..dba9cd1 100644 --- a/yli/sig_tests.py +++ b/yli/sig_tests.py @@ -188,9 +188,7 @@ class PearsonChiSquaredResult: self.ct, self.dof, self.statistic, fmt_p(self.pvalue, html=False)) def chi2(df, dep, ind, *, nan_policy='warn'): - """ - Perform a Pearson chi-squared test - """ + """Perform a Pearson chi-squared test""" # Check for/clean NaNs df = check_nan(df[[ind, dep]], nan_policy) @@ -209,7 +207,7 @@ def chi2(df, dep, ind, *, nan_policy='warn'): if ct.shape == (2,2): # 2x2 table - # Use statsmodels to get OR andRR + # Use statsmodels to get OR and RR smct = sm.stats.Table2x2(np.flip(ct.to_numpy()), shift_zeros=False) result = smct.test_nominal_association()