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

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Mar 8, 2019
1 parent 960446b commit e628592
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 60 deletions.
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ python:
- "3.5"
- "3.6"
env:
- export PANDAS_VERSION=0.21.1
- export PANDAS_VERSION=0.22.0
- export PANDAS_VERSION=0.23.4
- export PANDAS_VERSION=0.24.1
# Enable newer 3.7 without globally enabling sudo and dist: xenial for other build jobs
matrix:
Expand All @@ -17,10 +14,6 @@ matrix:
dist: xenial
sudo: true
env: export PANDAS_VERSION=0.24.1
- python: 3.7
dist: xenial
sudo: true
env: export PANDAS_VERSION=0.23.4
before_install:
- ls
install:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 0.11.1
- bump the Pandas requirements to >= 0.24.0. This should have been done in 0.11.0
- suppress some warnings from autograd.

### 0.11.0
- 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).
- `GammaGammaFitter`, `BetaGeoFitter`, `ModifiedBetaGeoFitter` and `BetaGeoBetaBinomFitter` have three new attributes: `confidence_interval_`, `variance_matrix_` and `standard_errors_`
Expand Down
19 changes: 14 additions & 5 deletions docs/Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

0.11.1
~~~~~~

- bump the Pandas requirements to >= 0.24.0. This should have been done
in 0.11.0
- suppress some warnings from autograd.

.. _section-1:

0.11.0
~~~~~~

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

.. _section-1:
.. _section-2:

0.10.1
~~~~~~
Expand All @@ -38,7 +47,7 @@ Changelog
- Stop support of scipy < 1.0.
- Stop support of < Python 3.5.

.. _section-2:
.. _section-3:

0.10.0
~~~~~~
Expand All @@ -57,7 +66,7 @@ Changelog
used to reduce the size of the data (collapsing subjects with the
same recency, frequency, T).

.. _section-3:
.. _section-4:

0.9.1
~~~~~
Expand All @@ -74,7 +83,7 @@ Changelog
difference in values compared to ``summary_from_transaction_data``.
@DaniGate

.. _section-4:
.. _section-5:

0.9.0
~~~~~
Expand All @@ -86,7 +95,7 @@ Changelog
- Fixed a bug in ``expected_cumulative_transactions`` and
``plot_cumulative_transactions``

.. _section-5:
.. _section-6:

0.8.1
~~~~~
Expand Down
70 changes: 33 additions & 37 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@
# sys.path.insert(0, os.path.abspath('.'))

import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# Convert package README.md to intro.rst to include in index.rst for docs
try:
import pypandoc
long_description = pypandoc.convert_file('../README.md', 'rst',
outputfile='intro.rst')
except(ImportError):
print('Install pypandoc to convert README.md to intro.rst')

long_description = pypandoc.convert_file("../README.md", "rst", outputfile="intro.rst")
except (ImportError):
print("Install pypandoc to convert README.md to intro.rst")


# -- General configuration ------------------------------------------------
Expand All @@ -44,40 +45,38 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.napoleon'
"sphinx.ext.autodoc",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# for parsing markdown files
source_parsers = {
'.md': 'recommonmark.parser.CommonMarkParser',
}
source_parsers = {".md": "recommonmark.parser.CommonMarkParser"}

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = ['.rst', '.md']
source_suffix = [".rst", ".md"]

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'lifetimes'
copyright = '2015, Cameron Davidson-Pilon'
author = 'Cameron Davidson-Pilon'
project = "lifetimes"
copyright = "2015, Cameron Davidson-Pilon"
author = "Cameron Davidson-Pilon"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.11.0'
version = "0.11.1"
# The full version, including alpha/beta/rc tags.
release = version

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

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

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

# -- Napoleon settings ----------------------------------------------------
napoleon_google_docstring = True
Expand All @@ -137,7 +136,7 @@
# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'lifetimesdoc'
htmlhelp_basename = "lifetimesdoc"


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -146,15 +145,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -163,20 +159,14 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'lifetimes.tex', 'lifetimes Documentation',
'Cameron Davidson-Pilon', 'manual'),
]
latex_documents = [(master_doc, "lifetimes.tex", "lifetimes Documentation", "Cameron Davidson-Pilon", "manual")]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'lifetimes', 'lifetimes Documentation',
[author], 1)
]
man_pages = [(master_doc, "lifetimes", "lifetimes Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -185,7 +175,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'lifetimes', 'lifetimes Documentation',
author, 'lifetimes', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"lifetimes",
"lifetimes Documentation",
author,
"lifetimes",
"One line description of project.",
"Miscellaneous",
)
]
3 changes: 3 additions & 0 deletions lifetimes/fitters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
"""Base fitter for other classes."""
import warnings

