1010
1111ENABLE_CATEGORICAL = "ckanext.dimred.enable_categorical"
1212MAX_CATEGORIES_FOR_OHE = "ckanext.dimred.max_categories_for_ohe"
13-
13+ CACHE_ENABLED = "ckanext.dimred.cache_enabled"
14+ CACHE_TTL = "ckanext.dimred.cache_ttl"
1415UMAP_N_NEIGHBORS = "ckanext.dimred.umap.n_neighbors"
1516UMAP_MIN_DIST = "ckanext.dimred.umap.min_dist"
1617UMAP_N_COMPONENTS = "ckanext.dimred.umap.n_components"
1718
1819TSNE_PERPLEXITY = "ckanext.dimred.tsne.perplexity"
1920TSNE_N_COMPONENTS = "ckanext.dimred.tsne.n_components"
2021
21- CACHE_ENABLED = "ckanext.dimred.cache_enabled "
22- CACHE_TTL = "ckanext.dimred.cache_ttl "
22+ PCA_N_COMPONENTS = "ckanext.dimred.pca.n_components "
23+ PCA_WHITEN = "ckanext.dimred.pca.whiten "
2324
2425
2526def default_method () -> str :
@@ -56,6 +57,16 @@ def max_categories_for_ohe() -> int:
5657 return int (tk .config [MAX_CATEGORIES_FOR_OHE ])
5758
5859
60+ def cache_enabled () -> bool :
61+ """Whether caching for dimred previews is enabled."""
62+ return tk .asbool (tk .config .get (CACHE_ENABLED , True ))
63+
64+
65+ def cache_ttl () -> int :
66+ """TTL for cached dimred previews in seconds."""
67+ return int (tk .config .get (CACHE_TTL , 3600 ))
68+
69+
5970def umap_n_neighbors () -> int :
6071 """Default UMAP n_neighbors value."""
6172 return int (tk .config [UMAP_N_NEIGHBORS ])
@@ -82,11 +93,11 @@ def tsne_n_components() -> int:
8293 return tk .config [TSNE_N_COMPONENTS ]
8394
8495
85- def cache_enabled () -> bool :
86- """Whether caching for dimred previews is enabled ."""
87- return tk . asbool (tk .config . get ( CACHE_ENABLED , True ) )
96+ def pca_n_components () -> int :
97+ """Number of output components for PCA ."""
98+ return int (tk .config [ PCA_N_COMPONENTS ] )
8899
89100
90- def cache_ttl () -> int :
91- """TTL for cached dimred previews in seconds ."""
92- return int (tk .config .get (CACHE_TTL , 3600 ))
101+ def pca_whiten () -> bool :
102+ """Whether to whiten PCA output ."""
103+ return tk . asbool (tk .config .get (PCA_WHITEN , False ))
0 commit comments