Menu Icon Close
Analytics

Unified Data Platform & Amazon personalize

Supply chain with AI
November 30, 2019
By admin
Reading Time: 4 minutes


It is beyond doubt that Personalization adds real value to the customer engagement, in fact,
around 30% page views on Amazon are from recommendations. But the question then is, why doesn’t everyone implement it and more importantly, why is it so hard to achieve good results.

The problem is multi-faceted and too many to enumerate but broadly we can divide them into:

  • Data issues

    • Multitude of systems: ERPs, CRMs, OMS, Support centres, Apps, website, POS, or in other words an alphabet soup of systems, which cater to different needs but do not “talk” to each other. Data formats and structures are different. Combining them is a real pain. 

    • Inaccurate data: Historical data might be missing values or have inaccuracies because end of the day systems is run by humans.

    • Sheer scale of data: With online e-commerce operations, the data which was huge already got humongous. Imagine a retail operation with millions of SKUs and hundreds of stores and now millions of online customers.

  • Implementation issues

    • Competency: Data science and big data technologies are relatively new and there is a genuine shortfall of trained high-quality resources. Also, enterprises need disruptive changes to bring about new age techniques like personalization.

    • Speed to market: Even if we have the best of the class engineers and data scientists, it takes a lot of time to implement, train, tune, retrain and
      improve. Most of the times, business folks lose motivation before even a couple of cycles are run.

    • A/B testing capabilities: Related to above (speed to market), implementing
      multiple techniques, comparing them, tuning them and in some cases finding a new approach is simply exhausting and very slow-moving

    • Real-time recommendations: This is when the customer is online and browsing through the millions of products and categories, needs to be presented with recommendations based on recent behaviour. A person looking for a polo shirt today might have been trying to find a helmet last week.

  • Hard problems of personalization:

    • Cold start: What happens when a customer lands on your site for the first time, you do not have contextual data for that particular customer. How do you find out what to recommend?

    • Contextual in real-time: Similar to the “real-time recommendations”, contextual personalization in real-time requires huge scaling potential and needs to factor in the current context.

    • Discovery vs Related: Although not a challenge per-se, but to be really effective the personalization has to be able to help product discovery as well as match the customer taste and context.

How we help our client implement personalization

BluePi User data platform

Our user data platform unifies data from disparate systems to one single repository, which can then provide great value to different teams/functions. The data can broadly originate in transactional systems, customer relationship management systems, customer interaction on the online/offline channels and third-party systems. A UDP not only brings all of this together but correlates and references data from all these systems, hence providing a Single Customer View which records all the user touch points.

UDP collects data from different systems – it then refines, enriches, corrects (in some cases, like for example a system might be missing some customer attributes like address), unifies the collected data, and finally, it makes this supercharged data available to different teams across the organisation and to services like Personalize.

Amazon personalize

Amazon personalize is a fully managed M/L service that makes it pretty simple to implement the personalization at your organization. This the same technology that powers personalization on Amazon website. As per AWS CEO Andy Jassy personalize service is "providing up to 50 percent more accurate forecasts than what people were doing before at one-tenth the cost of traditional supply chain software."

How does it work

Data Preparation
Amazon personalize requires data as three different datasets – User, Interaction and Item. Interaction is primarily either the clickstream or the transactional information of the user like his past purchases. This data needs to be converted to Personalize datasets using the available SDKs.

  1. Creating Dataset Group

    import boto3
    
    personalize = boto3.client('personalize')
    
    response = personalize.create_dataset_group(name = 'YourDatasetGroup')
    dsg_arn = response['datasetGroupArn']
    
    description = personalize.describe_dataset_group(datasetGroupArn = dsg_arn)['datasetGroup']
    
    print('Name: ' + description['name'])
    print('ARN: ' + description['datasetGroupArn'])
    print('Status: ' + description['status'])

  2. Creating Dataset 

    import boto3
    
    personalize = boto3.client('personalize')
    
    response = personalize.create_dataset(
        name = 'YourDataset',
        schemaArn = 'schema_arn',
        datasetGroupArn = 'dataset_group_arn',
        datasetType = 'Interactions')
    
    print ('Dataset Arn: ' + response['datasetArn'])

  3. Importing data to Dataset Group

    import boto3
    
    personalize = boto3.client('personalize')
    
    response = personalize.create_dataset_import_job(
        jobName = 'YourImportJob',
        datasetArn = 'dataset_arn',
        dataSource = {'dataLocation':'s3://bucket/file.csv'},
        roleArn = 'role_arn')
    
    dsij_arn = response['datasetImportJobArn']
    
    print ('Dataset Import Job arn: ' + dsij_arn)
    
    description = personalize.describe_dataset_import_job(
        datasetImportJobArn = dsij_arn)['datasetImportJob']
    
    print('Name: ' + description['jobName'])
    print('ARN: ' + description['datasetImportJobArn'])
    print('Status: ' + description['status'])

The above methodology works well for a dataset being consumed in batch. Personalize also gives SDK that allows integration with realtime events directly from the clickstream.

Training

Solution Personalize “solution” is the training of the algorithm/recipe on the dataset created from the above preparation step. The recipes are a predefined algorithm that Amazon Personalize has made available for different use cases, for example, User Personalization recipe that uses HRNN(hierarchical recurrent neural network). There are recipes that tackle specific problem areas like cold start, popularity and related.

To create a solution with Personalize one can use the below code snippet

import boto3

personalize = boto3.client('personalize')

print ('Creating solution')
response = personalize.create_solution(
    name = "SolutionName",
    datasetGroupArn = "Dataset group arn",
    performAutoML = True)

# Get the solution ARN.
solution_arn = response['solutionArn']
print('Solution ARN: ' + solution_arn)

# Use the solution ARN to get the solution status.
solution_description = personalize.describe_solution(solutionArn = solution_arn)['solution']
print('Solution status: ' + solution_description['status'])

# Use the solution ARN to create a solution version.
print ('Creating solution version')
response = personalize.create_solution_version(solutionArn = solution_arn)
solution_version_arn = response['solutionVersionArn']
print('Solution version ARN: ' + solution_version_arn)

# Use the solution version ARN to get the solution version status.
solution_version_description = personalize.describe_solution_version(
    solutionVersionArn = solution_version_arn)['solutionVersion']
print('Solution version status: ' + solution_version_description['status'])

Evaluation
The built model can be evaluated against metrics like coverage, mean reciprocal rank, precision, etc. All these metrics help to gauge the performance of the model. Multiple stages of hyper-parameter tuning can also be evaluated using these metrics in order to get to the best possible model that can be deployed. Model evaluation can be done as below

import boto3

personalize = boto3.client('personalize')

response = personalize.get_solution_metrics(
    solutionVersionArn = 'solution version arn')

print(response['metrics'])

Deploy and Use
The trained models can be deployed as APIs to be used for Recommendations or Creating Campaigns. The serving APIs are directly consumable by any application by utilizing the Personalize AWS SDKs.

It all ties up


As mentioned above, the BluePi UDP integrates nicely with Amazon personalize. It takes care of getting the data prepared for personalize, solving some of the problems mentioned above.

TAGS :

Invest in better
solutions today

Contact Us