Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第7章 7.2节train_rmse计算代码错误 #5

Open
120L020430 opened this issue Jul 10, 2024 · 1 comment
Open

第7章 7.2节train_rmse计算代码错误 #5

120L020430 opened this issue Jul 10, 2024 · 1 comment

Comments

@120L020430
Copy link

在纸质版图书第85页,这里计算训练集的损失函数为
train_rmse = np.sqrt(train_rmse / len(user_train))
我认为在每一批次中已经计算过当前批次的平均值,并进行累加
train_rmse += np.mean(errs ** 2)
所以这里应该修改为除以批次的数量
train_rmse = np.sqrt(train_rmse / batch_num)
微信图片_20240710112512
并且86页的运行结果图也应该修改,我的运行结果如下
output
微信图片_20240710112510

此外,我对训练集的RMSE进行重新计算

y_train_pred = model.pred(user_train, item_train)
train_rmse = np.sqrt(np.mean((y_train - y_train_pred) ** 2))
print(f'训练集RMSE:{train_rmse:.4f}')

运行结果为:
训练集RMSE:0.9608

所以我认为此处应当是出现了错误。

@120L020430
Copy link
Author

伯禹在线版图书中也发现了此问题:https://hml.boyuai.com/books/chapter7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant