Skip to content

Commit

Permalink
fix some tests and use initial conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Jan 7, 2020
1 parent 9145fbb commit ec73bd7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lifelines/fitters/piecewise_exponential_fitter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import autograd.numpy as np
from lifelines.fitters import KnownModelParametricUnivariateFitter
from lifelines import utils


class PiecewiseExponentialFitter(KnownModelParametricUnivariateFitter):
Expand Down Expand Up @@ -81,6 +82,7 @@ def __init__(self, breakpoints, *args, **kwargs):
super(PiecewiseExponentialFitter, self).__init__(*args, **kwargs)

def _cumulative_hazard(self, params, times):
times = np.atleast_1d(times)
n = times.shape[0]
times = times.reshape((n, 1))
bp = self.breakpoints
Expand Down
3 changes: 3 additions & 0 deletions lifelines/fitters/spline_fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ def __init__(self, knot_locations: np.ndarray, *args, **kwargs):
self._bounds = [(None, None)] * (self.n_knots)
super(SplineFitter, self).__init__(*args, **kwargs)

def _create_initial_point(self, Ts, E, entry, weights):
return 0.1 * np.ones(self.n_knots)

def _cumulative_hazard(self, params, t):
phis = params
lT = np.log(t)
Expand Down
2 changes: 1 addition & 1 deletion lifelines/tests/test_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __init__(self, *args, **kwargs):

class SplineFitterTesting(SplineFitter):
def __init__(self, *args, **kwargs):
super(SplineFitterTesting, self).__init__([0.0, 50.0], *args, **kwargs)
super(SplineFitterTesting, self).__init__([0.0, 40.0], *args, **kwargs)


class CustomRegressionModelTesting(ParametricRegressionFitter):
Expand Down

0 comments on commit ec73bd7

Please sign in to comment.