Description Usage Arguments References See Also Examples
HoFM.train
is a method training a higher-order Factorization Machine.
factors
specifies the model parameters of the Factorization Machine:
the first element specifies whether linear weights are used (1
) or not (0
),
the second element specifies the number of parameters factorizing the second-order,
the third element specifies the number of parameters factorizing the third-order,
...,
up to the tenth element specifying the number of parameters factorizing the tenth-order.
1 2 | HoFM.train(data, target, factors = c(1, 10, 5), intercept = T,
iter = 100, regular = NULL, stdev = 0.1)
|
data |
an object of class |
target |
|
factors |
|
intercept |
|
iter |
|
regular |
|
stdev |
|
[1] J. Knoll, Recommending with Higer-Order Factorization Machines, Research and Development in Intelligent Systems XXXIII, 2016.
[2] S. Rendle, Factorization Machines with libFM, ACM Transactions onIntelligent Systems and Technology (TIST), 3, 2012.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ## 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 7 second-order and 2 third-order factors
# with MCMC regularization
model=HoFM.train(data.train,target.train,c(1,7,2))
# RMSE resulting from test data prediction
sqrt(mean((predict(model,data.test)-target.test)^2))
# Predict with 10 second-order and 5 third-order factor
# with MCMC regularization
model=HoFM.train(data.train,target.train)
# RMSE resulting from test data prediction
sqrt(mean((predict(model,data.test)-target.test)^2))
# Predict with 10 second-order and 5 third-order factor
# with manual regularization
model=HoFM.train(data.train,target.train,regular=0.1)
# RMSE resulting from test data prediction
sqrt(mean((predict(model,data.test)-target.test)^2))
## End(Not run)
|
[1] 23.99256
[1] 19.58588
[1] 22.66234
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.