Skip to content

Commit

Permalink
buf fixes changed separator for reco list
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulCristina committed Jun 29, 2020
1 parent 922874c commit 73cb43b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
Binary file modified R/data/processed/reco_als.parquet
Binary file not shown.
Binary file modified R/data/processed/reco_items.parquet
Binary file not shown.
9 changes: 5 additions & 4 deletions R/libraries/librariesInstall.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
print("Install libraries that will be used ...")


## Database
# RMySQL)
install.packages('mongolite', version = "2.1.0", repos='http://cran.us.r-project.org', depencencies = TRUE)
## Time/date transformations
install.packages('lubridate', version = "1.7.4", repos='http://cran.us.r-project.org', depencencies = TRUE)
install.packages('anytime', version = "0.3.6", repos='http://cran.us.r-project.org', depencencies = TRUE)
Expand All @@ -23,5 +20,9 @@ install.packages('data.table', version = "1.12.2", repos='http://cran.us.r-proje
install.packages('Matrix', version = "1.2-17", repos='http://cran.us.r-project.org', depencencies = TRUE)
install.packages('matrixStats', version = "0.54.0", repos='http://cran.us.r-project.org', depencencies = TRUE)
## Recommendation
install.packages('rsparse', version = "0.3.3.4", repos='http://cran.us.r-project.org', depencencies = TRUE)
install.packages('rsparse', version = "0.4.0", repos='http://cran.us.r-project.org', depencencies = TRUE)
install.packages('text2vec', version = "0.5.1", repos='http://cran.us.r-project.org', depencencies = TRUE)
## General utility
install.packages('remotes', version = "2.1.0", repos='http://cran.us.r-project.org', depencencies = TRUE)
## Api
remotes::install_github("rexyai/RestRserve")
11 changes: 6 additions & 5 deletions R/libraries/librariesUsed.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ suppressMessages(library(magrittr))
## Recommendation
suppressMessages(library(rsparse))
suppressMessages(library(text2vec))
## Saving data to disk
suppressMessages(library(feather))
suppressMessages(library(arrow))
suppressMessages(library(here))
## Exploratory Data Analysis
suppressMessages(library(summarytools))
suppressMessages(library(rcompanion))
Expand All @@ -36,7 +32,12 @@ suppressMessages(library(AutoExploreR))
suppressMessages(library(foreach))
suppressMessages(library(doParallel))
suppressMessages(library(doSNOW))

## Api
suppressMessages(library(RestRserve))
## Saving data to disk
suppressMessages(library(feather))
suppressMessages(library(arrow))
suppressMessages(library(here))
print("Libraries read")


Expand Down
5 changes: 3 additions & 2 deletions cross-validation.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ help(package = "rsparse")
# download data
# https://grouplens.org/datasets/movielens/
data_dir <- paste0(getwd(),"/R/data/raw")
df.movies <- fread(file.path(data_dir, "movies.csv"))
df.ratings <- fread(file.path(data_dir, "ratings.csv"))
df.movies <- fread(file.path(data_dir, "movies.csv.gz"))
df.ratings <- fread(file.path(data_dir, "ratings.csv.gz"))
glimpse(df.ratings)
glimpse(df.movies)


# number of views a movie must have in order
# to be included in the recommendations
movieViews <- 100
Expand Down
9 changes: 5 additions & 4 deletions making_reco.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ setwd("/recommender-systems-matrix-factorization")
# Load libraries
source("R/libraries/librariesUsed.R")
sessionInfo()
detect_number_omp_threads()
options("rsparse::rsparse_omp_threads" = 2)

help(package = "rsparse")
Expand All @@ -32,8 +33,8 @@ tic("00. Total running time")
# download data
# https://grouplens.org/datasets/movielens/
data_dir <- paste0(getwd(),"/R/data/raw")
df.movies <- fread(file.path(data_dir, "movies.csv"))
df.ratings <- fread(file.path(data_dir, "ratings.csv"))
df.movies <- fread(file.path(data_dir, "movies.csv.gz"))
df.ratings <- fread(file.path(data_dir, "ratings.csv.gz"))
glimpse(df.ratings)
glimpse(df.movies)

Expand Down Expand Up @@ -177,7 +178,7 @@ df.recom_list[, (cols.to.del) := NULL]
# transform recommendations to list
cols.to.del <- NULL
cols.to.del <- names(df.recom_list[,2:(number_of_Reco+1)])
df.recom_list[, reco := do.call(paste, c(.SD, sep = ",")), .SDcols = cols.to.del]
df.recom_list[, reco := do.call(paste, c(.SD, sep = ";")), .SDcols = cols.to.del]
df.recom_list[, (cols.to.del) := NULL]


Expand Down Expand Up @@ -235,7 +236,7 @@ df.recom_sims[, (cols.to.del) := NULL]
# transform recommendations to list
cols.to.del <- NULL
cols.to.del <- names(df.recom_sims[,2:(number_of_Reco+1)])
df.recom_sims[, reco := do.call(paste, c(.SD, sep = ",")), .SDcols = cols.to.del]
df.recom_sims[, reco := do.call(paste, c(.SD, sep = ";")), .SDcols = cols.to.del]
df.recom_sims[, (cols.to.del) := NULL]
setnames(df.recom_sims, names(df.recom_sims), c("movies", "similar"))

Expand Down

0 comments on commit 73cb43b

Please sign in to comment.