Using Machine Learning From Your Database: Danilo Poccia, Chief Evangelist (EMEA) @danilop
Using Machine Learning From Your Database: Danilo Poccia, Chief Evangelist (EMEA) @danilop
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Where to store data?
Object Storage
Unstructured
Database LOB (Large OBject)
NoSQL Database
Semi-Structured Time Series Database
Relational Database
Data
with JSON Document Extensions
NoSQL Database
Transient Memory
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Aurora: Design Considerations for High
Throughput Cloud-Native Relational Databases (2017)
Amazon Aurora: Design Considerations for High
Throughput Cloud-Native Relational Databases
Alexandre Verbitski, Anurag Gupta, Debanjan Saha, Murali Brahmadesam, Kamal Gupta,
Raman Mittal, Sailesh Krishnamurthy, Sandor Maurice, Tengiz Kharatishvili, Xiaofeng Bao
1041
https://www.amazon.science/publications/amazon-aurora-design-considerations-for-high-throughput-cloud-native-relational-databases
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Move logging and storage off the database engine
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Network IO in mirrored MySQL (not Amazon Aurora)
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Network IO in Amazon Aurora
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Aurora
• Serverless
• MySQL 5.6 and 5.7, and PostgreSQL 10.7 compatible
• Built-in synchronous Data API with an
• HTTP endpoint
• Integration with AWS SDKs
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Aurora
• Global Database
• Sub-Second Data Access in Any Region
• Read Replica Write Forwarding
• Cross-Region Disaster Recovery
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using Machine Learning directly from your databases
https://aws.amazon.com/blogs/aws/new-for-amazon-aurora-use-machine-learning-directly-from-your-databases/
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using Machine Learning directly from your databases
https://aws.amazon.com/blogs/aws/new-for-amazon-aurora-use-machine-learning-directly-from-your-databases/
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using Amazon Aurora
+ Amazon Comprehend
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Sentiment Analysis – Managing Comments
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Checking Sentiment & Confidence of Comments
SELECT comment_text,
aws_comprehend_detect_sentiment(comment_text, 'en') AS sentiment,
aws_comprehend_detect_sentiment_confidence(comment_text, 'en') AS confidence
FROM comments;
+---------------------------------------------------+-----------+--------------------+
| comment_text | sentiment | confidence |
+---------------------------------------------------+-----------+--------------------+
| This is very useful, thank you for writing it! | POSITIVE | 0.9996347427368164 |
| Awesome, I was waiting for this feature. | POSITIVE | 0.9977971315383911 |
| An interesting write up, please add more details. | NEUTRAL | 0.5156506896018982 |
| I don’t like how this was implemented. | NEGATIVE | 0.9982835054397583 |
+---------------------------------------------------+-----------+--------------------+
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Estimating Overall Sentiment from Comments
+---------------+-------+
| avg_sentiment | total |
+---------------+-------+
| 0.33333 | 3 |
+---------------+-------+
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Using Amazon Aurora
+ Amazon SageMaker
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer Churn Prediction with Amazon SageMaker Autopilot
https://github.com/awslabs/amazon-sagemaker-examples/blob/master/autopilot/autopilot_customer_churn.ipynb
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Managing Customer Churn
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Estimating (and Caching) Customer Churn
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer Churn – Some Results
+-------+------------+-----------+----------+----------+------------+-----------+----------+-----------+------------+----------+-----------+------------+------------+-------------+--------------+----------+-----------+------------+--------------------+------------+
| state | acc_length | area_code | phone | int_plan | vmail_plan | vmail_msg | day_mins | day_calls | day_charge | eve_mins | eve_calls | eve_charge | night_mins | night_calls | night_charge | int_mins | int_calls | int_charge | cust_service_calls | will_churn |
+-------+------------+-----------+----------+----------+------------+-----------+----------+-----------+------------+----------+-----------+------------+------------+-------------+--------------+----------+-----------+------------+--------------------+------------+
| KS | 128 | 415 | 382-4657 | no | yes | 25 | 265.1 | 110 | 45.07 | 197.4 | 99 | 16.78 | 244.7 | 91 | 11.01 | 10 | 3 | 2.7 | 1 | False. |
| OH | 107 | 415 | 371-7191 | no | yes | 26 | 161.6 | 123 | 27.47 | 195.5 | 103 | 16.62 | 254.4 | 103 | 11.45 | 13.7 | 3 | 3.7 | 1 | False. |
| NJ | 137 | 415 | 358-1921 | no | no | 0 | 243.4 | 114 | 41.38 | 121.2 | 110 | 10.3 | 162.6 | 104 | 7.32 | 12.2 | 5 | 3.29 | 0 | False. |
| OH | 84 | 408 | 375-9999 | yes | no | 0 | 299.4 | 71 | 50.9 | 61.9 | 88 | 5.26 | 196.9 | 89 | 8.86 | 6.6 | 7 | 1.78 | 2 | False. |
| OK | 75 | 415 | 330-6626 | yes | no | 0 | 166.7 | 113 | 28.34 | 148.3 | 122 | 12.61 | 186.9 | 121 | 8.41 | 10.1 | 3 | 2.73 | 3 | False. |
| AL | 118 | 510 | 391-8027 | yes | no | 0 | 223.4 | 98 | 37.98 | 220.6 | 101 | 18.75 | 203.9 | 118 | 9.18 | 6.3 | 6 | 1.7 | 0 | False. |
| MA | 121 | 510 | 355-9993 | no | yes | 24 | 218.2 | 88 | 37.09 | 348.5 | 108 | 29.62 | 212.6 | 118 | 9.57 | 7.5 | 7 | 2.03 | 3 | False. |
+-------+------------+-----------+----------+----------+------------+-----------+----------+-----------+------------+----------+-----------+------------+------------+-------------+--------------+----------+-----------+------------+--------------------+------------+
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer Churn – Overall Stats
+------------+----------+
| will_churn | COUNT(*) |
+------------+----------+
| False. | 2898 |
| True. | 435 |
+------------+----------+
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Customer Churn – Diving Deeper
SELECT will_churn,
AVG(acc_length),
AVG(cust_service_calls),
COUNT(*)
FROM customers_churn
GROUP BY will_churn;
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Aurora Labs for MySQL
https://awsauroralabsmy.com/ml/overview/
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Takeaways
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!
@danilop Please give me your feedback J
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved.