Skip to content

Commit

Permalink
Less strict integer checking
Browse files Browse the repository at this point in the history
  • Loading branch information
alanocallaghan committed Sep 6, 2024
1 parent 92f8288 commit 6352df7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: densvis
Title: Density-Preserving Data Visualization via Non-Linear Dimensionality Reduction
Version: 1.15.0
Date: 2024-03-05
Version: 1.15.1
Date: 2024-09-06
Authors@R:
c(
person(
Expand Down
32 changes: 21 additions & 11 deletions R/densmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,25 +210,29 @@ umap <- function(
)
proc <- basiliskStart(python_env)
on.exit(basiliskStop(proc))

if (!is.null(random_state)) {
random_state <- as.integer(random_state)
}
out <- basiliskRun(proc, .fit_umap,
x = x,
n_components = n_components,
n_components = as.integer(n_components),
dens_frac = dens_frac,
dens_lambda = dens_lambda,
densmap = densmap,
n_neighbors = n_neighbors,
n_neighbors = as.integer(n_neighbors),
metric = metric,
n_epochs = n_epochs,
n_epochs = as.integer(n_epochs),
dens_var_shift = dens_var_shift,
learning_rate = learning_rate,
init = init,
min_dist = min_dist,
spread = spread,
low_memory = low_memory,
set_op_mix_ratio = set_op_mix_ratio,
local_connectivity = local_connectivity,
local_connectivity = as.integer(local_connectivity),
repulsion_strength = repulsion_strength,
negative_sample_rate = negative_sample_rate,
negative_sample_rate = as.integer(negative_sample_rate),
transform_queue_size = transform_queue_size,
random_state = random_state,
angular_rp_forest = angular_rp_forest,
Expand Down Expand Up @@ -305,7 +309,8 @@ densmap <- function(...) {
)
)
assert_that(
is.integer(n_components),
# is.integer(n_components),
round(n_components == n_components),
n_components > 0,
length(n_components) == 1,
is.numeric(dens_frac),
Expand All @@ -315,9 +320,11 @@ densmap <- function(...) {
dens_lambda >= 0,
dens_lambda <= 1,
n_neighbors > 0,
is.integer(n_neighbors),
# is.integer(n_neighbors),
round(n_neighbors == n_neighbors),
length(n_neighbors) == 1,
is.integer(n_epochs),
# is.integer(n_epochs),
round(n_epochs == n_epochs),
n_epochs > 0,
length(n_epochs) == 1,
is.numeric(dens_var_shift),
Expand All @@ -335,20 +342,23 @@ densmap <- function(...) {
is.numeric(set_op_mix_ratio),
set_op_mix_ratio > 0,
length(set_op_mix_ratio) == 1,
is.integer(local_connectivity),
# is.integer(local_connectivity),
round(local_connectivity == local_connectivity),
local_connectivity > 0,
length(local_connectivity) == 1,
is.numeric(repulsion_strength),
repulsion_strength > 0,
length(repulsion_strength) == 1,
is.integer(negative_sample_rate),
# is.integer(negative_sample_rate),
round(negative_sample_rate == negative_sample_rate),
negative_sample_rate > 0,
length(negative_sample_rate) == 1,
is.numeric(transform_queue_size),
transform_queue_size > 0,
length(transform_queue_size) == 1,
is.null(random_state) ||
is.integer(random_state)
# is.integer(random_state)
round(random_state == random_state)
& random_state > 0
& length(random_state) == 1,
is.logical(angular_rp_forest),
Expand Down

0 comments on commit 6352df7

Please sign in to comment.