lenskit.flexmf.FlexMFConfigBase =============================== .. py:class:: lenskit.flexmf.FlexMFConfigBase :canonical: lenskit.flexmf._base.FlexMFConfigBase Bases: :py:obj:`lenskit.config.common.EmbeddingSizeMixin`, :py:obj:`pydantic.BaseModel` Common configuration for all FlexMF scoring components. :Stability: Experimental .. py:attribute:: embedding_size :type: pydantic.PositiveInt :value: 64 The dimension of user and item embeddings (number of latent features to learn). .. py:attribute:: batch_size :type: int :value: 8192 The training batch size. .. py:attribute:: learning_rate :type: float :value: 0.01 The learning rate for training. .. py:attribute:: epochs :type: int :value: 10 The number of training epochs. .. py:attribute:: regularization :type: float :value: 0.01 The regularization strength. .. note:: The explicit-feedback model uses a different default strength. .. py:attribute:: reg_method :type: Literal['AdamW', 'L2'] | None :value: 'AdamW' The regularization method to use. With the default AdamW regularization, training will use the :class:`~torch.optim.AdamW` optimizer with weight decay. With L2 regularization, training will use sparse gradients and the :class:`torch.optim.SparseAdam` optimizer. .. note:: The explicit-feedback model defaults this setting to ``"L2"``. ``None`` Use no regularization. ``"L2"`` Use L2 regularization on the parameters used in each training batch. The strength is applied to the _mean_ norms in a batch, so that the regularization term scale is not dependent on the batch size. ``"AdamW"`` Use :class:`torch.optim.AdamW` with the specified regularization strength. This configuration does *not* use sparse gradients, but training time is often comparable. .. note:: Regularization values do not necessarily have the same range or meaning for the different regularization methods.