library(Matrix)
# Scenario 1 with sparse matrices
set.seed(1)
res1 <- onlineINMF(list(ctrl.sparse, stim.sparse),
minibatchSize = 50, k = 10, verbose = FALSE)
# Scenario 2 with H5 dense matrices
h5dense1 <- H5Mat(filename = system.file("extdata", "ctrl_dense.h5",
package = "RcppPlanc", mustWork = TRUE),
dataPath = "scaleData")
h5dense2 <- H5Mat(filename = system.file("extdata", "stim_dense.h5",
package = "RcppPlanc", mustWork = TRUE),
dataPath = "scaleData")
res2 <- onlineINMF(list(ctrl = h5dense1), minibatchSize = 50, k = 10, verbose = FALSE)
res3 <- onlineINMF(list(ctrl = h5dense1),
newDatasets = list(stim = h5dense2),
Hinit = res2$H, Vinit = res2$V, Winit = res2$W,
Ainit = res2$A, Binit = res2$B,
minibatchSize = 50, k = 10, verbose = FALSE)
# Scenario 3 with H5 sparse matrices
h5sparse1 <- H5SpMat(filename = system.file("extdata", "ctrl_sparse.h5",
package = "RcppPlanc", mustWork = TRUE),
valuePath = "scaleDataSparse/data",
rowindPath = "scaleDataSparse/indices",
colptrPath = "scaleDataSparse/indptr",
nrow = nrow(ctrl.sparse),
ncol = ncol(ctrl.sparse))
h5sparse2 <- H5SpMat(filename = system.file("extdata", "stim_sparse.h5",
package = "RcppPlanc", mustWork = TRUE),
valuePath = "scaleDataSparse/data",
rowindPath = "scaleDataSparse/indices",
colptrPath = "scaleDataSparse/indptr",
nrow = nrow(stim.sparse),
ncol = nrow(stim.sparse))
res4 <- onlineINMF(list(ctrl = h5sparse1), minibatchSize = 50, k = 10, verbose = FALSE)
res5 <- onlineINMF(list(ctrl = h5sparse1),
newDatasets = list(stim = h5sparse2), project = TRUE,
Hinit = res4$H, Vinit = res4$V, Winit = res4$W,
Ainit = res4$A, Binit = res4$B,
minibatchSize = 50, k = 10, verbose = FALSE)
Run the code above in your browser using DataLab