Skip to content

数据划分问题 - 全采样或根据用户按一定比例采样 #5

Description

@qyzl7

注意到 warm subset splitting 部分将训练数据直接随机划分到训练集/验证集/测试集

n_warm_val = int(args.warm_split[1] * len(warm_idx))
n_warm_test = int(args.warm_split[2] * len(warm_idx))
n_warm_train = len(warm_idx) - n_warm_val - n_warm_test

np.random.shuffle(warm_idx)
warm_train_idx = warm_idx[:n_warm_train]
warm_val_idx = warm_idx[n_warm_train:n_warm_train + n_warm_val]
warm_test_idx = warm_idx[-n_warm_test:]
org_warm_train_len = len(warm_train_idx)

这是否会放大流行度较高的用户的重要性(计算 Recall, NDCG 等指标时)

作者是否考虑参考 RecBole 的实现,即先按用户分组,再进行划分

if split_mode == "RS":
  if not isinstance(split_args["RS"], list):
      raise ValueError(f'The value of "RS" [{split_args}] should be a list.')
  if group_by is None or group_by.lower() == "none":
      datasets = self.split_by_ratio(split_args["RS"], group_by=None)
  elif group_by == "user":
      datasets = self.split_by_ratio(
          split_args["RS"], group_by=self.uid_field
      )
  else:
      raise NotImplementedError(
          f"The grouping method [{group_by}] has not been implemented."
      )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions