Comments (3)
Thanks for reporting. That config seems to match the default (a=NA, b=NA, spread=1) so am not sure why you are seeing the warning. Could you confirm that is indeed the configuration, please?
It is helpful that you traced to optimize_embedding and that none of the inputs are character, but the root cause doesn't spring to mind. Would you be able to share a minimal example, especially your config settings (see above). And just to be sure, are you using version 0.2.10?
Sorry this is not immediately helpful, but let's investigate further.
from umap.
Yes, I'm using umap 2.10. Did a little more detective work, and this is what I've found:
The umap config settings I'm using (umap_config
) appear to have the same values as umap.defaults
when printed, but that's only because of the print method for class umap.config
. In actuality, my config file had "NA"
instead of NA
and 1L
instead of 1
because it was (incorrectly) parsed from a YAML file.
> cbind(umap.defaults, sapply(umap.defaults, class), umap_config, sapply(umap_config, class))
umap.defaults umap_config
n_neighbors 15 "numeric" 15 "integer"
n_components 2 "numeric" 2 "integer"
metric "euclidean" "character" "euclidean" "character"
n_epochs 200 "numeric" 200 "integer"
input "data" "character" "data" "character"
init "spectral" "character" "spectral" "character"
min_dist 0.1 "numeric" 0.1 "numeric"
set_op_mix_ratio 1 "numeric" 1 "integer"
local_connectivity 1 "numeric" 1 "integer"
bandwidth 1 "numeric" 1 "integer"
alpha 1 "numeric" 1 "integer"
gamma 1 "numeric" 1 "integer"
negative_sample_rate 5 "numeric" 5 "integer"
a NA "logical" "NA" "character"
b NA "logical" "NA" "character"
spread 1 "numeric" 1 "integer"
random_state NA "logical" "NA" "character"
transform_state NA "logical" "NA" "character"
knn NA "logical" "NA" "character"
knn_repeats 1 "numeric" 1 "integer"
verbose FALSE "logical" FALSE "logical"
umap_learn_args NA "logical" "NA" "character"
If you run the two different configs you get:
> umap(mtcars)
umap embedding of 32 items in 2 dimensions
object components: layout, data, knn, config
> umap(mtcars, config = umap_config)
Error: Not compatible with requested type: [type=character; target=double].
In addition: Warning messages:
1: umap: parameters 'spread', 'a', 'b' are set to non-default values;
parameter 'spread' will be ignored.
(Embedding will be controlled via 'a' and 'b')
2: In umap.prep.config(config, ...) : NAs introduced by coercion
3: In umap.prep.config(config, ...) : NAs introduced by coercion
To reproduce in a minimal example, I'm attaching a dput
of my config file.
umap_config <- structure(list(n_neighbors = 15L, n_components = 2L, metric = "euclidean",
n_epochs = 200L, input = "data", init = "spectral", min_dist = 0.1,
set_op_mix_ratio = 1L, local_connectivity = 1L, bandwidth = 1L,
alpha = 1L, gamma = 1L, negative_sample_rate = 5L, a = "NA",
b = "NA", spread = 1L, random_state = "NA", transform_state = "NA",
knn = "NA", knn_repeats = 1L, verbose = FALSE, umap_learn_args = "NA"), class = "umap.config")
As for why in my initial debug I found abg = c(NA, NA, 1, 0)
instead of showing as character, I don't know because I can't reproduce that. Must have been something else I did to that environment, because reproducing it with a minimal example in a fresh environment just shows abg = c("NA", "NA", "1", "0")
which is obviously the character vector the function is having problems with.
So case closed, this is user error on my part. That said, it might be nice for the function to do some type checking early on and throw more verbose error messages about that?
from umap.
Thanks for the detailed investigation. Glad you found the root cause and can work around this for now.
As you suggest, additional input validation would be useful. Most inputs should be numeric values, apart from 'metric', 'input', 'init', and 'umap_learn_args'. If you'd like to make a PR, I'd be happy to incorporate into a new version!
from umap.
Related Issues (20)
- predict() on a umap object with n_components=1 gets two errors -- Looks like missing drop=F HOT 2
- Failed creating initial embedding; using random embedding instead HOT 3
- Intel MKL FATAL ERROR HOT 3
- Differences with Python version? HOT 4
- Add support for umap-learn 0.5 HOT 4
- Sparse Matrix support HOT 4
- is there any spark version implementations? HOT 2
- missing value where TRUE/FALSE needed HOT 3
- Problem with using custom metric HOT 2
- umap() produces matrix instead of S3 object HOT 2
- method = "python" does not work HOT 1
- when random_state is set automatically in config, it is not sufficient for reproducibility HOT 1
- Citing the package HOT 1
- transforming new data to an embedding HOT 3
- Error with n_components=1 HOT 3
- Number of threads HOT 3
- Allow for supervised/semi-supervised dimension reduction with labels HOT 1
- min_dist not updating with Python backend HOT 3
- predict() generates different predictions if called with multiple points at once versus called with each point individually HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from umap.