Public methods
Method new()
creates Creates second order Factorization Machines model
Usage
FactorizationMachine$new(
learning_rate_w = 0.2,
rank = 4,
lambda_w = 0,
lambda_v = 0,
family = c("binomial", "gaussian"),
intercept = TRUE,
learning_rate_v = learning_rate_w
)
Arguments
learning_rate_w
learning rate for features intercations
rank
dimension of the latent dimensions which models features interactions
lambda_w
regularization for features interactions
lambda_v
regularization for features
family
one of "binomial", "gaussian"
intercept
logical, indicates whether or not include intecept to the model
learning_rate_v
learning rate for features
Method partial_fit()
fits/updates model
Usage
FactorizationMachine$partial_fit(x, y, weights = rep(1, length(y)), ...)
Arguments
x
input sparse matrix. Native format is Matrix::RsparseMatrix
.
If x
is in different format, model will try to convert it to RsparseMatrix
with as(x, "RsparseMatrix")
. Dimensions should be (n_samples, n_features)
y
vector of targets
weights
numeric vector of length `n_samples`. Defines how to amplify SGD updates
for each sample. May be useful for highly unbalanced problems.
...
not used at the moment
Method fit()
shorthand for applying `partial_fit` `n_iter` times
Usage
FactorizationMachine$fit(x, y, weights = rep(1, length(y)), n_iter = 1L, ...)
Arguments
x
input sparse matrix. Native format is Matrix::RsparseMatrix
.
If x
is in different format, model will try to convert it to RsparseMatrix
with as(x, "RsparseMatrix")
. Dimensions should be (n_samples, n_features)
y
vector of targets
weights
numeric vector of length `n_samples`. Defines how to amplify SGD updates
for each sample. May be useful for highly unbalanced problems.
n_iter
number of SGD epochs
...
not used at the moment
Method predict()
makes predictions based on fitted model
Usage
FactorizationMachine$predict(x, ...)
Arguments
x
input sparse matrix of shape (n_samples, n_featires)
...
not used at the moment
Method clone()
The objects of this class are cloneable with this method.
Usage
FactorizationMachine$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.