R Under development (unstable) (2018-02-09 r74240) -- "Unsuffered Consequences" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "FactoRizationMachines" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('FactoRizationMachines') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("010-FactoRizationMachines") > ### * 010-FactoRizationMachines > > flush(stderr()); flush(stdout()) > > ### Name: FactoRizationMachines > ### Title: Machine Learning with Higher-Order Factorization Machines > ### Aliases: FactoRizationMachines FactorizationMachines-package > ### Keywords: package Factorization Machine Matrix Factorization Machine > ### Learning Recommender > > ### ** Examples > > ## Not run: > ##D > ##D # Load libraries > ##D library(FactoRizationMachines) > ##D library(Matrix) > ##D > ##D # Load MovieLens 100k data set > ##D ml100k=as.matrix(read.table("http://files.grouplens.org/datasets/movielens/ml-100k/u.data")) > ##D user=ml100k[,1] > ##D items=ml100k[,2]+max(user) > ##D wdays=(as.POSIXlt(ml100k[,4],origin="1970-01-01")$wday+1)+max(items) > ##D > ##D # Transform MovieLens 100k to feature form > ##D data=sparseMatrix(i=rep(1:nrow(ml100k),3),j=c(user,items,wdays),giveCsparse=F) > ##D target=ml100k[,3] > ##D > ##D # Subset data to training and test data > ##D set.seed(123) > ##D subset=sample.int(nrow(data),nrow(data)*.8) > ##D data.train=data[subset,] > ##D data.test=data[-subset,] > ##D target.train=target[subset] > ##D target.test=target[-subset] > ##D > ##D # Predict ratings with Support Vector Machine with linear kernel > ##D # using MCMC learning method > ##D model=SVM.train(data.train,target.train) > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D # Predict ratings with second-order Factorization Machine > ##D # with second-order 10 factors (default) > ##D # using coordinate descent learning method (regularization suggested) > ##D model=FM.train(data.train,target.train,regular=0.1) > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D # Predict ratings with second-order Factorization Machine > ##D # with second-order 10 factors (default) > ##D # using Markov Chain Monte Carlo learning method > ##D model=FM.train(data.train,target.train) > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D # Predict ratings with higher-order Factorization Machine > ##D # with 3 second-order and 1 third-order factor and regularization > ##D # using coordinate descent learning method (regularization suggested) > ##D model=HoFM.train(data.train,target.train,c(1,3,1),regular=0.1) > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D # Predict ratings with higher-order Factorization Machine > ##D # with 3 second-order and 1 third-order factor and regularization > ##D # using MCMC learning method > ##D model=HoFM.train(data.train,target.train,c(1,3,1)) > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D # Predict ratings with adaptive-order Factorization Machine > ##D model=KnoFM.train(data.train,target.train) > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ## End(Not run) > > > > cleanEx() > nameEx("020-SVM.train") > ### * 020-SVM.train > > flush(stderr()); flush(stdout()) > > ### Name: SVM.train > ### Title: Method training a Support Vector Machine > ### Aliases: SVM.train > > ### ** Examples > > ## Not run: > ##D > ##D ### Example to illustrate the usage of the method > ##D ### Data set very small and not sparse, results not representative > ##D ### Please study major example in general help 'FactoRizationMachines' > ##D > ##D # Load data set > ##D library(FactoRizationMachines) > ##D library(MASS) > ##D data("Boston") > ##D > ##D # Subset data to training and test data > ##D set.seed(123) > ##D subset=sample.int(nrow(Boston),nrow(trees)*.8) > ##D data.train=Boston[subset,-ncol(Boston)] > ##D target.train=Boston[subset,ncol(Boston)] > ##D data.test=Boston[-subset,-ncol(Boston)] > ##D target.test=Boston[-subset,ncol(Boston)] > ##D > ##D > ##D # Predict with linear weights and intercept with MCMC regularization > ##D model=SVM.train(data.train,target.train) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D > ##D # Predict with linear weights but without intercept with MCMC regularization > ##D model=SVM.train(data.train,target.train,intercept=FALSE) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D > ##D # Predict with linear weights and manual regularization > ##D model=SVM.train(data.train,target.train,regular=0.1) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ## End(Not run) > > > > cleanEx() > nameEx("030-FM.train") > ### * 030-FM.train > > flush(stderr()); flush(stdout()) > > ### Name: FM.train > ### Title: Method training a second-order Factorization Machine > ### Aliases: FM.train > > ### ** Examples > > ## Not run: > ##D > ##D ### Example to illustrate the usage of the method > ##D ### Data set very small and not sparse, results not representative > ##D ### Please study major example in general help 'FactoRizationMachines' > ##D > ##D # Load data set > ##D library(FactoRizationMachines) > ##D library(MASS) > ##D data("Boston") > ##D > ##D # Subset data to training and test data > ##D set.seed(123) > ##D subset=sample.int(nrow(Boston),nrow(trees)*.8) > ##D data.train=Boston[subset,-ncol(Boston)] > ##D target.train=Boston[subset,ncol(Boston)] > ##D data.test=Boston[-subset,-ncol(Boston)] > ##D target.test=Boston[-subset,ncol(Boston)] > ##D > ##D > ##D # Predict with 3 second-order factors with MCMC regularization > ##D model=FM.train(data.train,target.train,c(1,3)) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D > ##D # Predict with 10 second-order factor with MCMC regularization > ##D model=FM.train(data.train,target.train) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D > ##D # Predict with 10 second-order factor with manual regularization > ##D model=FM.train(data.train,target.train,regular=0.1) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ## End(Not run) > > > > cleanEx() > nameEx("040-HoFM.train") > ### * 040-HoFM.train > > flush(stderr()); flush(stdout()) > > ### Name: HoFM.train > ### Title: Method training a higher-order Factorization Machine > ### Aliases: HoFM.train > > ### ** Examples > > ## Not run: > ##D > ##D ### Example to illustrate the usage of the method > ##D ### Data set very small and not sparse, results not representative > ##D ### Please study major example in general help 'FactoRizationMachines' > ##D > ##D # Load data set > ##D library(FactoRizationMachines) > ##D library(MASS) > ##D data("Boston") > ##D > ##D # Subset data to training and test data > ##D set.seed(123) > ##D subset=sample.int(nrow(Boston),nrow(trees)*.8) > ##D data.train=Boston[subset,-ncol(Boston)] > ##D target.train=Boston[subset,ncol(Boston)] > ##D data.test=Boston[-subset,-ncol(Boston)] > ##D target.test=Boston[-subset,ncol(Boston)] > ##D > ##D > ##D # Predict with 7 second-order and 2 third-order factors > ##D # with MCMC regularization > ##D model=HoFM.train(data.train,target.train,c(1,7,2)) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D > ##D # Predict with 10 second-order and 5 third-order factor > ##D # with MCMC regularization > ##D model=HoFM.train(data.train,target.train) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D > ##D # Predict with 10 second-order and 5 third-order factor > ##D # with manual regularization > ##D model=HoFM.train(data.train,target.train,regular=0.1) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ## End(Not run) > > > > cleanEx() > nameEx("045-KnoFM.train") > ### * 045-KnoFM.train > > flush(stderr()); flush(stdout()) > > ### Name: KnoFM.train > ### Title: Knowledge-extracting or adaptive-order Factorization Machine > ### Aliases: KnoFM.train > > ### ** Examples > > ## Not run: > ##D > ##D ### Example to illustrate the usage of the method > ##D ### Data set very small and not sparse, results not representative > ##D ### Please study major example in general help 'FactoRizationMachines' > ##D > ##D # Load data set > ##D library(FactoRizationMachines) > ##D library(MASS) > ##D data("Boston") > ##D > ##D # Subset data to training and test data > ##D set.seed(123) > ##D subset=sample.int(nrow(Boston),nrow(trees)*.8) > ##D data.train=Boston[subset,-ncol(Boston)] > ##D target.train=Boston[subset,ncol(Boston)] > ##D data.test=Boston[-subset,-ncol(Boston)] > ##D target.test=Boston[-subset,ncol(Boston)] > ##D > ##D # Predict with an adaptive-order Factorization Machine > ##D # using one CPU core and printing progress > ##D model=KnoFM.train(data.train,target.train,FALSE,FALSE) > ##D > ##D # RMSE resulting from test data prediction > ##D sqrt(mean((predict(model,data.test)-target.test)^2)) > ##D > ##D > ## End(Not run) > > > > cleanEx() > nameEx("050-predict.FMmodel") > ### * 050-predict.FMmodel > > flush(stderr()); flush(stdout()) > > ### Name: predict.FMmodel > ### Title: Predict Method for FMmodel Objects > ### Aliases: predict.FMmodel > > ### ** Examples > > > ### Example to illustrate the usage of the method > ### Data set very small and not sparse, results not representative > ### Please study major example in general help 'FactoRizationMachines' > > # Load data set > library(FactoRizationMachines) > library(MASS) > data("Boston") > > # Subset data to training and test data > set.seed(123) > subset=sample.int(nrow(Boston),nrow(trees)*.8) > data.train=Boston[subset,-ncol(Boston)] > target.train=Boston[subset,ncol(Boston)] > data.test=Boston[-subset,-ncol(Boston)] > target.test=Boston[-subset,ncol(Boston)] > > > # Predict with 10 second-order and 5 third-order factor > model=HoFM.train(data.train,target.train) /usr/local/bin/../include/c++/v1/vector:1504:12: runtime error: addition of unsigned offset to 0x602000034ed0 overflowed to 0x602000034ec8 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/local/bin/../include/c++/v1/vector:1504:12 in ================================================================= ==36283==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000034ec8 at pc 0x7ff8ee675493 bp 0x7ffd219566b0 sp 0x7ffd219566a8 READ of size 8 at 0x602000034ec8 thread T0 #0 0x7ff8ee675492 in trainFM(Rcpp::Vector<19, Rcpp::PreserveStorage>) /data/gannet/ripley/R/packages/tests-clang-SAN/FactoRizationMachines/src/FactoRizationMachines.cpp:4:22500 #1 0x7ff8ee715f20 in _FactoRizationMachines_trainFM /data/gannet/ripley/R/packages/tests-clang-SAN/FactoRizationMachines/src/RcppExports.cpp:15:34 #2 0x7e5099 in R_doDotCall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:570:17 #3 0x9ca702 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7273:21 #4 0x9b0fad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8 #5 0xa2493b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c #6 0x9d5e38 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12 #7 0x9b0fad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8 #8 0xa2493b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c #9 0x9d5e38 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12 #10 0x9b0fad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8 #11 0xa2493b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c #12 0x9b2184 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12 #13 0xa338dc in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2774:8 #14 0x9b1bbd in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12 #15 0xb1e343 in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:258:2 #16 0xb232c0 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:308:11 #17 0xb230a5 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1082:5 #18 0x52a08a in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29:5 #19 0x7ff8ff4cb889 in __libc_start_main (/lib64/libc.so.6+0x20889) #20 0x42d829 in _start (/data/gannet/ripley/R/R-clang-SAN/bin/exec/R+0x42d829) 0x602000034ec8 is located 8 bytes to the left of 8-byte region [0x602000034ed0,0x602000034ed8) allocated by thread T0 here: #0 0x525c70 in operator new(unsigned long) /data/gannet/ripley/Sources/LLVM/6.0.x/trunk/projects/compiler-rt/lib/asan/asan_new_delete.cc:92 #1 0x7ff8ee6f59de in std::__1::__allocate(unsigned long) /usr/local/bin/../include/c++/v1/new:228:10 #2 0x7ff8ee6f59de in std::__1::allocator::allocate(unsigned long, void const*) /usr/local/bin/../include/c++/v1/memory:1793 #3 0x7ff8ee6f59de in std::__1::allocator_traits >::allocate(std::__1::allocator&, unsigned long) /usr/local/bin/../include/c++/v1/memory:1547 #4 0x7ff8ee6f59de in std::__1::__split_buffer&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator&) /usr/local/bin/../include/c++/v1/__split_buffer:311 #5 0x7ff8ee6f529d in std::__1::vector >::__append(unsigned long) /usr/local/bin/../include/c++/v1/vector:1047:53 #6 0x7ff8ee5e9bf4 in trainFM(Rcpp::Vector<19, Rcpp::PreserveStorage>) /data/gannet/ripley/R/packages/tests-clang-SAN/FactoRizationMachines/src/FactoRizationMachines.cpp:4:3037 #7 0x7ff8ee715f20 in _FactoRizationMachines_trainFM /data/gannet/ripley/R/packages/tests-clang-SAN/FactoRizationMachines/src/RcppExports.cpp:15:34 #8 0x7e5099 in R_doDotCall /data/gannet/ripley/R/svn/R-devel/src/main/dotcode.c:570:17 #9 0x9ca702 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:7273:21 #10 0x9b0fad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8 #11 0xa2493b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c #12 0x9d5e38 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12 #13 0x9b0fad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8 #14 0xa2493b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c #15 0x9d5e38 in bcEval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:6734:12 #16 0x9b0fad in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:624:8 #17 0xa2493b in R_execClosure /data/gannet/ripley/R/svn/R-devel/src/main/eval.c #18 0x9b2184 in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:747:12 #19 0xa338dc in do_set /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:2774:8 #20 0x9b1bbd in Rf_eval /data/gannet/ripley/R/svn/R-devel/src/main/eval.c:699:12 #21 0xb1e343 in Rf_ReplIteration /data/gannet/ripley/R/svn/R-devel/src/main/main.c:258:2 #22 0xb232c0 in R_ReplConsole /data/gannet/ripley/R/svn/R-devel/src/main/main.c:308:11 #23 0xb230a5 in run_Rmainloop /data/gannet/ripley/R/svn/R-devel/src/main/main.c:1082:5 #24 0x52a08a in main /data/gannet/ripley/R/svn/R-devel/src/main/Rmain.c:29:5 #25 0x7ff8ff4cb889 in __libc_start_main (/lib64/libc.so.6+0x20889) SUMMARY: AddressSanitizer: heap-buffer-overflow /data/gannet/ripley/R/packages/tests-clang-SAN/FactoRizationMachines/src/FactoRizationMachines.cpp:4:22500 in trainFM(Rcpp::Vector<19, Rcpp::PreserveStorage>) Shadow bytes around the buggy address: 0x0c047fffe980: fa fa fd fd fa fa fd fd fa fa fd fa fa fa fd fa 0x0c047fffe990: fa fa fd fa fa fa fd fd fa fa fd fd fa fa fd fa 0x0c047fffe9a0: fa fa fd fa fa fa fd fa fa fa fd fd fa fa fd fd 0x0c047fffe9b0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fd 0x0c047fffe9c0: fa fa fd fd fa fa fd fa fa fa fd fa fa fa fd fa =>0x0c047fffe9d0: fa fa fd fd fa fa fd fd fa[fa]00 fa fa fa 00 fa 0x0c047fffe9e0: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa 0x0c047fffe9f0: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa 0x0c047fffea00: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa 0x0c047fffea10: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa 0x0c047fffea20: fa fa 00 fa fa fa 00 fa fa fa 00 fa fa fa 00 fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==36283==ABORTING