Skip to content

Commit

Permalink
small perf, helps with CamDavidsonPilon#271
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Dec 31, 2016
1 parent 84057da commit 79f01fc
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lifelines/fitters/coxph_fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _get_efron_values(self, X, beta, T, E, include_likelihood=False):
# Calculate phi values
phi_i = exp(dot(xi, beta))
phi_x_i = dot(phi_i, xi)
phi_x_x_i = dot(xi.T, xi) * phi_i
phi_x_x_i = dot(xi.T, phi_i * xi)

# Calculate sums of Risk set
risk_phi += phi_i
Expand Down Expand Up @@ -121,10 +121,6 @@ def _get_efron_values(self, X, beta, T, E, include_likelihood=False):
denom = (risk_phi - c * tie_phi)
z = (risk_phi_x - c * tie_phi_x)

if denom == 0:
# Can't divide by zero
raise ValueError("Denominator was zero")

# Gradient
partial_gradient += z / denom
# Hessian
Expand Down

0 comments on commit 79f01fc

Please sign in to comment.