0

https://templates.prediction.io/PredictionIO/template-scala-parallel-complementarypurchaseテンプレートを使用しており、 PHP-SDKprediction.ioを使用して購入イベントを挿入しています

エンジンは正常にデプロイされましたが、クエリでエラーが発生しました

curl -k -H "Content-Type: application/json" -d '{ "items": ["<item_id>"], "num": "3" }' https://localhost:8000/queries.json

エラーは以下

Stack Trace:
java.lang.RuntimeException: Unable to invoke no-args constructor for scala.collection.immutable.Set<java.lang.String>. Register an InstanceCreator with Gson for this type may fix this problem.
    at com.google.gson.internal.ConstructorConstructor$12.construct(ConstructorConstructor.java:210)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:162)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172)
    at com.google.gson.Gson.fromJson(Gson.java:803)
    at com.google.gson.Gson.fromJson(Gson.java:768)
    at com.google.gson.Gson.fromJson(Gson.java:717)
    at com.google.gson.Gson.fromJson(Gson.java:689)
    at io.prediction.workflow.JsonExtractor$.extractWithGson(JsonExtractor.scala:152)
    at io.prediction.workflow.JsonExtractor$.extract(JsonExtractor.scala:70)
    at io.prediction.workflow.ServerActor$$anonfun$24.apply(CreateServer.scala:519)
    at io.prediction.workflow.ServerActor$$anonfun$24.apply(CreateServer.scala:513)
    at spray.routing.ApplyConverterInstances$$anon$22$$anonfun$apply$1.apply(ApplyConverterInstances.scala:25)
    at spray.routing.ApplyConverterInstances$$anon$22$$anonfun$apply$1.apply(ApplyConverterInstances.scala:24)
    at spray.routing.ConjunctionMagnet$$anon$1$$anon$2$$anonfun$happly$1$$anonfun$apply$1.apply(Directive.scala:38)
    at spray.routing.ConjunctionMagnet$$anon$1$$anon$2$$anonfun$happly$1$$anonfun$apply$1.apply(Directive.scala:37)
    at spray.routing.directives.BasicDirectives$$anon$1.happly(BasicDirectives.scala:26)
    at spray.routing.ConjunctionMagnet$$anon$1$$anon$2$$anonfun$happly$1.apply(Directive.scala:37)
    at spray.routing.ConjunctionMagnet$$anon$1$$anon$2$$anonfun$happly$1.apply(Directive.scala:36)
    at spray.routing.directives.BasicDirectives$$anon$2.happly(BasicDirectives.scala:79)
    at spray.routing.Directive$$anon$7$$anonfun$happly$4.apply(Directive.scala:86)
    at spray.routing.Directive$$anon$7$$anonfun$happly$4.apply(Directive.scala:86)
    at spray.routing.directives.BasicDirectives$$anon$3$$anonfun$happly$1.apply(BasicDirectives.scala:92)
    at spray.routing.directives.BasicDirectives$$anon$3$$anonfun$happly$1.apply(BasicDirectives.scala:92)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.apply$mcV$sp(ExecutionDirectives.scala:89)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.apply(ExecutionDirectives.scala:89)
    at spray.routing.directives.ExecutionDirectives$$anonfun$detach$1$$anonfun$apply$7$$anonfun$apply$3.apply(ExecutionDirectives.scala:89)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
    at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
    at scala.concurrent.impl.ExecutionContextImpl$$anon$3.exec(ExecutionContextImpl.scala:107)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.google.gson.internal.UnsafeAllocator$1.newInstance(UnsafeAllocator.java:48)
    at com.google.gson.internal.ConstructorConstructor$12.construct(ConstructorConstructor.java:207)
    ... 33 more
Caused by: java.lang.InstantiationException: scala.collection.immutable.Set
    at sun.misc.Unsafe.allocateInstance(Native Method)
    ... 39 more

これが私のengine.jsonです

{
  "id": "default",
  "description": "Default settings",
  "engineFactory": "com.my.ComplementaryPurchaseEngine",
  "datasource": {
    "params" : {
      "appName": "store",
      "eventNames": ["buy"]
    }
  },
  "algorithms": [
    {
      "name": "algo",
      "params": {
        "basketWindow" : 120,
        "maxRuleLength" : 2,
        "minSupport": 0.001,
        "minConfidence": 0.1,
        "minLift" : 1.0,
        "minBasketSize" : 2,
        "maxNumRulesPerCond": 5,
        "eventNames": ["buy"]
      }
    }
  ]
}
4

1 に答える 1

1

curl リクエストでは、num フィールドを引用符で囲む必要はありません

curl -k -H "Content-Type: application/json" -d '{ "items": ["<item_id>"], "num": 3 }' https://localhost:8000/queries.json
于 2016-06-09T13:50:58.430 に答える