Learning Salesforce Einstein
()
About this ebook
- Make better predictions of your business processes using prediction and predictive modeling
- Build your own custom models by leveraging PredictionIO on the Heroku platform
- Integrate Einstein into various cloud services to predict sales, marketing leads, insights into news feeds, and more
This book is for developers, data scientists, and Salesforce-experienced consultants who want to explore Salesforce Einstein and its current offerings. It assumes some prior experience with the Salesforce platform.
Related to Learning Salesforce Einstein
Related ebooks
Learning Salesforce Visual Workflow and Process Builder - Second Edition Rating: 4 out of 5 stars4/5Salesforce Advanced Administrator Certification Guide: Become a Certified Advanced Salesforce Administrator with this exam guide Rating: 0 out of 5 stars0 ratingsApex Design Patterns Rating: 4 out of 5 stars4/5Salesforce Essentials for Administrators Rating: 4 out of 5 stars4/5Microsoft Power Platform A Deep Dive: Dig into Power Apps, Power Automate, Power BI, and Power Virtual Agents (English Edition) Rating: 0 out of 5 stars0 ratingsMicroservices with Azure Rating: 0 out of 5 stars0 ratingsLearning Microsoft Cognitive Services Rating: 0 out of 5 stars0 ratingsImplementing Cloud Design Patterns for AWS Rating: 0 out of 5 stars0 ratingsImplementing DevOps with Microsoft Azure Rating: 0 out of 5 stars0 ratingsMastering Non-Functional Requirements Rating: 5 out of 5 stars5/5Learning Angular for .NET Developers Rating: 0 out of 5 stars0 ratingsPower Query for Power BI and Excel Rating: 0 out of 5 stars0 ratingsImplementing Azure Solutions Rating: 0 out of 5 stars0 ratingsSAP on Azure Implementation Guide: Move your business data to the cloud Rating: 0 out of 5 stars0 ratingsBootstrap for ASP.NET MVC - Second Edition Rating: 5 out of 5 stars5/5Salesforce Reporting and Dashboards Rating: 4 out of 5 stars4/5Learning Force.com Application Development Rating: 0 out of 5 stars0 ratingsSalesforce Service Cloud Third Edition Rating: 0 out of 5 stars0 ratingsMastering Salesforce CRM Administration Rating: 4 out of 5 stars4/5Visualforce Development Cookbook Rating: 0 out of 5 stars0 ratingsMastering Application Development with Force.com Rating: 4 out of 5 stars4/5Salesforce CRM Admin Cookbook Rating: 4 out of 5 stars4/5Salesforce.com Interview Q & A & Certification Question Bank with Answers Rating: 4 out of 5 stars4/5Cloud Computing Using Salesforce: Build and Customize Applications for your business using the Salesforce Platform (English Edition) Rating: 0 out of 5 stars0 ratingsSalesforce CPQ A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsSalesforce CRM - The Definitive Admin Handbook - Fourth Edition Rating: 5 out of 5 stars5/5
Intelligence (AI) & Semantics For You
Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/5101 Midjourney Prompt Secrets Rating: 3 out of 5 stars3/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Dancing with Qubits: How quantum computing works and how it can change the world Rating: 5 out of 5 stars5/5ChatGPT For Dummies Rating: 0 out of 5 stars0 ratingsMidjourney Mastery - The Ultimate Handbook of Prompts Rating: 5 out of 5 stars5/5Enterprise AI For Dummies Rating: 3 out of 5 stars3/5The Business Case for AI: A Leader's Guide to AI Strategies, Best Practices & Real-World Applications Rating: 0 out of 5 stars0 ratingsLarge Language Models Rating: 2 out of 5 stars2/5The Insane ChatGPT Millionaire Guide Rating: 0 out of 5 stars0 ratingsArtificial Intelligence, ChatGPT and ChatSonic Rating: 0 out of 5 stars0 ratingsChatGPT: The Future of Intelligent Conversation Rating: 4 out of 5 stars4/5What Makes Us Human: An Artificial Intelligence Answers Life's Biggest Questions Rating: 5 out of 5 stars5/5The Secrets of ChatGPT Prompt Engineering for Non-Developers Rating: 5 out of 5 stars5/5ChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 0 out of 5 stars0 ratingsThe Algorithm of the Universe (A New Perspective to Cognitive AI) Rating: 5 out of 5 stars5/5ChatGPT For Fiction Writing: AI for Authors Rating: 5 out of 5 stars5/5Chat-GPT Income Ideas: Pioneering Monetization Concepts Utilizing Conversational AI for Profitable Ventures Rating: 4 out of 5 stars4/5Artificial Intelligence: A Guide for Thinking Humans Rating: 4 out of 5 stars4/5Mastering ChatGPT Rating: 0 out of 5 stars0 ratings
Reviews for Learning Salesforce Einstein
0 ratings0 reviews
Book preview
Learning Salesforce Einstein - Mohith Shrivastava
Learning Salesforce Einstein
Artificial Intelligence and deep learning for your Salesforce CRM
Mohith Shrivastava
BIRMINGHAM - MUMBAI
Learning Salesforce Einstein
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavoured to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: June 2017
Production reference: 1240617
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78712-689-3
www.packtpub.com
Credits
About the Author
Mohith Shrivastava has been working with Salesforce and Force.com since 2011, after he graduated from the National Institute of Engineering, Mysore.
He is currently 20X Salesforce certified and a Salesforce MVP. He has been actively contributing to Salesforce Stack Exchange. He loves coding on the SFDC platform and is skilled in Salesforce-specific languages, such as Apex, Visualforce, and the Lightning Component framework.
Mohith has authored Salesforce Essentials For Administrators for Packt, and he was also a technical reviewer for the book, Developing Applications with Salesforce Chatter. In his free time, he loves watching cricket and movies, hanging out with friends, and exploring the latest technologies related to web, mobile, and IoT.
I would like to thank my parents who have nurtured and helped me in all possible ways, my co-workers for their support, and my friends and family for believing in me. This would not have been possible without great support from the Packt editing team. Special thanks to my dear Salesforce community leaders, Jitendar Zha, Kartik Vishwanada, Abhishek Raj, Calvin, and Mukul for proofreading the content for me.
About the Reviewer
Raghuver Parupalli is a Salesforce System Architect working at a US Federal Agency. He worked on multiple projects in various sectors, such as federal government, finance, and non-profits. He is a proud alumni of the University of Houston. He holds multiple certifications from Salesforce and is a certified Scrum Master. He is also a co-leader of the Washington DC Salesforce Developer meetup.
Raghu has deep interest in Salesforce, data analytics, AI, and machine learning concepts.
I would like to thank my parents for their immense help and inspiration to me.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1787126897.
If you'd like to join our team of regular reviewers, you can e-mail us at customerreviews@packtpub.com. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Table of Contents
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Introduction to AI
Artificial Intelligence key terms
Machine Learning
Neural networks
Deep Learning
Natural language processing
Cognitive computing
Pattern recognition
Data mining
GPUs
Programming languages used for machine learning
Practical machine learning with Google Prediction API and Salesforce
Business scenario
Prerequisites
Training and prediction
Integration architecture
Setting authentication for calling API from SFDC
Drawback of this approach
Summary
Role of AI in CRM and Cloud Applications
Sales Cloud Einstein offerings
Automated Activity Capture
Lead Insights
Opportunity Insights
Account Insights
Community Cloud Einstein features
The Company Highlights feature on Chatter
Unanswered questions component for Community Builder
Creating Salesforce Communities
Recommended experts, articles, and topics
Marketing Cloud Einstein features
Social Studio Einstein features
Personalization Builder
Summary
Building Smarter Apps Using PredictionIO and Heroku
Introduction to PredictionIO
PredictionIO platform components
Architecture and integration with applications
Integration with web/mobile applications
Installation of PredictionIO
Prerequisites
Installing and configuring PredictionIO Event Server
Getting started with PredictionIO
PredictionIO DASE components and customization of Engine
Engine design
Query data structure
Predicted response design
Spark MLlib
Data
Algorithm
Serving
Deploying PredictionIO on Heroku
Heroku Buildpack for PredictionIO
Deploying an Event Server application
Deploying the Template Engine
Summary
Product Recommendation Application using PredicitionIO and Salesforce App Cloud
Introduction to Spark MLlib
Setting up the Event Server app on Heroku
Event Server code explanation
Setting up the Recommendation engine application on Heroku
PredictionIO Engine template code explanation
ServerApp
TrainApp
Setting up IntelliJ IDEA IDE for customizing PredictionIO application
Introduction to building Lightning Component for App Cloud and Community Cloud
Visualforce
Lightning Component framework
Component
JavaScript controller
JavaScript Helper
Component CSS file
Apex controller class
Building similar Recommendation Lightning Component for App Cloud
Custom settings for configuration parameters
The ProductViewCapture component
The SimilarProductRecommender component
PredictionIO commands cheat sheet
GitHub references
Summary
Salesforce Einstein Vision
Signing up for Einstein Vision account
Explore Einstein Vision APIs
Creation of dataset
Creating a dataset from a zip file asynchronously
Get status of the upload
Train the dataset
Get status of the training
Prediction with image file
Set up the Heroku add-on for Einstein Vision Services
Authorization setup
Procfile
Obtaining the access token from Private Key
Building Node.js application using Einstein Vision on Heroku using React
Building React UI for image upload
Scaffolding a React App
The index.js file
The App.js file
The results.js file
Middleware using Express
The Episode7 module
The update-token.js file
The fileupload.js file
Testing the application on localhost
Deployment on Heroku instance
Limitations of the application
Summary
Building Applications Using Einstein Vision and Salesforce Force.com Platform
Set up authorization between Salesforce and Einstein Vision APIs
Remote Site settings for Einstein API
Securing Private Key
Apex code utility to obtain access token
Constructing JWT Encoded Body
JWT Bearer token exchange
Creating and training dataset via Apex
Creating dataset using Apex
Monitoring status of training
Train dataset using Apex
Creating an administration app for creating and training dataset
Data model
Application and tabs
Trigger automation for dataset creation and training the model
Creating Lightning Components to recognize image
Summary
Einstein for Analytics Cloud
Setting up Wave Analytics Cloud
Enabling access and permissions to the Analytics Cloud
Creating and assigning permission sets
Creating datasets, lenses, and dashboards
Creating a dataset
Dataflow and data manager
Creating a lens from dataset
Creating interactive dashboards
Scheduling dataflow
Using transformations to create dataset
The sfdcDigest transformation
The sfdcRegister transformation
The append transformation
The augment transformation
The computeExpression transformation
The computeRelative transformation
The delta transformation
The dim2mea transformation
The edgemart transformation
The filter transformation
The flatten transformation
The sliceDataset transformation
An update transformation
Wave Analytics SAQL, XMD 2.0, and dataset Row-Level Security
Salesforce Analytics Query Language
XMD 2.0
Row-level Security for dataset
Introduction to Einstein Data Discovery
Sign up for a trial organization
Importing Salesforce data into Einstein Data Discovery and creating stories
Creating datasets from Salesforce objects
Creating stories
Summary
Einstein and Salesforce IoT Cloud Platform
IoT Cloud key terms
State machine
Orchestration
Traffic view
IoT Cloud components
Input streams and data connections
Data Pipes and data transformation
Orchestrations
Apache Kafka on Heroku
Kafka API
Apache Kafka on Heroku
Supported languages
Node.js sample code for producers and consumers
Encrypting the connection between Kafka and the Heroku web app
Import the Kafka Node.js module
Initializing producer in your Node.js application
Publish interaction events to Kafka
Consuming Kafka messages
IoT integration on the Salesforce Force.com platform
Introducing platform events
Creating platform events
Publish platform events
Subscribe to the platform events
Using CometD to subscribe to platform events
Writing unit Apex tests for platform events
Introducing identity for the Internet of Things
OAuth 2.0 Asset Token Flow for securing connected devices
Prerequisites for implementing asset token flow in Salesforce
Asset token explorer app
OAuth 2.0 authentication flow for applications on limited input devices
Request and Response for device initiating authentication flow
Request and Response samples for polling the token endpoint
Using PredictionIO on IoT events
Summary
Measuring and Testing the Accuracy of Einstein
Measuring the accuracy of Sales Cloud Einstein
Measuring the accuracy of the Einstein Lead Scoring engine
Which lead field values affect conversion rates the most?
Salesforce report to measure the accuracy of Lead Score
Measuring the accuracy of Opportunity Insights
Building evaluation metrics for the PredictionIO systems
ML tuning and evaluation in PredictionIO
Cross Validation
Building the PredictionIO evaluation module
Accuracy
Precision and recall
The f1 score
The confusion matrix
Evaluation in PredictionIO
Measuring the accuracy of Salesforce Einstein Vision
The Get model metrics
The Get model learning curve
Summary
Preface
Artificial Intelligence is empowering a variety of web and mobile applications, making them smarter and predictable. Salesforce Einstein from Salesforce brings Artificial Intelligence to its variety of cloud offerings, adding intelligence. With Einstein added to sales, service, marketing, Community Cloud, Analytics Cloud, and IoT Cloud, enterprises can leverage the power of artificial intelligence with the Salesforce data out of box without the need for data scientists. Because Einstein services are on cloud, this avoids having to set up and maintain any hardware infrastructure.
Einstein for developers offers APIs for image recognition, and with the PredictionIO framework offered by Einstein, developers can use out-of-the-box templates provided by the PredictionIO framework to create predictive engines for any machine learning task. The primary intent of this book is to cover the breadth of Salesforce Einstein. For Salesforce developers, the book provides a comprehensive coverage of what's currently available as a part of the Einstein offering, and how they can integrate with Salesforce data. For data scientists, it gives an overview of Salesforce Cloud offerings, and how machine learning is baked into the offerings.
What this book covers
Chapter 1, Introduction to AI, familiarizes you with basic terminologies used in the field of Artificial Intelligence. Learn the basics of the machine learning system by doing a small activity and integrating Salesforce with Google Machine Learning Services.
Chapter 2, Role of AI in CRM and Cloud Applications, covers a few out-of-the-box AI components from sales, service, marketing, Analytics Cloud, and Community Cloud offerings.
Chapter 3, Building Smarter Apps Using PredictionIO and Heroku, teaches you the basics of PredictionIO by configuring and setting a simple machine learning engine. This chapter also covers installation, architecture, and integration capabilities of the PredictionIO system.
Chapter 4, Product Recommendation Application using PredicitionIO and Salesforce App Cloud, teaches you how to build a simple product recommendation application using PredictionIO. This chapter covers how you can use Apex and Lightning Component and integrate SFDC with the PredictionIO Event Server and Engine.
Chapter 5, Salesforce Einstein Vision, helps you explore and learn the Salesforce Einstein Vision API. This chapter covers how you can build a Heroku node-based web application for image recognition using Einstein Vision offerings.
Chapter 6, Building Applications Using Einstein Vision and Salesforce Force.com Platform, teaches you how to use Einstein Vision API with the Salesforce Force.com platform. It also covers how you can integrate the Einstein Vision Services using Apex.
Chapter 7, Einstein for Analytics Cloud, covers the basics of the Analytics Cloud and Einstein Data Discovery offerings.
Chapter 8, Einstein and Salesforce IoT Cloud Platform, teaches you the basics of IoT Cloud offerings, Apache Kafka on Heroku add-on, Platform Events, and Identity Management on Salesforce for IoT devices.
Chapter 9, Measuring and Testing the Accuracy of Einstein, will cover how to use Salesforce reporting to measure the accuracy of the Einstein Predictions and Recommendations, and how to test and measure performance of a machine learning model.
What you need for this book
This book assumes that the reader is familiar with programming, either as an open source developer or a Salesforce developer.
Basic knowledge of Apex
The backend language for Salesforce applications is called Apex. It is a strongly-typed object-oriented language, which is syntactically very similar to Java.
Basic knowledge of Scala
PredictionIO is a Scala application, and hence familiarity with Scala will help you understand the code better. It is strongly recommended that you should try all the code covered in the book on your own local machine and try deploying the code on the Heroku free instance.
Basic knowledge of frontend technologies such as JavaScript and HTML
Salesforce Lightning components use web technology such as JavaScript and HTML, and hence having a basic knowledge will help you a great deal.
Salesforce Developer instances and MAC OS X
You will need a Mac OS X to locally test the code covered in Chapter