From f19470d5db4d5e00861b7854513146a5902decf4 Mon Sep 17 00:00:00 2001 From: Yixuan Qiu Date: Wed, 13 Jul 2016 08:43:24 -0400 Subject: [PATCH] some clean-up --- R/DataSource.R | 6 +----- R/Output.R | 1 + inst/NEWS.Rd | 2 +- man/data_source.Rd | 2 ++ man/output_format.Rd | 2 ++ src/mf.cpp | 12 ++++++++++-- vignettes/introduction.Rmd | 2 +- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/R/DataSource.R b/R/DataSource.R index b50f8c1..aa48a3f 100644 --- a/R/DataSource.R +++ b/R/DataSource.R @@ -48,6 +48,7 @@ setClass("DataSource", #' it is ignored. #' @param index1 Whether the user indices and item indices start with 1 #' (\code{index1 = TRUE}) or 0 (\code{index1 = FALSE}). +#' @param \dots Currently unused. #' @return An object of class "DataSource" as required by #' \code{$\link{tune}()}, \code{$\link{train}()}, and \code{$\link{predict}()}. #' @@ -88,8 +89,3 @@ data_memory = function(user_index, item_index, rating = NULL, index1 = FALSE, .. new("DataSource", source = list(user_index, item_index, rating), index1 = index1, type = "memory") } - -data_rmm = function(rmm, ...) -{ - -} \ No newline at end of file diff --git a/R/Output.R b/R/Output.R index baafbec..21e1ced 100644 --- a/R/Output.R +++ b/R/Output.R @@ -14,6 +14,7 @@ setClass("Output", #' the result is not needed and will not be returned. #' #' @param path Path to the output file. +#' @param \dots Currently unused. #' @return An object of class "Output" as required by #' \code{$\link{output}()} and \code{$\link{predict}()}. #' diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 8d4b3d5..b9e3353 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -10,7 +10,7 @@ has been expanded to and replaced by \code{costp_l1}, \code{costp_l2}, \code{costq_l1}, and \code{costq_l2}, to allow for more flexibility of the model. - \item Added a \code{loss} parameter in \code{$train()} and + \item A new \code{loss} parameter in \code{$train()} and \code{$tune()} to specify loss function. } \item Other API change: diff --git a/man/data_source.Rd b/man/data_source.Rd index 7b13693..fba24b4 100644 --- a/man/data_source.Rd +++ b/man/data_source.Rd @@ -23,6 +23,8 @@ data_memory(user_index, item_index, rating = NULL, index1 = FALSE, ...) \item{rating}{A numeric vector of the observed entries in the rating matrix. Can be specified as \code{NULL} for testing data, in which case it is ignored.} + +\item{\dots}{Currently unused.} } \value{ An object of class "DataSource" as required by diff --git a/man/output_format.Rd b/man/output_format.Rd index a3e8dda..113d33a 100644 --- a/man/output_format.Rd +++ b/man/output_format.Rd @@ -15,6 +15,8 @@ out_nothing(...) } \arguments{ \item{path}{Path to the output file.} + +\item{\dots}{Currently unused.} } \value{ An object of class "Output" as required by diff --git a/src/mf.cpp b/src/mf.cpp index d2e8514..b872c46 100644 --- a/src/mf.cpp +++ b/src/mf.cpp @@ -1019,8 +1019,12 @@ mf_model* Utility::init_model(mf_int fun, } catch(bad_alloc const &e) { - cerr << e.what() << endl; + // cerr << e.what() << endl; + // mf_destroy_model(&model); + // throw; + mf_destroy_model(&model); + Rcpp::stop(e.what()); throw; } @@ -3544,8 +3548,12 @@ mf_model* mf_load_model(char const *path) } catch(bad_alloc const &e) { - cerr << e.what() << endl; + // cerr << e.what() << endl; + // mf_destroy_model(&model); + // return nullptr; + mf_destroy_model(&model); + Rcpp::stop(e.what()); return nullptr; } diff --git a/vignettes/introduction.Rmd b/vignettes/introduction.Rmd index 375534b..d315a2b 100644 --- a/vignettes/introduction.Rmd +++ b/vignettes/introduction.Rmd @@ -226,7 +226,7 @@ $P$ and $Q$ into files or return them as R objects. Below is an example on some simulated data: -```{r cache=TRUE} +```{r} library(recosystem) set.seed(123) # This is a randomized algorithm train_set = data_file(system.file("dat", "smalltrain.txt", package = "recosystem"))