【问题标题】:Creating sframe logistic classifier创建 sframe 逻辑分类器
【发布时间】:2016-03-18 21:37:08
【问题描述】:

我正在使用 graphlab-create 构建一个逻辑分类器。我的数据在一个 sframe 中(我已经使用 .dtype 进行了检查)这是针对使用亚马逊评论 zip 文件进行机器学习的 Coursera 课程:

products = sframe.SFrame('amazon_baby.gl/'
products = products[products['rating'] != 3]
products['sentiment'] = products['rating'].apply(lambda rating : +1 if rating > 3 else -1)

但是当我运行这段代码时:

model = gl.logistic_classifier.create(train_data, target='sentiment')
I get the error "ToolkitError: Input training dataset is not an SFrame. If it is a Pandas DataFrame, you may use the to_sframe() function to convert it to an SFrame."

我有什么遗漏吗?

【问题讨论】:

  • 您展示了如何定义products 变量,但在您的模型中您使用train_data。你能说明training_data是如何定义的吗?

标签: python graphlab sframe


【解决方案1】:

尝试通过graphlab而不是sframe加载数据

import graphlab products = graphlab.SFrame('amazon_baby.gl/')

model = graphlab.logistic_classifier.create(train_data, target='sentiment')

【讨论】:

  • 另外你应该提供数据拆分后的测试数据来验证
猜你喜欢
  • 1970-01-01
  • 2018-06-23
  • 2017-11-13
  • 2017-08-10
  • 1970-01-01
  • 2016-02-01
  • 2018-10-09
  • 1970-01-01
  • 2018-09-12
相关资源
最近更新 更多