Skip to content

Commit

Permalink
BF: make true division explicit for indices
Browse files Browse the repository at this point in the history
Use true division / math.ceil to find indices.
  • Loading branch information
matthew-brett committed Jan 26, 2017
1 parent a94a998 commit b148483
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions nipy/algorithms/clustering/hierarchical_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division

#---------------------------------------------------------------------------
# ------ Routines for Agglomerative Hierarchical Clustering ----------------
Expand Down
3 changes: 2 additions & 1 deletion nipy/algorithms/clustering/imm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division

import math

Expand Down Expand Up @@ -601,7 +602,7 @@ def cross_validated_update(self, x, z, plike, null_class_proba, kfold=10):
if np.isscalar(kfold):
aux = np.argsort(np.random.rand(n_samples))
idx = - np.ones(n_samples).astype(np.int)
j = np.ceil(n_samples / kfold)
j = int(math.ceil(n_samples / kfold))
kmax = kfold
for k in range(kmax):
idx[aux[k * j:min(n_samples, j * (k + 1))]] = k
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Author : Bertrand Thirion, 2008-2009
"""
from __future__ import absolute_import
from __future__ import absolute_import, division

import math

Expand Down

0 comments on commit b148483

Please sign in to comment.