fixing PEP8 issues throughout
@@ -14,6 +14,7 @@ import umap.distances as dist
INT32_MIN = np.iinfo(np.int32).min + 1
INT32_MAX = np.iinfo(np.int32).max - 1
+
@numba.njit('i4(i8[:])')
def tau_rand_int(state):
state[0] = (((state[0] & 4294967294) << 12) & 0xffffffff) ^ \
@@ -25,11 +26,13 @@ def tau_rand_int(state):
return state[0] ^ state[1] ^ state[2]
+
@numba.njit('f4(i8[:])')
def tau_rand(state):
integer = tau_rand_int(state)
return float(integer) / 0x7fffffff
+
@numba.njit()
def norm(vec):
result = 0.0
@@ -37,6 +40,7 @@ def norm(vec):
result += vec[i]**2
return np.sqrt(result)
+
@numba.njit()
def rejection_sample(n_samples, pool_size, rng_state):
"""Generate n_samples many integers from 0 to pool_size such that no
@@ -56,6 +60,7 @@ def rejection_sample(n_samples, pool_size, rng_state):
result[i] = j
return result
+
@numba.njit()
def random_projection_cosine_split(data, indices, rng_state):
dim = data.shape[1]
@@ -124,6 +129,7 @@ def random_projection_cosine_split(data, indices, rng_state):
return indices_left, indices_right
+
@numba.njit()
def random_projection_split(data, indices, rng_state):
dim = data.shape[1]
@@ -479,7 +485,6 @@ def fuzzy_simplicial_set(X, n_neighbors, random_state, metric, metric_kwds={}, v
sigmas, rhos = smooth_knn_dist(knn_dists, n_neighbors)
for i in range(knn_indices.shape[0]):
-
for j in range(n_neighbors):
if knn_indices[i, j] == -1:
continue # We didn't get the full knn for i
@@ -590,6 +595,7 @@ def spectral_layout(graph, dim, random_state):
return random_state.uniform(low=-10.0, high=10.0,
size=(graph.shape[0], 2))
+
@numba.njit()
def clip(val):
if val > 4.0:
@@ -895,10 +901,10 @@ class UMAP(BaseEstimator):
self.b = b
if self.verbose:
- print("UMAP(n_neighbors={}, n_components={}, metric='{}', gamma={}, "
- "n_edge_samples={}, alpha={}, init='{}', spread={}, "
- "min_dist={}, a={}, b={}, random_state={}, metric_kwds={}, "
- "verbose={})".format(
+ print("UMAP(n_neighbors={}, n_components={}, metric='{}', "
+ " gamma={}, n_edge_samples={}, alpha={}, init='{}', "
+ "spread={}, min_dist={}, a={}, b={}, random_state={}, "
+ "metric_kwds={}, verbose={})".format(
n_neighbors, n_components, metric, gamma,
n_edge_samples, alpha, init, spread,
min_dist, a, b, random_state, metric_kwds, verbose))
