CTR_Algorithm icon indicating copy to clipboard operation
CTR_Algorithm copied to clipboard

关于亚马逊数据行为序列截取的疑问

Open wangelyn opened this issue 10 months ago • 0 comments

首先非常感谢您提供的优雅的代码 关于AmazonBookPreprocess.py文件中对用户行为序列的截取代码,您定义为: def trim_cate_list(x): if len(x) > seq_len: #历史行为大于40, 截取后40个行为 return pd.Series(x[-seq_len:], index = cols) else: #历史行为不足40, padding到40个行为 pad_len = seq_len - len(x) x = x + ['0'] * pad_len return pd.Series(x, index = cols) 我的疑问是:如果后40个行为是最新的行为,那么在对不足40的行为做padding时,为什么不是x = ['0'] * pad_len+x,而是x = x + ['0'] * pad_len,毕竟不足40个行为的用户在最新时间是有点击的类别的,而不是为0

wangelyn avatar Mar 10 '25 08:03 wangelyn