Skip to content

Commit

Permalink
Update the code
Browse files Browse the repository at this point in the history
  • Loading branch information
statwangz committed Sep 30, 2023
1 parent 4ca1c78 commit edfc2b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions R/mfairInitialization.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ createMFAIR <- function(Y, X,
Y_sparse <- TRUE
message("The main data matrix Y has been stored in the sparse mode!")
} else if (Y_sparse == TRUE) { # Y is not in sparse mode, but we want it to be
obs_tf <- !is.na(Y) # Indicates whether observed or missing
obs_indices <- which(obs_tf, arr.ind = TRUE) # Indices of observed entries
obs_indices <- which(!is.na(Y), arr.ind = TRUE) # Indices of observed entries
Y <- Matrix::sparseMatrix(
i = obs_indices[, "row"], j = obs_indices[, "col"],
x = Y[obs_tf],
x = Y[obs_indices],
dims = c(N, M),
symmetric = FALSE, triangular = FALSE,
index1 = TRUE
Expand Down
3 changes: 1 addition & 2 deletions data-raw/ml10m.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ movie_genre_matrix <- t(sapply(
movies[, 3],
FUN = function(x) {
as.integer(all_genres %in%
unlist(strsplit(x, split = "|", fixed = TRUE))
)
unlist(strsplit(x, split = "|", fixed = TRUE)))
},
USE.NAMES = FALSE
))
Expand Down

0 comments on commit edfc2b5

Please sign in to comment.