Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 3e93e80

Browse files
Merge pull request #254 from CamDavidsonPilon/pandas-check
v0.11.1
2 parents 91e184e + 74c076b commit 3e93e80

16 files changed

Lines changed: 87 additions & 54 deletions

.travis.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ python:
66
- "3.5"
77
- "3.6"
88
env:
9-
- export PANDAS_VERSION=0.21.1
10-
- export PANDAS_VERSION=0.22.0
11-
- export PANDAS_VERSION=0.23.4
129
- export PANDAS_VERSION=0.24.1
1310
# Enable newer 3.7 without globally enabling sudo and dist: xenial for other build jobs
1411
matrix:
@@ -17,14 +14,11 @@ matrix:
1714
dist: xenial
1815
sudo: true
1916
env: export PANDAS_VERSION=0.24.1
20-
- python: 3.7
21-
dist: xenial
22-
sudo: true
23-
env: export PANDAS_VERSION=0.23.4
2417
before_install:
2518
- ls
2619
install:
2720
- "pip install -r dev_requirements.txt"
21+
- "pip install pandas==$PANDAS_VERSION"
2822
# command to run tests
2923
script:
3024
- py.test --cov lifetimes

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### 0.11.1
4+
- bump the Pandas requirements to >= 0.24.0. This should have been done in 0.11.0
5+
- suppress some warnings from autograd.
6+
37
### 0.11.0
48
- Move most models (all but Pareto) to autograd for automatic differentiation of their likelihood. This results in faster (at least 3x) and more successful convergence, plus allows for some really exciting extensions (coming soon).
59
- `GammaGammaFitter`, `BetaGeoFitter`, `ModifiedBetaGeoFitter` and `BetaGeoBetaBinomFitter` have three new attributes: `confidence_interval_`, `variance_matrix_` and `standard_errors_`

docs/Changelog.rst

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
22
=========
33

4+
0.11.1
5+
~~~~~~
6+
7+
- bump the Pandas requirements to >= 0.24.0. This should have been done
8+
in 0.11.0
9+
- suppress some warnings from autograd.
10+
11+
.. _section-1:
12+
413
0.11.0
514
~~~~~~
615

@@ -20,7 +29,7 @@ Changelog
2029
- fixed a bug that was causing ``ParetoNBDFitter`` to generate data
2130
incorrectly.
2231

23-
.. _section-1:
32+
.. _section-2:
2433

2534
0.10.1
2635
~~~~~~
@@ -38,7 +47,7 @@ Changelog
3847
- Stop support of scipy < 1.0.
3948
- Stop support of < Python 3.5.
4049

41-
.. _section-2:
50+
.. _section-3:
4251

4352
0.10.0
4453
~~~~~~
@@ -57,7 +66,7 @@ Changelog
5766
used to reduce the size of the data (collapsing subjects with the
5867
same recency, frequency, T).
5968

60-
.. _section-3:
69+
.. _section-4:
6170

6271
0.9.1
6372
~~~~~
@@ -74,7 +83,7 @@ Changelog
7483
difference in values compared to ``summary_from_transaction_data``.
7584
@DaniGate
7685

77-
.. _section-4:
86+
.. _section-5:
7887

7988
0.9.0
8089
~~~~~
@@ -86,7 +95,7 @@ Changelog
8695
- Fixed a bug in ``expected_cumulative_transactions`` and
8796
``plot_cumulative_transactions``
8897

89-
.. _section-5:
98+
.. _section-6:
9099

91100
0.8.1
92101
~~~~~

