Skip to content

Commit

Permalink
fix sphinx docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Bernhardsson committed Mar 30, 2020
1 parent 2e82fc5 commit a7a33af
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 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
- pip install -U sphinx deprecated
- 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
8 changes: 5 additions & 3 deletions convoys/multi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from deprecated import deprecated
from deprecated.sphinx import deprecated
import numpy
from convoys import regression
from convoys import single
Expand Down Expand Up @@ -41,8 +41,9 @@ def predict(self, group, *args, **kwargs):
def rvs(self, group, *args, **kwargs):
return self.base_model.rvs(self._get_x(group), *args, **kwargs)

@deprecated(version='0.1.8', reason='Use the `predict` method instead')
@deprecated(version='0.1.8', reason='Has been renamed to :meth:`predict`')
def cdf(self, *args, **kwargs):
'''Returns the predicted values.'''
return self.predict(*args, **kwargs)


Expand All @@ -68,8 +69,9 @@ def fit(self, G, B, T):
def predict(self, group, t, *args, **kwargs):
return self._group2model[group].predict(t, *args, **kwargs)

@deprecated(version='0.1.8', reason='Use the `predict` method instead')
@deprecated(version='0.1.8', reason='Has been renamed to :meth:`predict`')
def cdf(self, *args, **kwargs):
'''Returns the predicted values.'''
return self.predict(*args, **kwargs)


Expand Down
12 changes: 6 additions & 6 deletions convoys/regression.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from convoys import autograd_scipy_monkeypatch # NOQA
import autograd
from autograd_gamma import gammainc
from deprecated import deprecated
from deprecated.sphinx import deprecated
import emcee
import numpy
from scipy.special import gammaincinv
Expand Down Expand Up @@ -311,8 +311,7 @@ def predict_posteriori(self, x, t, ci=None):

def predict(self, x, t, ci=None):
'''Returns the value of the cumulative distribution function
for a fitted model. TODO: this should probably be renamed
"predict" in the future to follow the scikit-learn convention.
for a fitted model.
:param x: feature vector (or matrix)
:param t: time
Expand Down Expand Up @@ -367,13 +366,14 @@ def rvs(self, x, n_curves=1, n_samples=1, T=None):

return B, C

@deprecated(version='0.1.8', reason='Use the `predict` method instead')
@deprecated(version='0.1.8', reason='Has been renamed to :meth:`predict`')
def cdf(self, *args, **kwargs):
'''Returns the predicted values.'''
return self.predict(*args, **kwargs)

@deprecated(version='0.1.8',
reason='Use the `predict_posteriori` method instead')
@deprecated(version='0.1.8', reason='Has been renamed to :meth:`predict`')
def cdf_posteriori(self, *args, **kwargs):
'''Returns the predicted values.'''
return self.predict_posteriori(*args, **kwargs)


Expand Down
6 changes: 4 additions & 2 deletions convoys/single.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from deprecated import deprecated
from deprecated.sphinx import deprecated
import numpy
from scipy.special import expit, logit
import scipy.stats
Expand Down Expand Up @@ -68,6 +68,7 @@ def _get_value_at(self, j, ci):
return 1 - self._ss[j]

def predict(self, t, ci=None):
'''Returns the predicted values.'''
t = numpy.array(t)
res = numpy.zeros(t.shape + (3,) if ci else t.shape)
for indexes, value in numpy.ndenumerate(t):
Expand All @@ -79,6 +80,7 @@ def predict(self, t, ci=None):
res[indexes] = self._get_value_at(j, ci)
return res

@deprecated(version='0.1.8', reason='Use the `predict` method instead')
@deprecated(version='0.1.8', reason='Has been renamed to :meth:`predict`')
def cdf(self, *args, **kwargs):
'''Returns the predicted values.'''
return self.predict(*args, **kwargs)

0 comments on commit a7a33af

Please sign in to comment.