Einstein prediction builder to predict and lightning object creator to create an Object and import the records to that Object using a .csv file

The idea of Heart Disease prediction came from one of my friend for her undergraduate research project. So she asked my help to do this project. But she is not aware of the Salesforce as well as about the Einstein Platform. So I just asked her the available dataset to Predict what she needs for her project.

Abstract

With the help of existing real health records of people, the prediction model will predict whether a new record which doesn’t fit the criteria for the “Example Set” has Heart Disease or not.

Cleaned Up the Data

Cleaned up the data with user understandable description. For Example, In the data, there is a column called sex with the value 0, 1(Female, Male) is not descriptive for the user, so for that just replace the values for 0,1 with Female and Male respectively. Similarly cleaned up all the data.

Import all the Records to Salesforce

Use the Spreadsheets Into Objects with the lightning object creator feature to create an object, fields and also can import the data to those object by using a lightning-wizard like below.

Go to https://object-creator.salesforce.com/ link and do login using the dev org credentials of an Einstein enabled Salesforce org.

object creator 1st screen

Click Upload files and choose your file(I have the data in .csv file). When it finishes uploading the file, it will be redirected to the following screen

Filed Mapping Screen

There you can see the fields are mapped to create to the Salesforce. What are the options are available on the above screen?

  1. The label of the Salesforce field is automatically detected from the imported file field names according to the Field Label Source checkbox selection. When you select as ‘Detect from now’ checkbox will automatically detect the field label and if you wish you can change the name of the fields at this screen to create fields.
  2. You have an option in this screen to select whether you are going to import the record or not by selecting ‘Yes, import data’ checkbox. If you select no you can do it later by using Data Import Wizard.
  3. You can select a field from the uploaded file to generate the standard Name field of an Object if not the wizard itself will generate a Standard Name field.
  4. You can select up to 10 fields to put into the default layout and ‘All’ listview of this Object.
  5. You can see the data preview as by clicking the eye icon.

Then click Next can bring you to the following screen.

Object Naming screen

In the above screen, you can name the Object in which you are going to import the Uploaded file’s data. Then click Finish.

Then the wizard will be creating the object, assign the layout, creating listviews and also will import the data if you select as ‘Yes, import data’ in the previous screen.

Object creation

Nice Work! We have completed the creation of an object and its fields using a very simple way with the help of the lightning wizard.

Nice Work!!

You can verify the records in the Salesforce Org!! like below.

The details of the newly created records

Create/ Build the Prediction

Login to your Einstein enabled Salesforce org -> Home

Einstein Dev Org setup home page

Click the Einstein Prediction Builder under the Setup Home to create a Prediction.

Einstein Prediction Builder Setup Page

Click the ‘New Prediction’ button to create a prediction. When you click the button it will bring you to a wizard. Follow the following steps to create the prediction.

Name your Prediction -> Next

Prediction Naming Screen

Select the Object to Predict + Select whether you need all data or a set of data of that object to use for the Prediction model -> Next

In my use case, I am taking all the record of the Object. In all the screen you can Check the data count by clicking the Check Data button on the right side of the screen.

Object and record segment selection

In the next screen, you have to select a field to Predict. In this case, the field is ‘Is Heart Disease’ and also you have to select the records which you are going to use as a Sample set to Analyze the model to create predictions for the other records or newly created record.

As a sample scenario to explain the Prediction Builder I am taking here all the male records to analyze using the Prediction Builder as the Sample set and from that, I am going to score all the Female records to check whether they have heart disease or not.

Predict Field Selection

Select in which fields you are going to to use to create your Prediction. In default, it will select all the fields but you can uncheck the biased fields to generate the model.

Field Selection to Use for Prediction

You have to name a field is going to automatically create in the object by Salesforce to store the score of the prediction.

Create a field to store the results

In the next screen, you can see the details of the selections you made in the previous steps(Overall details).

Then Click Build Prediction button in the above screen. Then the Einstein platform will be evaluating the records and predict for the records other than the example Set records.

Yay!!

It will take some to evaluate the records to build the model. You will get a notification after finishing the model generation.

Prediction Builder Notification

Then you can see the scorecard details about the prediction model by clicking the down arrow button in the right side of a prediction.

Scorecard of the Prediction

In this screen, you can see the overview of the model we have created, as well as in the Predictors tab you can select a field to see the impact of each of its values.

Predictors Tab details

After checking the scorecard enable the prediction by clicking the Enable option at the down arrow button in the right side of a prediction.

Then the Prediction will start scoring to the Female records to score whether the person has Heart Disease or not. You can see the score by the Prediction like below in the object,

In addition to that, the scoring for the Prediction is using a Batch in every one hour in the background. So when you creating a new or changed a record that doesn’t fit the criteria for the “Example Set” will be scored in one hour in worst.

Note

Here I took only one field to get the Sample set of records to build the prediction is not good. So just add more fields to evaluate records to predict for the unfit records will give you the great prediction. But you need more records to get a good scorecard.

Conclusion

Einstein is a powerful platform to predict something you need from a set of records by using easy steps wizard screens.

Is it so cool !!!! Then try it guys you will be love this guy ‘Einstein’

References

https://trailhead.salesforce.com/en/content/learn/modules/einstein-prediction-builder/get-started-with-prediction-builder

Hariprasath Thanarajah

Written by

4 + of experience in Software Development and became a certified Salesforce Developer to develop end-to-end feature for Salesforce non-profit package Converse.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade