更新对分数没有影响(Prediction API)

时间:2012-06-27 19:39:57

标签: ruby google-prediction

我正在尝试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次。其次,我尝试使用从简单维基百科中抽取的~150个独特的句子,每次更新一次。每次更新都“成功”:

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

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

我也尝试过使用API​​ 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"

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

1 个答案:

答案 0 :(得分:1)

2019更新

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

  

选择迁移到Google Cloud Machine Learning Engine的开发人员将必须重新创建其现有的Prediction API模型。

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