[英]external dataset learning in python for machine learning
嗨,我想使用naivebayesclassifier对数据集进行分类。为此,我想使用我从google下载的外部数据集。此数据集包含两个用于正面评论和负面评论的文件夹。每个文件夹包含1000个.txt文件。如何导入此文件在我的代码中作为python中的火车数据集。我是机器学习的新手,所以我对此不太了解,请帮帮我。
You can use os.listdir
, from ( https://docs.python.org/2/library/os.html ), eg: 您可以使用( https://docs.python.org/2/library/os.html )中的
os.listdir
,例如:
import os
fileList = os.listdir('train_directory')
for file in fileList:
# add content of file to dataset.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.