Error while training Prediction.io in naive classification?

261 Views Asked by At

Update Dec 7: I realized I need to change the files in my prediction app template. Can someone help me with creating a template for classification for strings using predictionio !!

So I am trying to train my model.

I use the following code to add data:

import predictionio

client = predictionio.EventClient( access_key='VQGpZ8NnhdQOnRn1Qtg0zOZC4Exium5RvkFIplv7zNODMTs1uDm29rgxOdsMItlq', url='

filename="docs.txt"

lines = open(filename).read().splitlines() count = 0 for l in lines:
l = l.split(',') plan = l[0] if len(plan) > 2: att = l[1].strip().split(' ') print plan print att

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

Here the docs.txt file has:

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

I use the first word as plan and the rest words as attributes.

on executing pio train, I get the error:

Exception in thread "main" org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 3.0 failed 1 times, most recent failure: Lost task 0.0 in stage 3.0 (TID 3, localhost): org.json4s.package$MappingException: Do not know how to convert JString(soy-oil) into double

0

There are 0 best solutions below