docs/Quickstart.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ print(bgf)
4141
"""
4242
<lifetimes.BetaGeoFitter: fitted with 2357 subjects, a: 0.79, alpha: 4.41, b: 2.43, r: 0.24>
4343
"""
44+
45+
bgf.summary
46+
"""
47+
coef se(coef) lower 95% bound upper 95% bound
48+
r 0.242593 0.012557 0.217981 0.267205
49+
alpha 4.413532 0.378221 3.672218 5.154846
50+
a 0.792886 0.185719 0.428877 1.156895
51+
b 2.425752 0.705345 1.043276 3.808229
52+
"""
4453
```
4554

4655
After fitting, we have lots of nice methods and properties attached to the fitter object, like ``param_`` and ``summary``.

docs/conf.py

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@
2222
# sys.path.insert(0, os.path.abspath('.'))
2323

2424
import sphinx_rtd_theme
25+
2526
html_theme = "sphinx_rtd_theme"
2627
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
2728

2829
# Convert package README.md to intro.rst to include in index.rst for docs
2930
try:
3031
import pypandoc
31-
long_description = pypandoc.convert_file('../README.md', 'rst',
32-
outputfile='intro.rst')
33-
except(ImportError):
34-
print('Install pypandoc to convert README.md to intro.rst')
32+
33+
long_description = pypandoc.convert_file("../README.md", "rst", outputfile="intro.rst")
34+
except (ImportError):
35+
print("Install pypandoc to convert README.md to intro.rst")
3536

3637

3738
# -- General configuration ------------------------------------------------
@@ -44,40 +45,38 @@
4445
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4546
# ones.
4647
extensions = [
47-
'sphinx.ext.autodoc',
48-
'sphinx.ext.todo',
49-
'sphinx.ext.coverage',
50-
'sphinx.ext.mathjax',
51-
'sphinx.ext.napoleon'
48+
"sphinx.ext.autodoc",
49+
"sphinx.ext.todo",
50+
"sphinx.ext.coverage",
51+
"sphinx.ext.mathjax",
52+
"sphinx.ext.napoleon",
5253
]
5354

5455
# Add any paths that contain templates here, relative to this directory.
55-
templates_path = ['_templates']
56+
templates_path = ["_templates"]
5657

5758
# for parsing markdown files
58-
source_parsers = {
59-
'.md': 'recommonmark.parser.CommonMarkParser',
60-
}
59+
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}
6160

6261
# The suffix(es) of source filenames.
6362
# You can specify multiple suffix as a list of string:
6463
#
65-
source_suffix = ['.rst', '.md']
64+
source_suffix = [".rst", ".md"]
6665

6766
# The master toctree document.
68-
master_doc = 'index'
67+
master_doc = "index"
6968

7069
# General information about the project.
71-
project = 'lifetimes'
72-
copyright = '2015, Cameron Davidson-Pilon'
73-
author = 'Cameron Davidson-Pilon'
70+
project = "lifetimes"
71+
copyright = "2015, Cameron Davidson-Pilon"
72+
author = "Cameron Davidson-Pilon"
7473

7574
# The version info for the project you're documenting, acts as replacement for
7675
# |version| and |release|, also used in various other places throughout the
7776
# built documents.
7877
#
7978
# The short X.Y version.
80-
version = '0.11.0'
79+
version = "0.11.1"
8180
# The full version, including alpha/beta/rc tags.
8281
release = version
8382

@@ -91,10 +90,10 @@
9190
# List of patterns, relative to source directory, that match files and
9291
# directories to ignore when looking for source files.
9392
# This patterns also effect to html_static_path and html_extra_path
94-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
93+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
9594

9695
# The name of the Pygments (syntax highlighting) style to use.
97-
pygments_style = 'sphinx'
96+
pygments_style = "sphinx"
9897

9998
# If true, `todo` and `todoList` produce output, else they produce nothing.
10099
todo_include_todos = True
@@ -117,7 +116,7 @@
117116
# Add any paths that contain custom static files (such as style sheets) here,
118117
# relative to this directory. They are copied after the builtin static files,
119118
# so a file named "default.css" will overwrite the builtin "default.css".
120-
html_static_path = ['_static']
119+
html_static_path = ["_static"]
121120

122121
# -- Napoleon settings ----------------------------------------------------
123122
napoleon_google_docstring = True
@@ -137,7 +136,7 @@
137136
# -- Options for HTMLHelp output ------------------------------------------
138137

139138
# Output file base name for HTML help builder.
140-
htmlhelp_basename = 'lifetimesdoc'
139+
htmlhelp_basename = "lifetimesdoc"
141140

142141

143142
# -- Options for LaTeX output ---------------------------------------------
@@ -146,15 +145,12 @@
146145
# The paper size ('letterpaper' or 'a4paper').
147146
#
148147
# 'papersize': 'letterpaper',
149-
150148
# The font size ('10pt', '11pt' or '12pt').
151149
#
152150
# 'pointsize': '10pt',
153-
154151
# Additional stuff for the LaTeX preamble.
155152
#
156153
# 'preamble': '',
157-
158154
# Latex figure (float) alignment
159155
#
160156
# 'figure_align': 'htbp',
@@ -163,20 +159,14 @@
163159
# Grouping the document tree into LaTeX files. List of tuples
164160
# (source start file, target name, title,
165161
# author, documentclass [howto, manual, or own class]).
166-
latex_documents = [
167-
(master_doc, 'lifetimes.tex', 'lifetimes Documentation',
168-
'Cameron Davidson-Pilon', 'manual'),
169-
]
162+
latex_documents = [(master_doc, "lifetimes.tex", "lifetimes Documentation", "Cameron Davidson-Pilon", "manual")]
170163

171164

172165
# -- Options for manual page output ---------------------------------------
173166

174167
# One entry per manual page. List of tuples
175168
# (source start file, name, description, authors, manual section).
176-
man_pages = [
177-
(master_doc, 'lifetimes', 'lifetimes Documentation',
178-
[author], 1)
179-
]
169+
man_pages = [(master_doc, "lifetimes", "lifetimes Documentation", [author], 1)]
180170

181171

182172
# -- Options for Texinfo output -------------------------------------------
@@ -185,7 +175,13 @@
185175
# (source start file, target name, title, author,
186176
# dir menu entry, description, category)
187177
texinfo_documents = [
188-
(master_doc, 'lifetimes', 'lifetimes Documentation',
189-
author, 'lifetimes', 'One line description of project.',
190-
'Miscellaneous'),
178+
(
179+
master_doc,
180+
"lifetimes",
181+
"lifetimes Documentation",
182+
author,
183+
"lifetimes",
184+
"One line description of project.",
185+
"Miscellaneous",
186+
)
191187
]

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Quickstart
1313
Saving and loading model
1414
More examples and recipes
15+
lifetimes
1516
Changelog
1617

1718

lifetimes/fitters/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# -*- coding: utf-8 -*-
22
"""Base fitter for other classes."""
3+
import warnings
4+
5+
warnings.simplefilter(action="ignore", category=FutureWarning)
36
import dill
47
import numpy as np
58
import pandas as pd

lifetimes/fitters/beta_geo_beta_binom_fitter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"""Beta Geo Beta BinomFitter."""
33
from __future__ import division
44
from __future__ import print_function
5+
import warnings
6+
7+
warnings.simplefilter(action="ignore", category=FutureWarning)
58

69
import numpy as np
710
import pandas as pd
@@ -62,6 +65,8 @@ def __init__(self, penalizer_coef=0.0):
6265

6366
@staticmethod
6467
def _loglikelihood(params, x, tx, T):
68+
warnings.simplefilter(action="ignore", category=FutureWarning)
69+
6570
"""Log likelihood for optimizer."""
6671
alpha, beta, gamma, delta = params
6772

lifetimes/fitters/beta_geo_fitter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""Beta Geo Fitter, also known as BG/NBD model."""
33
from __future__ import print_function
44
from __future__ import division
5+
import warnings
56

67
import pandas as pd
78
import autograd.numpy as np
@@ -146,6 +147,8 @@ def fit(
146147

147148
@staticmethod
148149
def _negative_log_likelihood(log_params, freq, rec, T, weights, penalizer_coef):
150+
warnings.simplefilter(action="ignore", category=FutureWarning)
151+
149152
params = np.exp(log_params)
150153
r, alpha, a, b = params
151154

lifetimes/fitters/gamma_gamma_fitter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import print_function
33
from __future__ import division
4+
import warnings
45

56
import pandas as pd
67
from autograd import numpy as np
@@ -68,6 +69,7 @@ def __init__(self, penalizer_coef=0.0):
6869

6970
@staticmethod
7071
def _negative_log_likelihood(log_params, frequency, avg_monetary_value, weights, penalizer_coef):
72+
warnings.simplefilter(action="ignore", category=FutureWarning)
7173

7274
params = np.exp(log_params)
7375
p, q, v = params

0 commit comments

Comments
 (0)