Skip to content

Commit 3b9bb59

Browse files
ArifAhmed1995tmylk
authored andcommitted
Rectify PR#950 to follow PEP8 (#966)
1 parent b5a2b58 commit 3b9bb59

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gensim/matutils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def ret_normalized_vec(vec, length):
326326
else:
327327
return list(vec)
328328

329-
def ret_log_normalize_vec(vec, axis = 1):
329+
def ret_log_normalize_vec(vec, axis=1):
330330
log_max = 100.0
331331
if len(vec.shape) == 1:
332332
max_val = numpy.max(vec)
@@ -335,17 +335,17 @@ def ret_log_normalize_vec(vec, axis = 1):
335335
log_norm = numpy.log(tot) - log_shift
336336
vec = vec - log_norm
337337
else:
338-
if axis == 1:#independently normalize each sample
338+
if axis == 1: # independently normalize each sample
339339
max_val = numpy.max(vec, 1)
340340
log_shift = log_max - numpy.log(vec.shape[1] + 1.0) - max_val
341341
tot = numpy.sum(numpy.exp(vec + log_shift[:, numpy.newaxis]), 1)
342342
log_norm = numpy.log(tot) - log_shift
343343
vec = vec - log_norm[:, numpy.newaxis]
344-
elif axis == 0:#normalize each feature
344+
elif axis == 0: # normalize each feature
345345
k = ret_log_normalize_vec(vec.T)
346346
return (k[0].T, k[1])
347347
else:
348-
raise ValueError("'%d' is not a supported axis" % axis)
348+
raise ValueError("'%s' is not a supported axis" % axis)
349349
return (vec, log_norm)
350350

351351

0 commit comments

Comments
 (0)