Skip to content

Commit

Permalink
Doc fixes for feature additions.
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcinnes committed Nov 15, 2017
1 parent 3ab97e5 commit aa2a602
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions umap/umap_.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ class UMAP(BaseEstimator):
How to initialize the low dimensional embedding. Options are:
* 'spectral': use a spectral embedding of the fuzzy 1-skeleton
* 'random': assign initial embedding positions at random.
* A numpy array of initial embedding positions.
min_dist: float (optional, default 0.1)
The effective minimum distance between embedded points. Smaller values
Expand All @@ -725,6 +726,10 @@ class UMAP(BaseEstimator):
values are set automatically as determined by ``min_dist`` and
``spread``.
random_seed: int (optional, default None)
Provide a fixed seed for reproducibility (currently experimental,
do not expect consistent results yet, consider this a placeholder).
metric_kwds: dict (optional, default {})
Arguments to pass on to the metric, such as the ``p`` value for
Minkowski distance.
Expand Down Expand Up @@ -758,6 +763,7 @@ def __init__(self,

self.spread = spread
self.min_dist = min_dist
self.random_seed = random_seed

if metric in dist.named_distances:
self._metric = dist.named_distances[self.metric]
Expand All @@ -767,9 +773,6 @@ def __init__(self,
raise ValueError('Supplied metric is neither '
'a recognised string, nor callable')

if random_seed is not None:
np.random.seed(random_seed)

if a is None or b is None:
self.a, self.b = find_ab_params(self.spread, self.min_dist)
else:
Expand All @@ -791,6 +794,9 @@ def fit(self, X, y=None):
# Handle other array dtypes (TODO: do this properly)
X = X.astype(np.float64)

if self.random_seed is not None:
np.random.seed(self.random_seed)

graph = fuzzy_simplicial_set(X, self.n_neighbors,
self._metric, self.metric_kwds)

Expand Down

0 comments on commit aa2a602

Please sign in to comment.