Fit the user/item id and feature name mappings.

        Calling fit the second time will add new entries to existing mappings.

        Parameters
        ----------

        users: iterable of user ids, optional
        items: iterable of item ids, optional
        user_features: iterable of user features, optional
        item_features: iterable of item features, optional

def fit_partial(
        self, users=None, items=None, user_features=None, item_features=None
    ):
        """
        Fit the user/item id and feature name mappings.

        Calling fit the second time will add new entries to existing mappings.

        Parameters
        ----------

        users: iterable of user ids, optional
        items: iterable of item ids, optional
        user_features: iterable of user features, optional
        item_features: iterable of item features, optional
        """

        if users is not None:
            for user_id in users:
                self._user_id_mapping.setdefault(user_id, len(self._user_id_mapping))

                if self._user_identity_features:
                    self._user_feature_mapping.setdefault(
                        user_id, len(self._user_feature_mapping)
                    )

        if items is not None:
            for item_id in items:
                self._item_id_mapping.setdefault(item_id, len(self._item_id_mapping))

                if self._item_identity_features:
                    self._item_feature_mapping.setdefault(
                        item_id, len(self._item_feature_mapping)
                    )

        if user_features is not None:
            for user_feature in user_features:
                self._user_feature_mapping.setdefault(
                    user_feature, len(self._user_feature_mapping)
                )

        if item_features is not None:
            for item_feature in item_features:
                self._item_feature_mapping.setdefault(
                    item_feature, len(self._item_feature_mapping)
                )