You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Pallavi Goyal (JIRA)" <ji...@apache.org> on 2017/02/08 05:19:41 UTC

[jira] [Commented] (OFBIZ-5928) Prototype of a Product Association recommender

    [ https://issues.apache.org/jira/browse/OFBIZ-5928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15857428#comment-15857428 ] 

Pallavi Goyal commented on OFBIZ-5928:
--------------------------------------

The following changes are for Ofbiz 15.12

Changes in RecommenderServices.java

1. Earlier:
Attribute numbOfRecommendedProducts was an optional input in service 'getProductAssociationRecommendations' with default value 1.

Now:
Removed this attribute from service definition, as added the value in properties.

2. Earlier:
The numbOfRecommendedProducts variable was getting value as an optional input from user with default value equal to 1.

Now:
The numbOfRecommendedProducts variable is getting value from catalog.properties and default value is 3.

3. Earlier:
Each time the service 'getProductAssociationRecommendations'was invoked, it deleted the old recommendations from ProductAssoc entity. 
If new recommendations were not formed, old recommendations were also getting deleted.

Now:
A check is applied that if new recommendations are created, i.e., recommendedProducts map is NOT null, then only delete the old recommendations for the input product.
Because of this, if new recommendations are not created for any product, old recommendations will still persist for the same.

4. Earlier:
Dynamic view entity was having multiple alias for the same field for different entities.
Example:  dve.addAlias("OH", "orderId"); 
                  dve.addAlias("OI", "orderId");

Now:
Optimised the code by removing unnecessary addAlias() methods. 
Example: removed dve.addAlias(“OI', “orderId”);

5. Earlier:
There are several conditions on which AND operator is applied to get a final condition. 
For this, two conditions were taken at a time and AND operator was used on them.

Now:
Optimised the code by using list for such conditions. 
Added these conditions in list and applied the operator AND on the list.

6. Earlier:
For getting occurrences[][] of order, two distinct() methods were used in the EntityQuery.
i.e., occurrences[0][0] =                                                                                                 EntityQuery.use(delegator).select(UtilMisc.toSet("orderId")).distinct().cursorScrollSensitive().distinct().from(dve).where(condition).queryCount();

Now: 
Optimised the code by removing extra distinct() method from the code.

7. Earlier:
The jar file used was commons-math3-3.3.jar.

Now: 
Used latest version of jar file: commons-math3-3.6.1.jar file.

8. Earlier:
For getting cobought products and orders to calculate conditional probabilities, all the orders present in the database were processed irrespective of their age. (i.e., even if an order was 10 years old, it was processed.)

Now:
Added the limitation, that orders of a limited age will be processed. ( Ex: orders for last one year).
By default taking orders for last one year. Has set the property in catalog.properties.

9. Added:
A service method “createProductRecommendationsForOrderItems” in RecommenderServices.java which will invoke “getProductAssociationRecommendations” every day in mid night.

10. Added:
A new alias 'orderDate' from OrderHeader entity in dynamic view entities.

11. Added:
New entity condition to get the orders of a limited age in the entity query results. (Default: last one year orders)


For Automation of the service “getProductAssociationRecommendations” :

1.  Added a service method, “createProductRecommendationsForOrderItems”.

    This service is scheduled to run once daily in mid-night. 

    Working:

   (i) This service will get all the SALES orders present in the previous one day. 
   (ii) Then it will prepare a list of order items that were in those orders. The list will have distinct order items i.e., even though        an item is in multiple orders, it is included in the list only one time.
   (iii)For each order item in the list, invoke the service “getProductAssociationRecommendations”.

    Thus, for each product for which a sales order was present on previous day, recommendations will be refreshed for them.

2.  For scheduling, data is prepared in ScheduledJobs.xml.

3. Variable product.recommendation.numbOfRecommendedProducts is added in catalog.properties with value 3.

4. Variable product.recommendation.getOrdersFromLastDays is added in catalog.properties with value 365.

5. Passed a new parameter 'ordersFromDate' in the invocation of service 'getProductAssociationRecommendations'.

6. Also made the systemProperty entry in CommonSystemPropertyData.xml.

7. Placed the jar file commons-math3-3.6.1.jar in framework.

8. Made class path entry for the new jar file.

> Prototype of a Product Association recommender
> ----------------------------------------------
>
>                 Key: OFBIZ-5928
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5928
>             Project: OFBiz
>          Issue Type: New Feature
>            Reporter: Anahita Goljahani
>            Priority: Minor
>         Attachments: product-recommendation.patch, recommender.zip, recommender.zip
>
>
> Hi all, as anticipated in my ApacheCon Europe presentation 'Introduction to a Recommender System for Apache OFBiz' (downloadable from https://cwiki.apache.org/confluence/x/OYPfAg), I have developed a prototype of a Product Association recommender for OFBiz. Product Association recommendations are suggestions of the type 'Customers who bought this item also bought:', that are provided to online shoppers to help them in the selection of products to buy. 
> Attached to this Jira ticket you will find a zip archive containing a component named 'recommender', which implements the logic to generate Production Association recommendations. The component contains a short guide to its functionalities in the main folder. The guide also includes a short paragraph that explains how to run a recommender demo. 
> I would really appreciate any review, feedback and suggestion by anyone interested in this topic.   
> Thank you



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)