Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

Commit

Permalink
chore: import umap only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
AFAgarap committed Jun 6, 2021
1 parent b3788a8 commit 50c658f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pt_datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
)

__author__ = "Abien Fred Agarap"
__version__ = "0.14.3"
__version__ = "0.14.4"


def list_datasets() -> str:
Expand Down
3 changes: 2 additions & 1 deletion pt_datasets/encode_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import MulticoreTSNE
import numpy as np
from sklearn.decomposition import PCA
from umap import UMAP

__author__ = "Abien Fred Agarap"

Expand Down Expand Up @@ -65,6 +64,8 @@ def encode_features(
n_jobs=4, random_state=seed, n_components=dim
)
elif encoder == "umap":
from umap import UMAP

encoder = UMAP(n_components=dim, random_state=seed)
encoded_features = encoder.fit_transform(features)
return encoded_features
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _download_yelp():

setup(
name="pt-datasets",
version="0.14.3",
version="0.14.4",
packages=["pt_datasets"],
url="https://github.com/AFAgarap/pt-datasets",
license="AGPL-3.0 License",
Expand Down

0 comments on commit 50c658f

Please sign in to comment.