uwot
uwot copied to clipboard
Saving a loaded uwot model
Hi, I would like to be able to cache, load, and cache an object that stores a umap model for downstream prediction tasks. Unfortunately, I run into the error below when I try to re-save a loaded uwot object. Any thoughts on how to address this? Thanks in advance!
ERROR:
Error in envRefInferField(x, what, getClass(class(x)), selfEnv): ‘ann’ is not a valid field or method name for reference class “Rcpp_AnnoyEuclidean”
CODE:
ff <- matrix(rnorm(1000), 100, 10)
# Create the model:
model <- uwot::umap(X = ff, scale = TRUE, n_threads = 4, init = "spectral",
metric = "euclidean", ret_model = TRUE)
model_file <- tempfile("mymodel")
# Save the model:
.x <- uwot::save_uwot(model, file = model_file)
# Load the model:
model2 <- uwot::load_uwot(file = model_file)
# Save the loaded model:
uwot::save_uwot(model2, file = tempfile('mymodel2'))
Sorry about that, the save/load code remains a disaster. This should be fixed on master
, but there was a new CRAN release very recently, so won't be showing up there for quite a while.
Think this got fixed