Skip to content

PipeOpUMAP #791

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open

PipeOpUMAP #791

wants to merge 39 commits into from

Conversation

advieser
Copy link
Collaborator

@advieser advieser commented Aug 6, 2024

This implements Uniform Manifold Approximation and Projection (UMAP) from the uwot package.

Training works via uwot::umap2() and prediction through uwot::umap_transform().

closes #755

@advieser
Copy link
Collaborator Author

advieser commented Aug 7, 2024

Noting for future reference, that R CMD check failed since %check||%/%check&&% could not be found when they were used inside of a custom_check using crate(), i.e. custom_check = crate(function(x) check_...(x) %check||% check_...(x)).

@mb706
Copy link
Collaborator

mb706 commented Aug 8, 2024

Apparently there was a bug in crate(), which is fixed in mlr-org/mlr3misc#114 now. Until this is on cran, the necessary workaround is to specify the .parent argument of crate() directly. Could you see if using crate(...., .parent = topenv()) works?
The reason we use crate() here is that we don't want the check functions to carry around the environment of the initialize()-call.

@advieser
Copy link
Collaborator Author

advieser commented Aug 14, 2024

A couple of parameters (approx_pow, target_n_neighbors, target_weight, pca_method) are only used if another parameter is NULL or non-NULL. The way I see it, this can't be tested for using the depends argument for the Domain, since if I use depends = quote(approx_pow == NULL), I get

Error in constructor(value) : 
  Assertion on 'rhs' failed: Must have length 1, but has length 0.

Obviously, is.null(qpprox_pow) can't be parsed either.
Did I get that correct?

There are other cases that can't be tested for using depends, however, this case with NULL comes up often enough, that I thought I'd ask.

search_k_transform = p_int(default = NULL, special_vals = list(NULL), tags = c("predict", "overwrite"), depends = quote(nn_method == "annoy")),
n_epochs_transform = p_int(lower = 1L, default = NULL, special_vals = list(NULL), tags = c("predict", "overwrite")),
init_transform = p_fct(levels = c("weighted", "average"), special_vals = list("custom"), default = "weighted", tags = c("predict", "overwrite")),
init_transform_custom = p_uty(custom_check = check_matrix, tags = "predict", depends = quote(init_transform == "custom")),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one has no tag 'overwrite' on purpose?

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for UMAP: Uniform Manifold Approximation and Projection
3 participants