# NOT RUN {
### 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 an adaptive-order Factorization Machine
# using one CPU core and printing progress
model=KnoFM.train(data.train,target.train,FALSE,FALSE)
# RMSE resulting from test data prediction
sqrt(mean((predict(model,data.test)-target.test)^2))
# }
Run the code above in your browser using DataLab