Skip to content

Commit

Permalink
Merge pull request #95 from arrrrrmin/master
Browse files Browse the repository at this point in the history
Updates deprecated numpy conventions
  • Loading branch information
mdbartos authored Mar 15, 2023
2 parents 35d5daa + 7ab3d4f commit a287369
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rrcf/rrcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ def __init__(self, X=None, index_labels=None, precision=9,
X = U
else:
n, d = X.shape
N = np.ones(n, dtype=np.int)
N = np.ones(n, dtype=int)
I = None
# Store dimension of dataset
self.ndim = d
# Set node above to None in case of bottom-up search
self.u = None
# Create RRC Tree
S = np.ones(n, dtype=np.bool)
S = np.ones(n, dtype=bool)
self._mktree(X, S, N, I, parent=self)
# Remove parent of root
self.root.u = None
Expand Down Expand Up @@ -177,7 +177,7 @@ def _mktree(self, X, S, N, I, parent=None, side='root', depth=0):
# Otherwise...
else:
# Create a leaf node from isolated point
i = np.asscalar(np.flatnonzero(S1))
i = np.flatnonzero(S1).item()
leaf = Leaf(i=i, d=depth, u=branch, x=X[i, :], n=N[i])
# Link leaf node to parent
branch.l = leaf
Expand All @@ -199,7 +199,7 @@ def _mktree(self, X, S, N, I, parent=None, side='root', depth=0):
# Otherwise...
else:
# Create a leaf node from isolated point
i = np.asscalar(np.flatnonzero(S2))
i = np.flatnonzero(S2).item()
leaf = Leaf(i=i, d=depth, u=branch, x=X[i, :], n=N[i])
# Link leaf node to parent
branch.r = leaf
Expand Down Expand Up @@ -937,7 +937,7 @@ def _count_leaves(self, node):
"""
num_leaves = np.array(0, dtype=np.int64)
self.map_leaves(node, op=self._accumulate, accumulator=num_leaves)
num_leaves = np.asscalar(num_leaves)
num_leaves = num_leaves.item()
return num_leaves

def _query(self, point, node):
Expand Down

0 comments on commit a287369

Please sign in to comment.