deepctr_torch.models.mlr module

Author:
Wutong Zhang Weichen Shen,weichenswc@163.com
Reference:
[1] Gai K, Zhu X, Li H, et al. Learning Piece-wise Linear Models from Large Scale Data for Ad Click Prediction[J]. arXiv preprint arXiv:1704.05194, 2017.(https://arxiv.org/abs/1704.05194)
class deepctr_torch.models.mlr.MLR(region_feature_columns, base_feature_columns=None, bias_feature_columns=None, region_num=4, l2_reg_linear=1e-05, init_std=0.0001, seed=1024, task='binary', device='cpu', gpus=None)[source]

Instantiates the Mixed Logistic Regression/Piece-wise Linear Model.

Parameters:
  • region_feature_columns – An iterable containing all the features used by region part of the model.
  • base_feature_columns – An iterable containing all the features used by base part of the model.
  • region_num – integer > 1,indicate the piece number
  • l2_reg_linear – float. L2 regularizer strength applied to weight
  • init_std – float,to use as the initialize std of embedding vector
  • seed – integer ,to use as random seed.
  • task – str, "binary" for binary logloss or "regression" for regression loss
  • bias_feature_columns – An iterable containing all the features used by bias part of the model.
  • device – str, "cpu" or "cuda:0"
  • gpus – list of int or torch.device for multiple gpus. If None, run on device. gpus[0] should be the same gpu with device.
Returns:

A PyTorch model instance.

forward(X)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.