More tabs

This commit is contained in:
Raúl Marín 2019-12-19 17:48:38 +01:00
parent 30ac9af1f9
commit 1985c1273b
2 changed files with 8 additions and 8 deletions

View File

@ -49,7 +49,7 @@ def iwls(y, x, family, offset=1.0, ini_betas=None, tol=1.0e-8, max_iter=200, wi=
if isinstance(family, Binomial):
y = family.link._clean(y)
if isinstance(family, Poisson):
y_off = y/offset
y_off = y/offset
y_off = family.starting_mu(y_off)
v = family.predict(y_off)
mu = family.starting_mu(y)
@ -58,13 +58,13 @@ def iwls(y, x, family, offset=1.0, ini_betas=None, tol=1.0e-8, max_iter=200, wi=
v = family.predict(mu)
while diff > tol and n_iter < max_iter:
n_iter += 1
n_iter += 1
w = family.weights(mu)
z = v + (family.link.deriv(mu)*(y-mu))
w = np.sqrt(w)
if type(x) != np.ndarray:
w = sp.csr_matrix(w)
z = sp.csr_matrix(z)
w = sp.csr_matrix(w)
z = sp.csr_matrix(z)
wx = spmultiply(x, w, array_out=False)
wz = spmultiply(z, w, array_out=False)
if wi is None:

View File

@ -47,8 +47,8 @@ def golden_section(a, c, delta, function, tol, max_iter, int_score=False):
while np.abs(diff) > tol and iters < max_iter:
iters += 1
if int_score:
b = np.round(b)
d = np.round(d)
b = np.round(b)
d = np.round(d)
score_a = function(a)
score_b = function(b)
@ -73,7 +73,7 @@ def golden_section(a, c, delta, function, tol, max_iter, int_score=False):
#d = np.round(b)
#if int_score:
# opt_val = np.round(opt_val)
# opt_val = np.round(opt_val)
output.append((opt_val, opt_score))
diff = score_b - score_d
score = opt_score