Cart/Complementary purchase recommendation with UR

62 views
Skip to first unread message

Vaghawan Ojha

unread,
Apr 5, 2017, 11:08:45 PM4/5/17
to us...@predictionio.incubator.apache.org, actionml-user
Hi Pat, 

As far as the actionml docs tells me that I could be able to use the UR to recommend the cart/complementary purchase, but there seems to be no documentation regarding this. 

It would be helpful if there was a documentation for this feature. I know people have worked out and implemented the cart recommendation, but for begineer like me, it would still be like "what to do now". 

So could you help me how can I do that? If documentation is not ready yet for this, I could write one for this feature once I got what to do. 

Thanks
Vaghawan

Pat Ferrel

unread,
Apr 6, 2017, 12:04:14 PM4/6/17
to Vaghawan Ojha, us...@predictionio.incubator.apache.org, actionml-user
Yes it can be done but support is not ideal so UR v0.6.0 coming just after the release of PIO-0.11.0 (in RC now) has some enhancements that give you better options and easier queries.

To get truly complimentary purchases you need to train on shopping carts, not users purchases. So the primary input would of the form:

(shopping-cart-id, cart-purchase, product-id)

Then in < 0.6.0 you query with the currently active shopping cart id as if it is the user-id

{
    “user”: “some-shopping-cart-id”
}

In v0.6.0 you still need to train on shopping carts to get true “complimentary purchase” but the query may be easier:

{
    “Item-set”: [“product1”, “product2”]
}

The query is the current contents of the shopping cart, no fake “user-id” required. 

UR 0.6.0 will also allow you to query against a model trained on user purchases with the same query but, though the results will be "things purchased by people with similar purchasing behavior as you query item-set", it won’t be strictly “complimentary purchases”. 

Since 2 methods are supported with UR 0.6.0 you could A/B test for which has the best results. If using user purchase (instead of shopping carts) is close to as good it would be much easier since you can have user-based, item-based and shopping carts recs from the same model. Otherwise one for user-based and item-based and another for “complimentary purchases” would make 2 trains and 2 models.



--
You received this message because you are subscribed to the Google Groups "actionml-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to actionml-use...@googlegroups.com.
To post to this group, send email to action...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/actionml-user/CA%2B69RXYDeMRXOG25v%3Dadr%3DSXLk6BO811DSCYX0t6vp8EVPP1Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Vaghawan Ojha

unread,
Apr 8, 2017, 12:28:12 AM4/8/17
to Pat Ferrel, us...@predictionio.incubator.apache.org, actionml-user
Hi Pat,

Thanks I will try this in my existing app. 

Thanks
Vaghawan

On Thu, Apr 6, 2017 at 9:49 PM, Pat Ferrel <p...@occamsmachete.com> wrote:
Yes it can be done but support is not ideal so UR v0.6.0 coming just after the release of PIO-0.11.0 (in RC now) has some enhancements that give you better options and easier queries.

To get truly complimentary purchases you need to train on shopping carts, not users purchases. So the primary input would of the form:

(shopping-cart-id, cart-purchase, product-id)

Then in < 0.6.0 you query with the currently active shopping cart id as if it is the user-id

{
    “user”: “some-shopping-cart-id”
}

In v0.6.0 you still need to train on shopping carts to get true “complimentary purchase” but the query may be easier:

{
    “Item-set”: [“product1”, “product2”]
}

The query is the current contents of the shopping cart, no fake “user-id” required. 

UR 0.6.0 will also allow you to query against a model trained on user purchases with the same query but, though the results will be "things purchased by people with similar purchasing behavior as you query item-set", it won’t be strictly “complimentary purchases”. 

Since 2 methods are supported with UR 0.6.0 you could A/B test for which has the best results. If using user purchase (instead of shopping carts) is close to as good it would be much easier since you can have user-based, item-based and shopping carts recs from the same model. Otherwise one for user-based and item-based and another for “complimentary purchases” would make 2 trains and 2 models.

On Apr 5, 2017, at 8:08 PM, Vaghawan Ojha <vagha...@gmail.com> wrote:

Hi Pat, 

As far as the actionml docs tells me that I could be able to use the UR to recommend the cart/complementary purchase, but there seems to be no documentation regarding this. 

It would be helpful if there was a documentation for this feature. I know people have worked out and implemented the cart recommendation, but for begineer like me, it would still be like "what to do now". 

So could you help me how can I do that? If documentation is not ready yet for this, I could write one for this feature once I got what to do. 

Thanks
Vaghawan

--
You received this message because you are subscribed to the Google Groups "actionml-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to actionml-user+unsubscribe@googlegroups.com.

Vaghawan Ojha

unread,
Apr 19, 2017, 7:02:12 AM4/19/17
to Pat Ferrel, us...@predictionio.incubator.apache.org, actionml-user
Hi Pat,

I was trying to accomplish the cart recommendation also with properties in the events, so my events looks something like this: 

{"eventTime":"2016-01-01T07:19:17+05:41","entityType":"user","targetEntityType":"item","event":"purchase","entityId":"firstcartid","targetEntityId":"product12","properties":{"store_id":"2"}}
{"eventTime":"2016-01-01T07:06:51+05:41","entityType":"user","targetEntityType":"item","event":"purchase","entityId":"secondcartid","targetEntityId":"product23","properties":{"store_id":"3"}}
{"eventTime":"2016-01-01T07:06:51+05:41","entityType":"user","targetEntityType":"item","event":"purchase","entityId":"firstcartid","targetEntityId":"product101","properties":{"store_id":"3"}}

