Machine learning 在朴素分类中训练Prediction.io时出错?

Machine learning 在朴素分类中训练Prediction.io时出错?,machine-learning,classification,data-mining,prediction,predictionio,Machine Learning,Classification,Data Mining,Prediction,Predictionio,12月7日更新: 我意识到我需要更改预测应用程序模板中的文件。有人能帮我用predictionio为字符串创建分类模板吗 所以我试着训练我的模特 我使用以下代码添加数据: 导入预测 client=predictionio.EventClient( 访问\u key='vqgpz8nnhdqonrn1qtg0zozc4exium5rvkfiplv7znodms1udm29rgxodsmitlq', url='1〕 filename=“docs.txt” lines=open(filename).r

12月7日更新: 我意识到我需要更改预测应用程序模板中的文件。有人能帮我用predictionio为字符串创建分类模板吗

所以我试着训练我的模特

我使用以下代码添加数据:

导入预测

client=predictionio.EventClient( 访问\u key='vqgpz8nnhdqonrn1qtg0zozc4exium5rvkfiplv7znodms1udm29rgxodsmitlq', url='1〕 filename=“docs.txt”

lines=open(filename).read().splitlines()计数=0表示行中的l:
l=l.split(',')plan=l[0]如果len(plan)>2: att=l[1].strip().split(“”) 打印计划 打印附件

client.create_event(
    event="$set",
    entity_type="user",
    entity_id=5,
    properties= {
      "plan" : str(plan)
    }
)
i=0
for x in att:
  a = "attr"+str(i)
  client.create_event(
    event="$set",
    entity_type="user",
    entity_id=5,
    properties= {
      a : str(x)
    }
  )
  i =i +1   count = count + 1   print count   if count > 10:
  break
此处docs.txt文件包含:

soy-oil, cwt call averag enter oct report corn matur level nation januari agricultur price wheat rate sorghum depart reflect cover loan reuter lb februari barley releas feedgrain juli reserv grain avg oat
barley, cwt call averag enter oct report corn matur level nation januari agricultur price wheat rate sorghum depart reflect cover loan reuter lb februari barley releas feedgrain juli reserv grain avg oat
我使用第一个单词作为计划,其余单词作为属性

在执行pio训练时,我得到错误:

线程“main”org.apache.spark.sparkeException中的异常:作业 由于阶段失败而中止:阶段3.0中的任务0失败1次,最多 最近的失败:在阶段3.0中丢失了任务0.0(TID 3,本地主机): org.json4s.package$MappingException:不知道如何转换 j将(大豆油)串成双份


不知道如何将JString(大豆油)转换为double
。它似乎需要数字数据,而不是文本。您的输入数据格式正确吗?是的,我知道了,所以现在更改了问题!