使用多个文件训练机器学习模型

发布于 2025-01-18 04:22:36 字数 425 浏览 1 评论 0原文

我是深度学习方面的新手,特别是每次处理多个文件。我有一个文件文件夹,我希望我的模型(LSTM)文件使用所有这些文件进行训练。

我可以在路径文件的循环中使用 model.fit() 吗?这有意义吗?或者我应该尝试将其连接到一个数组中?在这种情况下,问题是特征具有不同的范围。

import os 
rootdir = '/content/Data' #looping over files
for filename in os.listdir('/content/Data'):
 with open(os.path.join(rootdir, filename)) as f:   
  A = np.loadtxt(f)     model.fit(x_train, y_train, batch_size=50, 
  epochs=20, shuffle=True)

I'm kind of new in working with deep learning, and specially with more than one file per time. I have a folder of files, and I want that my model(LSTM) files train with all that files.

Can I just use model.fit() inside a loop of a path files? Would it make sense? Or I should try to concatenate that into a single array? In this case the problem is the features have different ranges.

import os 
rootdir = '/content/Data' #looping over files
for filename in os.listdir('/content/Data'):
 with open(os.path.join(rootdir, filename)) as f:   
  A = np.loadtxt(f)     model.fit(x_train, y_train, batch_size=50, 
  epochs=20, shuffle=True)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文