Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change the default behavior of overriding kwarg dicts for UMAP and HDBSCAN #100

Merged
merged 2 commits into from
Aug 13, 2022

Conversation

sgbaird
Copy link
Member

@sgbaird sgbaird commented Aug 13, 2022

densmap=True, output_dens=True, low_memory=True, and dens_lambda=self.dens_lambda

To avoid the following error:

AttributeError                            Traceback (most recent call last)
[<ipython-input-4-cc761643aed5>](https://localhost:8080/#) in <module>()
----> 1 get_ipython().run_cell_magic('time', '', 'score = disc.predict(val_df, umap_random_state=42)')

4 frames
[/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py](https://localhost:8080/#) in run_cell_magic(self, magic_name, line, cell)
   2115             magic_arg_s = self.var_expand(line, stack_depth)
   2116             with self.builtin_trap:
-> 2117                 result = fn(magic_arg_s, cell)
   2118             return result
   2119 

<decorator-gen-53> in time(self, line, cell, local_ns)

[/usr/local/lib/python3.7/dist-packages/IPython/core/magic.py](https://localhost:8080/#) in <lambda>(f, *a, **k)
    186     # but it's overkill for just that one bit of state.
    187     def magic_deco(arg):
--> 188         call = lambda f, *a, **k: f(*a, **k)
    189 
    190         if callable(arg):

[/usr/local/lib/python3.7/dist-packages/IPython/core/magics/execution.py](https://localhost:8080/#) in time(self, line, cell, local_ns)
   1191         else:
   1192             st = clock2()
-> 1193             exec(code, glob, local_ns)
   1194             end = clock2()
   1195             out = None

<timed exec> in <module>()

[/usr/local/lib/python3.7/dist-packages/mat_discover/mat_discover_.py](https://localhost:8080/#) in predict(self, val_df, plotting, umap_random_state, pred_weight, proxy_weight, dummy_run, count_repeats, return_peak)
    588                     )
    589                     self.umap_emb, self.umap_r_orig = self.extract_emb_rad(
--> 590                         self.umap_trans
    591                     )[:2]
    592                     self.std_emb, self.std_r_orig = self.extract_emb_rad(

[/usr/local/lib/python3.7/dist-packages/mat_discover/mat_discover_.py](https://localhost:8080/#) in extract_emb_rad(self, trans)
   1242         """
   1243         emb, r_orig_log, r_emb_log = attrgetter("embedding_", "rad_orig_", "rad_emb_")(
-> 1244             trans
   1245         )
   1246         r_orig = np.exp(r_orig_log)

AttributeError: 'UMAP' object has no attribute 'rad_orig_'

Also:
default min_cluster_size = 50, min_samples=1, cluster_selection_epsilon=0.63 (but only if not overriden)

sgbaird and others added 2 commits August 12, 2022 18:02
densmap=True, output_dens=True, low_memory=True, and dens_lambda=self.dens_lambda

default min_cluster_size = 50, min_samples=1, cluster_selection_epsilon=0.63
@sgbaird
Copy link
Member Author

sgbaird commented Aug 13, 2022

Might be worth adding a non-dummy test to avoid issues like this in the future.

@sgbaird sgbaird merged commit f42a964 into main Aug 13, 2022
@sgbaird sgbaird deleted the umap-hdbscan-kwargs branch August 13, 2022 00:34
@sgbaird
Copy link
Member Author

sgbaird commented Aug 13, 2022

@cseeg I think this fixes some issues we were working on before. @ancarnevali not sure if you were also dealing with a similar issue. Should be fixed in 2.2.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant