A recommendation system is a machine learning or artificial intelligence (AI) algorithm that suggests or recommends additional products to customers using big data.
To help users find products and services they might not have found on their own, recommender systems are very helpful.
In this blog, we will discuss Advanced concepts of Recommendation AI in deep detail. The series of Recommendations AI consists of three parts. This is the final part; for the other two parts, you may refer to Introduction to Recommendations AI and Basics of Recommendations AI.
Evaluating Recommendations Before Updating Website
A recommendation is evaluated before updating the website to verify that your model and serving configuration are performing as you had hoped.
Steps to preview recommendations are:
✏️ Visit the Google Cloud console's Retail Evaluate page.
✏️ Select the Recommendations tab if it isn't already selected.
✏️ Choose the serving configuration that you want to see in advance.
✏️ Enter a visitor ID if you want to see a preview of recommendations for that user.
✏️ To get associated recommendations for an item, click Add item and enter a product ID if the Associated items section is visible. Multiple associated items can be added.
Items can be added only when the serving configuration's model type calls for products as input for recommendations. "Recommended for You" models don't need associated items entered.
✏️ To view the outcome of the prediction, click Prediction preview.
Getting Recommendations for Prediction
Send a POST request with the appropriate request body to the predict REST method to get a suggestion:
🦾 You must use a service account with the role "Retail Viewer" or higher.
🦾 The serving configuration where you use the predictions should be substituted for SERVING_CONFIG_ID.
🦾 If you imported Google Analytics 360 user events using BigQuery, set visitorId to the Google Analytics
client ID.
🦾 If you're running an A/B experiment, set experimentIds to the ID for this experiment group.
🦾 For the user action that started the request for a recommendation, provide a user event object.
🦾 Offer a filter as an option to limit the possible products returned.
Any URL you provide in response to this forecast must have the attribution token value associated with it and be returned with user events for those URLs.
Price Reranking in Recommendation AI
Price reranking arranges recommended products with a similar recommendation probability in ascending order of price, starting with the most expensive products.
It can be configured per prediction request or at the serving configuration level.
The price reranking setting you select when building a serving configuration in the Google Cloud console automatically applies to all recommendations served by that configuration.
Using Recommendations Filter for Prediction
By using the filter field, you can filter the recommendations returned by Recommendations AI.
The filter field accepts two types of filter specifications:
Tag Expressions: You can specify that only products that match every tag you filter on are returned as recommendations if you added tag values to your products before uploading them.
The boolean operators OR and NOT may be used in tag expressions, but they must be separated from the tag values by one or more spaces.
filterOutOfStockItems: Filtering out items with a stockState of OUT_OF_STOCK is done using the filterOutOfStockItems flag.
Utilizing the userEvents.purge method, you can get rid of any user events that were improperly recorded.
Using a filter string, you can specify the events you want to ignore. Applying a filter to the eventTime, eventType, visitorID, and userID fields support the selective deletion of user events.
The time range in this filtering example must adhere to the Zulu Time date format. Force field settings are set to false.
After importing a catalog into the Retail API, this part will show how to manage your product information. Your catalog contains products that you can read, write, and delete.
Uploading a product catalog
Steps to upload a product catalog:
✍️ Create a single product item by utilizing the products.create REST method.
GET requests can be made to the products endpoint and replacing PRODUCT_ID with the ID of the product you want to retrieve, you can retrieve a specific product item:
In this part of Recommendation AI, we will see how to obtain details about errors during operations using the Retail API, including user events and catalog imports.
Aggregating Integration Errors
Use the Monitoring tab on the Monitoring & Analytics page to view the aggregated errors produced by your data upload processes, prediction requests, and search requests.
All errors for the Retail API are shown on the Monitoring & Analytics page. The product catalog, user events, Recommendations AI predictions, Retail Search results, and models have errors that can be viewed.
Click the error itself to view the logs for a specific error in Cloud Logging.
By expanding that log, you can view specific error logs individually. The request's payloads, both for the request and the response, as well as any errors, are all detailed in the error logs.
Specific Integration Operations Status
In the Activity status window, you can check the progress of a particular integration operation:
🚀 Go to the Google Cloud console's Retail Data page.
🚀 Choose Activity status.
The long-running operations on your product catalog, user events, and controls are displayed in the Activity Status window.
🚀 To view the log files for any operation that has encountered a problem, click View logs in the Detail column in Cloud Logging.
Types of Error in Recommendation AI
Some errors in Recommendation AI are:-
1. FIELD_VALUE_TOO_SMALL: If a field's value is less than the required minimum, such as a negative price, it is considered to be too small.
2. FIELD_VALUE_EXCEEDED: The value entered in the field exceeds the permissible upper limit.
3. FIELD_SIZE_EXCEEDED: There are more entries in the field than allowed.
4. MISSING_FIELD: A necessary field value is missing, such as the title of a catalog item.
5. INVALID_TIMESTAMP: The timestamp is invalid because it is formatted improperly or is too far in the future.
6. INVALID_LANGUAGE_CODE: The timestamp is invalid because it is formatted improperly or is too far in the future.
7. INVALID_RESOURCE_ID: The resource ID is incorrect; an illustration would be a resource name that contains an invalid catalog id.
8. INVALID_FORMAT: The field is improperly formatted, such as with a truncated string
9. INVALID_API_KEY: The API key does not match the project in your request.
10. BATCH_ERROR: The request contains multiple errors, such as a 10-item inline import that fails validation for a variety of reasons.
Unjoined Events in Recommendation AI
Unjoined events occur when a user event or API request makes reference to a product that hasn't yet been added to Retail. Unjoined user events and requests are still logged and processed, but neither can be used to improve the model's predictive power in the future.
Because of the above reason, you should make sure that the percentage of unlogged events for both user events and prediction requests is very low.
Frequently Asked Questions
What is supervised machine learning?
Supervised learning requires outside supervision for the machine to learn from data. The supervised learning models are trained using the labeled dataset.
What is unsupervised machine learning?
Unsupervised learning is a type of machine learning where the computer can make its own decisions based solely on the data it is given. Unsupervised models can be trained using the unlabeled dataset.
What is reinforcement machine learning?
In reinforcement learning, an agent produces actions to interact with its environment and learns from feedback. Rewards are given to the agent as feedback.
Conclusion
Congratulations on finishing the blog! We have studied Advanced Concepts of Recommendation AI. We further looked at the prediction, managing user events, managing catalog, and error reporting in Recommendation AI We sincerely hope that this blog has improved your understanding of Recommendation AI, and if you want to learn more, then you can check articles on:-
Please refer to our guided pathways on Code studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. Enroll in our courses, and use the accessible sample exams and questions as a guide. For placement preparations, look at the interview experiences and interview package.
Please do upvote our blogs if you find them helpful and informative!