warnings.simplefilter(action="ignore", category=FutureWarning)
import dill
import numpy as np
import pandas as pd
Expand Down
5 changes: 5 additions & 0 deletions lifetimes/fitters/beta_geo_beta_binom_fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"""Beta Geo Beta BinomFitter."""
from __future__ import division
from __future__ import print_function
import warnings

warnings.simplefilter(action="ignore", category=FutureWarning)

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -62,6 +65,8 @@ def __init__(self, penalizer_coef=0.0):

@staticmethod
def _loglikelihood(params, x, tx, T):
warnings.simplefilter(action="ignore", category=FutureWarning)

"""Log likelihood for optimizer."""
alpha, beta, gamma, delta = params

Expand Down
3 changes: 3 additions & 0 deletions lifetimes/fitters/beta_geo_fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Beta Geo Fitter, also known as BG/NBD model."""
from __future__ import print_function
from __future__ import division
import warnings

import pandas as pd
import autograd.numpy as np
Expand Down Expand Up @@ -146,6 +147,8 @@ def fit(

@staticmethod
def _negative_log_likelihood(log_params, freq, rec, T, weights, penalizer_coef):
warnings.simplefilter(action="ignore", category=FutureWarning)

params = np.exp(log_params)
r, alpha, a, b = params

Expand Down
2 changes: 2 additions & 0 deletions lifetimes/fitters/gamma_gamma_fitter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
import warnings

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

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

params = np.exp(log_params)
p, q, v = params
Expand Down
3 changes: 3 additions & 0 deletions lifetimes/fitters/modified_beta_geo_fitter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
import warnings

import autograd.numpy as np
from autograd.numpy import log, logaddexp
Expand Down Expand Up @@ -113,6 +114,8 @@ def fit(

@staticmethod
def _negative_log_likelihood(log_params, freq, rec, T, weights, penalizer_coef):
warnings.simplefilter(action="ignore", category=FutureWarning)

params = np.exp(log_params)
r, alpha, a, b = params

Expand Down
4 changes: 4 additions & 0 deletions lifetimes/generate_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# -*- coding: utf-8 -*-
import warnings

warnings.simplefilter(action="ignore", category=FutureWarning)
import numpy as np
from numpy import random
import pandas as pd
Expand Down
11 changes: 2 additions & 9 deletions lifetimes/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
"""Lifetimes utils and helpers."""
from __future__ import division

import numpy as np
import pandas as pd
import dill
Expand Down Expand Up @@ -123,10 +122,7 @@ def to_period(d):
combined_data = calibration_summary_data.join(holdout_summary_data, how="left")
combined_data.fillna(0, inplace=True)

try:
delta_time = (to_period(observation_period_end) - to_period(calibration_period_end)).n
except AttributeError:
delta_time = to_period(observation_period_end) - to_period(calibration_period_end)
delta_time = (to_period(observation_period_end) - to_period(calibration_period_end)).n
combined_data["duration_holdout"] = delta_time

return combined_data
Expand Down Expand Up @@ -515,10 +511,7 @@ def expected_cumulative_transactions(
first_trans_size = first_transactions.groupby(datetime_col).size()
for i, period in enumerate(date_periods):
if i % freq_multiplier == 0 and i > 0:
try:
times = np.array([d.n for d in period - first_trans_size.index])
except AttributeError:
times = period - first_trans_size.index
times = np.array([d.n for d in period - first_trans_size.index])
times = times[times > 0].astype(float) / freq_multiplier
expected_trans_agg = model.expected_number_of_purchases_up_to_time(times)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
numpy>1.10.0
scipy>=1.0.0
pandas>=0.21.1
pandas>=0.24.0
dill>=0.2.6
autograd>=1.2.0
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup

Expand Down Expand Up @@ -32,7 +33,7 @@
"Programming Language :: Python :: 3.5",
"Topic :: Scientific/Engineering",
],
install_requires=["numpy>=1.10.0", "scipy>=1.0.0", "pandas>=0.21.1", "autograd>=1.2.0", "dill>=0.2.6"],
install_requires=["numpy>=1.10.0", "scipy>=1.0.0", "pandas>=0.24.0", "autograd>=1.2.0", "dill>=0.2.6"],
package_data={
"lifetimes": ["datasets/*", "../README.md", "../README.txt", "../LICENSE", "../MANIFEST.in", "fitters/*"]
},
Expand Down

0 comments on commit e628592

Please sign in to comment.