Skip to content

Commit

Permalink
Removed 'fits' from compile_lda_runs.R.
Browse files Browse the repository at this point in the history
  • Loading branch information
pcarbo committed Aug 21, 2024
1 parent d3e66bb commit 180b2d6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions scripts/compile_lda_runs.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ n <- length(files)
# Set up two data structures: "fits", a list used to store all the
# results; and "dat", a data frame summarizing the model parameters
# and optimization settings used to produce these fits.
fits <- vector("list",n)
# fits <- vector("list",n)
labels <- files
labels <- str_remove(labels,paste(outdir,"/",sep = ""))
labels <- str_remove(labels,".rds")
names(fits) <- labels
# names(fits) <- labels
dat <- data.frame(label = labels,
k = 0,
method = "",
Expand All @@ -31,24 +31,23 @@ dat <- data.frame(label = labels,
# Load the results from the RDS files.
for (i in 1:n) {
out <- readRDS(files[i])
fits[[i]] <- out$lda
# fits[[i]] <- out$lda
dat[i,"k"] <- out$lda@k
dat[i,"method"] <- unlist(strsplit(labels[i],"-"))[3]
dat[i,"extrapolate"] <- grepl("ex",labels[i],fixed = TRUE)
dat[i,"runtime"] <- out$timing["elapsed"]
}

# Reorder the results in "fits" and "dat".
dat <- transform(dat,method = factor(method,c("em","scd")))
dat <- transform(dat,method = factor(method,c("noinit","em","scd")))
i <- with(dat,order(k,extrapolate,method))
dat <- dat[i,]
fits <- fits[i]
# fits <- fits[i]
rownames(dat) <- NULL

# Convert the "k" column to a factor.
dat <- transform(dat,k = factor(k))

# Save the combined results to an .RData file.
save(list = c("dat","fits"),
file = rdafile)
save(list = "dat",file = rdafile)
resaveRdaFiles(rdafile)

0 comments on commit 180b2d6

Please sign in to comment.