predictionio-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Honders <dennishond...@gmail.com>
Subject Re: Only one result Universal Recommender
Date Tue, 23 May 2017 17:07:47 GMT
Still same questions as previous.

Addition to this mail:

*Engine.json*
{
  "comment":" This config file uses default settings for all but the
required values see README.md for docs",
  "id": "default",
  "description": "Default settings",
  "engineFactory": "com.actionml.RecommendationEngine",
  "datasource": {
    "params" : {
      "name": "ur-name",
      "appName": "Test",
      "eventNames": ["cart-transaction"]
    }
  },
  "sparkConf": {
    "spark.serializer": "org.apache.spark.serializer.KryoSerializer",
    "spark.kryo.registrator":
"org.apache.mahout.sparkbindings.io.MahoutKryoRegistrator",
    "spark.kryo.referenceTracking": "false",
    "spark.kryoserializer.buffer.mb": "300",
    "spark.kryoserializer.buffer": "300m",
    "es.index.auto.create": "true"
  },
  "algorithms": [
    {
      "comment": "simplest setup where all values are default, popularity
based backfill, must add eventsNames",
      "name": "ur",
      "params": {
        "appName": "Test",
        "indexName": "test",
        "typeName": "cart",
        "comment": "must have data for the first event or the model will
not build, other events are optional",
        "eventNames": ["cart-transaction"]
      },
      "blacklistEvents": [],
      "num": 10,
      "maxQueryEvents": 20
    }
  ]
}

Also tried the following (added quotes to the json):

curl -H "Content-Type: application/json" -d '{"cart" : ["1"]}'
http://localhost:8000/queries.json
curl -H "Content-Type: application/json" -d '{"item" : ["1"]}'
http://localhost:8000/queries.json
curl -H "Content-Type: application/json" -d '{"items" : ["1"]}'
http://localhost:8000/queries.json

Retrieved the following error:

Stack Trace:
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
Expected BEGIN_OBJECT but was STRING at line 1 column 2
        at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176)
        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
org.apache.predictionio.workflow.JsonExtractor$.extractWithGson(JsonExtractor.scala:155)
        at
org.apache.predictionio.workflow.JsonExtractor$.extract(JsonExtractor.scala:73)
        at
org.apache.predictionio.workflow.ServerActor$$anonfun$24.apply(CreateServer.scala:479)
        at
org.apache.predictionio.workflow.ServerActor$$anonfun$24.apply(CreateServer.scala:473)
        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.IllegalStateException: Expected BEGIN_OBJECT but was
STRING at line 1 column 2
        at
com.google.gson.stream.JsonReader.beginObject(JsonReader.java:374)
        at
com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:165)
        ... 30 more

Still same questions as previous mail.

2017-05-23 16:23 GMT+02:00 Dennis Honders <dennishonders@gmail.com>:

> I trained and deployed the universal recommender.
> I only get the populair products as a result.
>
> *Trainingdata*
>
> [
> {"event": "cart-transaction", "entityId": "1", "entityType": "user",
> "targetEntityId": "12", "targetEntityType": "item"},
> {"event": "cart-transaction", "entityId": "1", "entityType": "user",
> "targetEntityId": "13", "targetEntityType": "item"},
> {"event": "cart-transaction", "entityId": "1", "entityType": "user",
> "targetEntityId": "14", "targetEntityType": "item"}
> ]‚Äč
>
> {"event": "$set", "entityType": "item", "entityId": "12", "properties":
> {"category": ["1", "2", "3", "4", "5", "6", "7"], "manufacturer": 1,
> "label": "test", "price": "$1-$2"}}
>
> *Query*
> curl -H "Content-Type: application/json" -d { "item": ["1"]}
> http://localhost:8000/queries.json
>
> curl -H "Content-Type: application/json" -d { "items": ["1"]}
> http://localhost:8000/queries.json
>
> curl -H "Content-Type: application/json" -d { "cart-transaction": ["1"]}
> http://localhost:8000/queries.json
>
> *Result*
> The populair (most bought) items, also for products that are sold a lot.
>
> Log:
>
> [INFO] [URAlgorithm] No user id for recs, returning item-based recs if an
> item is specified in the query.
> [INFO] [URAlgorithm] Query:
> {"size":10,"query":{"bool":{"should":[{"terms":{"cart-
> transaction":[]}},{"constant_score":{"filter":{"match_all":
> {}},"boost":0}}],"must":[],"must_not":[{"ids":{"values":[]
> ,"boost":0}}],"minimum_should_match":1}},"sort":[{"_score":{
> "order":"desc"}},{"popRank":{"unmapped_type":"double","order":"desc"}}]}
> [INFO] [URAlgorithm] Results: 10 retrieved of a possible 70658
>
> Is the query correct?
>
> What else could be the problem here?
>
> Note: I also like to return 'similar items' (based on properties) when no
> relation could be found with 'buy'.
>

Mime
View raw message