Use the user item matrix to search for similar users in order to get the anime they graded the best and that we have not watched

user_based_recom(
  userid = 999999999,
  user_item_matrix,
  ratings_data,
  n_recommendation = 5,
  threshold = 1,
  nearest_neighbors = 10
)

Arguments

userid

user id, set to 999999999 so that there is no conflict with other Id's

user_item_matrix

matrix created by the function `user_item_matrix`

ratings_data

table of ratings similar to the one we kept

n_recommendation

number of recommendations wanted

threshold

threshold level of number of user that gave a score to the anime

nearest_neighbors

number of neighbors taken into account for the computation

Value

Return a table composed of `n_recommendation` that the user have not seen yet

Author

Marie Bellier, Massimo Finini, Meri Likoska, Vania Rodrigues Telo Ramos, Xavier Renger

Examples


#Simple example to showcase what is happening in the application

#import dataset from the package
anime_with_ratings <-  tibble::tibble(ProjectG5::anime_with_ratings)

#selection of the user example
names_selected <- c("Death Note", "Naruto")
score_entered <- c(10,7)

temp_tibble <- tibble::tibble(Name = names_selected, rating = score_entered)

anime_selected <- dplyr::left_join(anime, temp_tibble, by = c("Name" = "Name"))
anime_selected <- dplyr::filter(anime_selected, Name %in% names_selected)
anime_selected <- dplyr::mutate(anime_selected, user_id = 999999999)

#creation of the matrix with what the user selected
item_matrix <- user_item_matrix(anime_with_ratings, adding_row = TRUE, row_data = anime_selected)

user_based_recom(999999999, item_matrix, anime_with_ratings, 5, 1, 10)
#> # A tibble: 5 x 6
#> # Groups:   item_id, Name, Episodes [5]
#>   item_id Name                                 Episodes Duration count rating
#>   <chr>   <chr>                                <chr>       <int> <int>  <dbl>
#> 1 ID2001  Gurren Lagann                        27             24     3  10   
#> 2 ID6     Trigun                               26             24     3  10   
#> 3 ID7311  The Disappearance of Haruhi Suzumiya 1             162     3  10   
#> 4 ID2025  Darker than Black                    25             24     2  10   
#> 5 ID1     Cowboy Bebop                         26             24     3   9.67