predictionio-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pat Ferrel <>
Subject Re: PredictionIO return array of objects
Date Sat, 17 Jun 2017 14:39:26 GMT
To attach properties to items in the UR you will have to denormalize so the only key is the
item-id, and they are set using $set events. I have commented on the feature request.

On Jun 16, 2017, at 9:13 PM, Cody Kimball <> wrote:

It is very likely that the metadata will change periodically, so unfortunately I won't be
able to denormalize. A key value store is certainly a possibility that could be integrated
into returned predicted responses.

@Pat, I went ahead and created that issue with the feature request. Meantime in effort to
maximize the potential and use of PredictionIO I am trying to see where the properties are
being stripped out. I am assuming this is done in Serving.scala?

On Fri, Jun 16, 2017 at 2:18 PM Donald Szeto < <>>
It also depends on how much you are willing to denormalize. If your items' metadata don't
change, it would be fine to send items' metadata in as part of the event.

If you cannot denormalize and your scale is huge, you might want to consider putting metadata
in a KV store.

On Fri, Jun 16, 2017 at 12:19 PM, Pat Ferrel < <>>
If you are setting properties of items, these are internally returned with the item ids and
stripped off from the results before the query response. I think it would be a simple mod
to leave them instead of stripping so you’d have to mod the code and later merge with newer
updates if they are required. 

This would require you send $set events to the EventServer with properties for every item
but not all possible types are supported and the format of the returned properties is fixed
so you would need to deal with that. Basically all attributes must be encoded in named JSON
arrays of strings like “image”: [“http://image/url <http://image/url>”] etc.

This is not the first time we’ve been asked for this so you can add a feature request:

On Jun 16, 2017, at 10:55 AM, Cody Kimball < <>>

Sorry yes, I am using the Universal Recommender put up by ActionML. 

I am hoping to avoid spinning up another service to simply return the queried results (title,
description, image) to augment the prediction results. However, if that is the only way to
do this, then I'll follow down that path. 

On Fri, Jun 16, 2017 at 11:27 AM Pat Ferrel < <>>
What template? Generally this requires you take the id and make a query to your catalog DB.

On Jun 16, 2017, at 9:50 AM, Cody Kimball < <>>

Architectural Design Question:

I have a model that performs as expected and returns an array of ID's with their associated
scores. Now as I am trying to get the PIO response to render their associated pieces of content
on our website, it looks like I will need not only those IDs but other meta tag values as
well to render the pieces of content on the website properly.

My question is can the PredictionIO response array of objects be easily configured to return
the TargetEntityID and score, as exists currently, as well as with a few specific items it
pulls from the property list?


    {"item":"22","score":4.072304374729956, "title":"title1", "description":"helpful meta
description1", "image":"imageurl1"},
    {"item":"62","score":4.058482414005789, "title":"title2", "description":"helpful meta
description2", "image":"imageurl2"},
    {"item":"75","score":4.046063009943821, "title":"title3", "description":"helpful meta
description3", "image":"imageurl3"},
    {"item":"68","score":3.8153661512945325, "title":"title4", "description":"helpful meta
description4", "image":"imageurl4"}

Or would it make more sense to have the input value for TargetEntityID be a json object for
PredictionIO to train on, possibly by altering the training model to only use the "ID" attribute
from that object to train on? 

    {"item": {"ID": "22", "title":"title1", "description":"helpful meta description1", "image":"imageurl1},"score":4.072304374729956},

Or even I could fudge the model to have targetEntityID be a large concatenated value, which
in my mind seems like problems waiting to happen.

    {"item": "22 || title1 || helpful meta description1 || imageurl1"},"score":4.072304374729956},

Cody Kimball
Revenue Engineer

 Don't Just Keep Up With Technology. Master It! <>

Cody Kimball
Revenue Engineer

 Don't Just Keep Up With Technology. Master It! <>

Cody Kimball
Revenue Engineer

 Don't Just Keep Up With Technology. Master It! <>

View raw message