Skip to content

Commit

Permalink
Merge 86d4864 into 0eef63a
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbern committed Mar 31, 2020
2 parents 0eef63a + 86d4864 commit 9c4ea6c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ python:
- "3.6"
- "3.7"
script:
- pip install -U sphinx deprecated
- pip install -U sphinx
- sphinx-build -M html docs/ docs/_build/ -W # Try building it before installing the rest, should work
- pip install -U coveralls flaky pytest pytest-cov
- pip install .
Expand Down
19 changes: 4 additions & 15 deletions convoys/multi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from deprecated.sphinx import deprecated
import numpy
from convoys import regression
from convoys import single
Expand Down Expand Up @@ -44,14 +43,9 @@ def predict_ci(self, group, t, ci):
def rvs(self, group, *args, **kwargs):
return self.base_model.rvs(self._get_x(group), *args, **kwargs)

@deprecated(version='0.2.0',
reason='Use :meth:`predict` or :meth:`predict_ci` instead.')
def cdf(self, group, t, ci=None):
'''Returns the predicted values.'''
if ci is not None:
return self.predict_ci(group, t, ci)
else:
return self.predict(group, t)
raise Exception('This method has been removed in 0.3.0. '
'Use `predict` or `predict_ci`.')


class SingleToMulti(MultiModel):
Expand Down Expand Up @@ -79,14 +73,9 @@ def predict(self, group, t):
def predict_ci(self, group, t, ci):
return self._group2model[group].predict_ci(t, ci)

@deprecated(version='0.2.0',
reason='Use :meth:`predict` or :meth:`predict_ci` instead')
def cdf(self, group, t, ci=None):
'''Returns the predicted values.'''
if ci is not None:
return self.predict_ci(group, t, ci)
else:
return self.predict(group, t)
raise Exception('This method has been removed in 0.3.0. '
'Use `predict` or `predict_ci`.')


class Exponential(RegressionToMulti):
Expand Down
16 changes: 4 additions & 12 deletions convoys/regression.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from convoys import autograd_scipy_monkeypatch # NOQA
import autograd
from autograd_gamma import gammainc
from deprecated.sphinx import deprecated
import emcee
import numpy
from scipy.special import gammaincinv
Expand Down Expand Up @@ -362,20 +361,13 @@ def rvs(self, x, n_curves=1, n_samples=1, T=None):

return B, C

@deprecated(version='0.2.0',
reason='Use :meth:`predict` or :meth:`predict_ci` instead.')
def cdf(self, x, t, ci=False):
'''Returns the predicted values.'''
if ci:
return self.predict_ci(x, t)
else:
return self.predict(x, t)
raise Exception('This method has been removed in 0.3.0. '
'Use `predict` or `predict_ci`.')

@deprecated(version='0.2.0',
reason='Use :meth:`predict_posteriori` instead.')
def cdf_posteriori(self, x, t):
'''Returns the a posterior distribution of the predicted values.'''
return self.predict_posteriori(x, t)
raise Exception('This method has been removed in 0.3.0. '
'Use `predict_posteriori`.')


class Exponential(GeneralizedGamma):
Expand Down
10 changes: 2 additions & 8 deletions convoys/single.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from deprecated.sphinx import deprecated
import numpy
from scipy.special import expit, logit
import scipy.stats
Expand Down Expand Up @@ -87,11 +86,6 @@ def predict_ci(self, t, ci=0.8):
)
return res

@deprecated(version='0.2.0',
reason='Use :meth:`predict` or :meth:`predict_ci` instead.')
def cdf(self, t, ci=None):
'''Returns the predicted values.'''
if ci is not None:
return self.predict_ci(t)
else:
return self.predict(t)
raise Exception('This method has been removed in 0.3.0. '
'Use `predict` or `predict_ci`.')
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'''

setup(name='convoys',
version='0.2.0',
version='0.3.0',
description='Fit machine learning models to predict conversion using Weibull and Gamma distributions',
long_description=long_description,
url='https://better.engineering/convoys',
Expand All @@ -21,7 +21,6 @@
install_requires=[
'autograd',
'autograd-gamma>=0.2.0',
'deprecated',
'emcee>=3.0.0',
'matplotlib>=2.0.0',
'pandas>=0.24.0',
Expand Down
4 changes: 0 additions & 4 deletions test_convoys.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ def test_output_shapes(c=0.3, lambd=0.1, n=1000, k=5):
assert model.predict_ci([[X[0]], [X[1]]], [[0, 1, 2]], ci=0.8) \
.shape == (2, 3, 3)

# Assert old interface still works
assert model.cdf(X[0], 0).shape == ()
assert model.cdf(X[0], 0, ci=0.8).shape == (3,)

# Fit model without ci (should be the same)
model = convoys.regression.Exponential(ci=False)
model.fit(X, B, T)
Expand Down

0 comments on commit 9c4ea6c

Please sign in to comment.