加载graphlab.SFrame时出错('home_data.gl/')

时间:2016-09-11 19:52:21

标签: machine-learning graphlab sframe

我正在华盛顿大学的Coursera学习机器学习课程。我正在使用iPython的graphlab。在练习期间,我执行以下命令:

sales = graphlab.SFrame('home_data.gl/')

我收到错误。

    IOError                                   Traceback (most recent call last)
<ipython-input-2-e6a249ea422b> in <module>()
----> 1 sales = graphlab.SFrame('home_data.gl/')

C:\Users\chinesh\Anaconda2\envs\gl-env\lib\site-packages\graphlab\data_structures\sframe.pyc in __init__(self, data, format, _proxy)
    951                     pass
    952                 else:
--> 953                     raise ValueError('Unknown input type: ' + format)
    954 
    955         sframe_size = -1

C:\Users\chinesh\Anaconda2\envs\gl-env\lib\site-packages\graphlab\cython\context.pyc in __exit__(self, exc_type, exc_value, traceback)
     47             if not self.show_cython_trace:
     48                 # To hide cython trace, we re-raise from here
---> 49                 raise exc_type(exc_value)
     50             else:
     51                 # To show the full trace, we do nothing and let exception propagate

IOError: C:\Users\chinesh\home_data.gl not found.

我可以在我的电脑上找到home_data.gl,或者问题是别的......

3 个答案:

答案 0 :(得分:1)

您需要将ipynb文件和数据文件放在同一目录中才能使上述工作正常。或者,在函数

中指定数据文件的完整路径或相对路径

sales = graphlab.SFrame(&#39; C:\ FULL-PATH \ home_data.gl /&#39;)

以下是课程阅读的链接,了解如何安排课程目录。 https://www.coursera.org/learn/ml-foundations/supplement/IT04V/reading-where-should-my-files-go

答案 1 :(得分:1)

确保将zip文件夹下载到您将处理此数据的同一文件夹中。例如:我将zip文件下载到下载然后我从下载文件中打开了我的笔记本

答案 2 :(得分:0)

按照说明操作,将培训数据下载到ipython工作目录。

转到终端并运行:

unzip home_data.gl.zip

您将在目录 home_data.gl

中看到以下文件

enter image description here

现在在ipython中,运行:

sales = graphlab.SFrame('home_data.gl/')
sales

将以表格格式显示数据:

enter image description here

相关问题