And I would query it like this: 

curl -H "Content-Type: application/json" -d '
> {
>     "user": "CM/00074305/16",
>     "num":4,
>     "fields": [
>     {
>       "name": "store_id",
>       "values": ["2"]
>     }
>   ]

It works without bias. But I don't think it's a valid way. I meant, if I'm not wrong, I should have $set in the events, but if I use $set in the events, then I won't have option to put both cart id as user and product id as item. 

Can you please add your suggestion? 

Pat Ferrel

unread,
Apr 19, 2017, 10:38:53 AM4/19/17
to Vaghawan Ojha, us...@predictionio.incubator.apache.org, actionml-user
The UR v0.6.0 will be out in days and make this much easier.


On Apr 19, 2017, at 4:02 AM, Vaghawan Ojha <vagha...@gmail.com> wrote:

Hi Pat,

I was trying to accomplish the cart recommendation also with properties in the events, so my events looks something like this: 

{"eventTime":"2016-01-01T07:19:17+05:41","entityType":"user","targetEntityType":"item","event":"purchase","entityId":"firstcartid","targetEntityId":"product12","properties":{"store_id":"2"}}
{"eventTime":"2016-01-01T07:06:51+05:41","entityType":"user","targetEntityType":"item","event":"purchase","entityId":"secondcartid","targetEntityId":"product23","properties":{"store_id":"3"}}
{"eventTime":"2016-01-01T07:06:51+05:41","entityType":"user","targetEntityType":"item","event":"purchase","entityId":"firstcartid","targetEntityId":"product101","properties":{"store_id":"3"}}

And I would query it like this: 

curl -H "Content-Type: application/json" -d '
> {
>     "user": "CM/00074305/16",
>     "num":4,
>     "fields": [
>     {
>       "name": "store_id",
>       "values": ["2"]
>     }
>   ]

It works without bias. But I don't think it's a valid way. I meant, if I'm not wrong, I should have $set in the events, but if I use $set in the events, then I won't have option to put both cart id as user and product id as item. 

Can you please add your suggestion? 

On Sat, Apr 8, 2017 at 10:13 AM, Vaghawan Ojha <vagha...@gmail.com> wrote:
Hi Pat,

Thanks I will try this in my existing app. 

Thanks
Vaghawan
On Thu, Apr 6, 2017 at 9:49 PM, Pat Ferrel <p...@occamsmachete.com> wrote:
Yes it can be done but support is not ideal so UR v0.6.0 coming just after the release of PIO-0.11.0 (in RC now) has some enhancements that give you better options and easier queries.

To get truly complimentary purchases you need to train on shopping carts, not users purchases. So the primary input would of the form:

(shopping-cart-id, cart-purchase, product-id)

Then in < 0.6.0 you query with the currently active shopping cart id as if it is the user-id

{
    “user”: “some-shopping-cart-id”
}

In v0.6.0 you still need to train on shopping carts to get true “complimentary purchase” but the query may be easier:

{
    “Item-set”: [“product1”, “product2”]
}

The query is the current contents of the shopping cart, no fake “user-id” required. 

UR 0.6.0 will also allow you to query against a model trained on user purchases with the same query but, though the results will be "things purchased by people with similar purchasing behavior as you query item-set", it won’t be strictly “complimentary purchases”. 

Since 2 methods are supported with UR 0.6.0 you could A/B test for which has the best results. If using user purchase (instead of shopping carts) is close to as good it would be much easier since you can have user-based, item-based and shopping carts recs from the same model. Otherwise one for user-based and item-based and another for “complimentary purchases” would make 2 trains and 2 models.

On Apr 5, 2017, at 8:08 PM, Vaghawan Ojha <vagha...@gmail.com> wrote:

Hi Pat, 

As far as the actionml docs tells me that I could be able to use the UR to recommend the cart/complementary purchase, but there seems to be no documentation regarding this. 

It would be helpful if there was a documentation for this feature. I know people have worked out and implemented the cart recommendation, but for begineer like me, it would still be like "what to do now". 

So could you help me how can I do that? If documentation is not ready yet for this, I could write one for this feature once I got what to do. 

Thanks
Vaghawan

-- 
You received this message because you are subscribed to the Google Groups "actionml-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to actionml-user+unsubscribe@googlegroups.com.
To post to this group, send email to action...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/actionml-user/CA%2B69RXYDeMRXOG25v%3Dadr%3DSXLk6BO811DSCYX0t6vp8EVPP1Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "actionml-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to actionml-use...@googlegroups.com.

To post to this group, send email to action...@googlegroups.com.

Vaghawan Ojha

unread,
Apr 21, 2017, 6:16:36 AM4/21/17
to Pat Ferrel, us...@predictionio.incubator.apache.org, actionml-user
Ok, Thank you! 

To post to this group, send email to actionml-user@googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups "actionml-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to actionml-user+unsubscribe@googlegroups.com.
To post to this group, send email to actionml-user@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages