Newer Version Available

This content describes an older version of this product. View Latest

DiscoveryAIModel

Represents the metadata associated with a model used in Einstein Discovery.

A model is a sophisticated, custom algorithm that Einstein Discovery generates based on a comprehensive, statistical understanding of past outcomes. Einstein Discovery uses models to predict future outcomes. A model accepts the values of one or more predictor variables as input and produces a predicted outcome as output, along with (optionally) top factors and improvements. In Package Manager, this type is listed as "Discovery Model".

You can also build models using a third-party modeling tool, and then import them into Salesforce using Model Manager in Analytics Studio.

Write operations for DiscoveryAIModel objects are generally not supported.

Note

Declarative Metadata File Suffix and Directory Location

A DiscoveryAIModel is stored in the discovery folder. DiscoveryAIModels have two files:
  • file with .model suffix contains the model's actual data
  • file named ModelName.model-meta.xml suffix contains the model's metadata
Here is a sample package.xml file:
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>Maximize_Sales</members>
5        <name>DiscoveryAIModel</name>
6    </types>
7    <version>53.0</version>
8</Package>

Version

DiscoveryAIModels are available in API version 51.0 and later.

Fields

Field Name Field Type Description
algorithmType DiscoveryAlgorithmType Algorithm that Einstein Discovery used to create the model associated with this story.
classificationThreshold double Threshold value. Applies only to binary classification models. For regression models, this is null.
description string Model description.
label string Model label. If you package a model, this label appears in Package Manager.
modelFields DiscoveryModelField[] One or more model fields (variables).
modelRuntimeType DiscoveryModelRuntimeType Model run-time type.
predictedField string Name of the field that is predicted.
predictionType DiscoveryPredictionType Type of prediction. One of the following strings:
  • Regression
  • Classification
  • Unknown
sourceType DiscoveryModelSourceType Source type.
status DiscoveryAIModelStatus Model status (enabled or disabled).
trainingMetrics string JSON object that represents metrics about the model when it was trained.
transformations DiscoveryModelTransform One or more model transformations.

DiscoveryAlgorithmType

Represents the algorithm that Einstein Discovery used to create the model.

Field Name Field Type Description
Best string Tournament Model. Genetic algorithm used to generate high-quality solutions to optimization and search problems, like optimizing decision trees for better performance.
Glm string Generalized Linear Model. Regression-based algorithm.
Gbm string Gradient Boost Machine. Decision tree-based ensemble machine learning algorithm.
Xgboost string XGBoost. Decision tree-based ensemble machine learning algorithm.
Drf string Random Forest. Supervised learning algorithm that uses multiple decision trees, randomization, and other optimization techniques.

DiscoveryModelField

Represents a field (variable) in the model.

Field Name Field Type Description
isDisparateImpact boolean Indicates whether the field is disparate impact (true) or not (false).
isSensitive boolean Indicates whether the field is sensitive (true) or not (false).
label string Field label displayed in the UI.
name string Field name.
type DiscoveryModelFieldType Field type. Enumerated.
values string[] A list of field values.

DiscoveryModelTransform

Represents a transformation in the model.

Field Name Field Type Description
config string The configuration for the transformation.
sourceFieldNames string[] A list of the source field names.
targetFieldNames string[] A list of the target field names.
type DiscoveryAIModelTransformationType Type of transformation.

DiscoveryAIModelTransformationType

Represents the type of transformation to apply before making a prediction.

Field Name Field Type Description
TypographicClustering string Typographic clustering transformation.
SentimentAnalysis string Sentiment analysis transformation.
FreeTextClustering string Free text clustering transformation.
NumericalImputation string Numerical imputation transformation.
CatagoricalImputation string Catagorical imputation transformation.
TimeSeriesForecast string Time series forecast transformation.
ExtractMonthOfYear string Extract month of year transformation.
ExtractDayOfWeek string Extract day of week transformation.
ZipCodeAnalysis string Zip code analysis transformation.

DiscoveryModelFieldType

Represents the data type of a model field.

Field Name Field Type Description
Text string Text data type.
Number string Number data type.
Date string Date data type.

DiscoveryModelRuntimeType

Represents the model run-type.

Field Name Field Type Description
Discovery string The model run-type is Einstein Discovery.
H2O string The model run-type is H20.
T string The model run-type is Tensorflow v2.4.4.
Tf27 string The model run-type is Tensorflow v2.7.0.
SC102 string The model run-type is Scikit Learn v1.0.2.

DiscoveryModelSourceType

Represents the source tool used to build the model: Discovery or an external tool (the model was uploaded into Salesforce).

Field Name Field Type Description
Discovery string Einstein Discovery built the model.
UserUpload string An external tool built the model. The model was then uploaded into Salesforce.

This source type is not supported in the Metadata API.

Note

DiscoveryAIModelStatus

Represents the status of the model (Enabled or Disabled).

Field Name Field Type Description
Disabled string The model is disabled (inactive).
Uploading string The model is uploading.
UploadFailed string The model failed to upload.
UploadCompleted string The model upload is complete.
Validating string The model is validating.
ValidationFailed string The model validation failed.
ValidationCompleted string The model validation is complete.
Enabled string The model is enabled (active).

Declarative Metadata Sample Definitions

Here is a sample DiscoveryAIModel:
1<?xml version="1.0" encoding="UTF-8"?>
2<DiscoveryAIModel xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3   <content xsi:nil="true"/>
4   <algorithmType>Glm</algorithmType>
5   <classificationThreshold>0.7383</classificationThreshold>
6   <label>Maximize Tenure</label>
7   <modelFields>
8      <label>Field</label>
9      <name>Field</name>
10      <type>Text</type>
11   </modelFields>
12   <modelFields>
13      <label>PTO</label>
14      <name>PTO</name>
15      <type>Number</type>
16   </modelFields>
17   <modelFields>
18      <label>Level</label>
19      <name>Level</name>
20      <type>Text</type>
21   </modelFields>
22   <modelFields>
23      <label>Salary</label>
24      <name>Salary</name>
25      <type>Number</type>
26   </modelFields>
27   <modelFields>
28      <label>Tenure</label>
29      <name>Tenure</name>
30      <type>Number</type>
31   </modelFields>
32   <modelRuntimeType>Discovery</modelRuntimeType>
33   <predictedField>Tenure</predictedField>
34   <predictionType>Classification</predictionType>
35   <sourceType>Discovery</sourceType>
36   <status>Enabled</status>
37</DiscoveryAIModel>

Wildcard Support in the Manifest File

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.