【问题标题】:Update has no effect on scores (Prediction API)更新对分数没有影响(预测 API)
【发布时间】:2012-06-27 19:39:57
【问题描述】:

我正在试验 Google 预测示例中的 language_id.txt 数据集。现在我正在尝试使用以下方法更新模型:

def update(label, data)
  input = @prediction.trainedmodels.update.request_schema.new
  input.label = label
  input.csv_instance = [data]
  result = @client.execute(
    :api_method => @prediction.trainedmodels.update,
    :parameters => {'id' => MODEL_ID},
    :headers => {'Content-Type' => 'application/json'},
    :body_object => input
  )
  assemble_json_body(result)
end

(此方法基于一些Google sample code。)

我的问题是这些更新没有效果。无论我运行多少更新,以下是This is a test sentence. 的分数:

{
   "response":{
      "kind":"prediction#output",
      "id":"mymodel",
      "selfLink":"https://www.googleapis.com/prediction/v1.5/trainedmodels/mymodel/predict",
      "outputLabel":"English",
      "outputMulti":[
         {
            "label":"English",
            "score":0.420937
         },
         {
            "label":"French",
            "score":0.273789
         },
         {
            "label":"Spanish",
            "score":0.305274
         }
      ]
   },
   "status":"success"
}

根据“Creating a Sentiment Analysis Model”底部的免责声明,我已确保至少更新 100 次,然后才能期待任何更改。首先,我尝试使用一个句子并将其更新 1000 次。其次,我尝试使用从 Simple Wikipedia 中提取的大约 150 个独特的句子,并且每个句子都更新一次。每次更新都是“成功的”:

{"response":{"kind":"prediction#training","id":"mymodel","selfLink":"https://www.googleapis.com/prediction/v1.5/trainedmodels/mymodel"},"status":"success"}

但是这两种方法都没有改变我的结果。

我也尝试过使用 APIs Explorer(Prediction,v1.5)并以这种方式更新约 300 次。我的结果仍然没有区别。这些更新也“成功”了。

200 OK
{
"kind": "prediction#training",
"id": "mymodel",
"selfLink": "https://www.googleapis.com/prediction/v1.5/trainedmodels/mymodel"
}

我很确定模型正在接收这些更新。 getanalyze 都显示模型具有 numberInstances": "2024"。不过奇怪的是,list 显示该模型具有"numberInstances": "406"

目前,我不知道是什么导致了这个问题。

【问题讨论】:

  • 欢迎来到 Stack Overflow。在您的问题中放置“Background”、“Problem”等标题不是必需的,甚至不是标准的。相反,把它写清楚,它们就不需要了。一般来说,像大多数其他人一样格式化你的问题,你会做得很好。
  • 找到问题的答案了吗?有同样的问题
  • 介意用解决方案回答您自己的问题吗? stackoverflow.com/help/self-answer
  • 仅供参考,自 2018 年 4 月以来,Cloud Prediction API 已关闭。该服务已被 Cloud Machine Learning Engine 取代,cloud.google.com/ml-engine
  • 也许要求一个明显的例子,但是在你的第一个代码 sn-p 中MODEL_ID 的值是什么?您确定从您正在更新的同一模型中检索(更新的)预测吗?

标签: ruby google-prediction


【解决方案1】:

2019 年更新

根据 Jochem Schulenklopper 的评论,API 已于 2018 年 4 月关闭。

选择迁移到 Google Cloud 机器学习引擎的开发人员必须重新创建他们现有的预测 API 模型。

机器学习 API 示例: https://github.com/GoogleCloudPlatform/cloudml-samples

【讨论】:

    猜你喜欢
    • 2019-08-20
    • 2021-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-10
    • 2015-11-04
    • 2010-12-01
    相关资源
    最近更新 更多