Difacto is refined factorization machine (FM) with sparse memory adaptive constraints.
Given an example x ∈ ℝd and an embedding dimension k, FM models the example by
where w ∈ ℝd and V ∈ ℝd × k are the models we need to learn. The learning objective function is
where the first sparse regularizer λ1|w|1 induces a sparse w, while the second term is a frequency adaptive regularization, which places large penalties for more frequently features.
Furthermore, Difacto adds two heuristics constraints
- Vi = 0 if wi = 0, namely we mark the embedding for feature i is inactive if the according linear term is filtered out by the sparse regularizer. (You can disable it by
l1_shrk = false
) - Vi = 0 if the occur of feature i is less the a threshold. In other words, Difacto does not learn an embedding for tail features. (You can specify the threshold via
threshold = 10
)
Train by Asynchronous SGD. w is updated via FTRL while V via adagrad.
The configure is defined in the protobuf file config.proto
Type | Field | Description |
---|---|---|
string | train_data | The training data, can be either a directory or a wildcard filename |
string | val_data | The validation or test data, can be either a directory or a wildcard filename |
string | data_format | data format. supports libsvm, crb, criteo, adfea, ... |
string | model_out | model output filename |
string | model_in | model input filename |
string | predict_out | the filename for prediction output. if specified, then run/ prediction. otherwise run training |
Type | Field | Description |
---|---|---|
float | lambda_l1 | l1 regularizer for w: λ1|w|1 |
float | lambda_l2 | l2 regularizer for w: λ2∥w∥22 |
float | lr_eta | learning rate η (or α) for w |
Config.Embedding | embedding | the embedding V |
int32 | minibatch | the size of minibatch. the smaller, the faster the convergence, but the/ slower the system performance |
int32 | max_data_pass | the maximal number of data passes |
bool | early_stop | stop earilier if the validation objective is less than prev_obj - min_objv_decr |
embedding V. basic:
Type | Field | Description |
---|---|---|
int32 | dim | the embedding dimension k |
int32 | threshold | features with occurence < threshold have no embedding (k = 0) |
float | lambda_l2 | l2 regularizer for V: λ2∥Vi∥22 |
advanced:
Type | Field | Description |
---|---|---|
float | init_scale | V is initialized by uniformly random weight in/ [-init_scale, +init_scale] |
float | dropout | apply dropout on the gradient of V. no in default |
float | grad_clipping | project the gradient of V into [ − cc]. no in default |
float | grad_normalization | normalized the l2-norm of gradient of V. no in default |
float | lr_eta | learning rate η for V. if not specified, then share the same with w |
float | lr_beta | leanring rate β for V. |
Type | Field | Description |
---|---|---|
int32 | save_iter | save model for every k data pass. default is -1, which only saves for the/ last iteration |
int32 | load_iter | load model from the k-th iteration. default is -1, which loads the last/ iteration model |
bool | local_data | give a worker the data only if it can access. often used when the data has/ been dispatched to workers' local filesystem |
int32 | num_parts_per_file | virtually partition a file into n parts for better loadbalance. default is 10 |
int32 | rand_shuffle | randomly shuffle data for minibatch SGD. a minibatch is randomly picked from/ rand_shuffle * minibatch examples. default is 10. |
float | neg_sampling | down sampling negative examples in the training data. no in default |
bool | prob_predict | if true, then outputs a probability prediction. otherwise ⟨x, y⟩ |
float | print_sec | print the progress every n sec during training. 1 sec in default |
float | lr_beta | learning rate β, 1 in default |
float | min_objv_decr | the minimal objective decrease in early stop |
bool | l1_shrk | use or not use the contraint Vi = 0 if wi = 0. yes in default |
int32 | num_threads | number of threads used within a worker and a server |
int32 | max_concurrency | the maximal concurrent minibatches being processing at the same time for/ sgd, and the maximal concurrent blocks for block CD. 2 in default. |
bool | key_cache | cache the key list on both sender and receiver to reduce communication/ cost. it may increase the memory usage |
bool | msg_compression | compression the message to reduce communication cost. it may increase the/ computation cost. |
int32 | fixed_bytes | convert floating-points into fixed-point integers with n bytes. n can be 1,/ 2 and 3. 0 means no compression. |