DiscoveryAIModel represents a predictive model used by Einstein Discovery. It accepts values for predictor variables and returns a predicted outcome, optionally with top factors and improvements. Einstein Discovery can generate the model, or an external modeling tool can build it for import through Model Manager in Analytics Studio. Package Manager lists this type as "Discovery Model".
The model's metadata is not the model itself: the asset includes both model data and a metadata description. Importing an external model through Model Manager also does not imply that the Metadata API can write that model. Write operations for DiscoveryAIModel are generally not supported.
Key Elements
| Element | What the Element Controls |
|---|---|
algorithmType |
Identifies the learning algorithm. Values are Best for a tournament model, Drf for Random Forest, Gbm for Gradient Boost Machine, Glm for Generalized Linear Model, and Xgboost for XGBoost. |
predictedField |
Names the target variable whose outcome the model predicts. Interpret it together with predictionType and classificationThreshold. |
predictionType |
The official type definition lists Regression, Classification, and Unknown. Enumeration coverage differs for MulticlassClassification, as described below. |
classificationThreshold |
A threshold used only for binary classification. It is null for regression models, not a general setting for every prediction type. |
modelRuntimeType |
Identifies the execution runtime. The official definition lists Discovery, H2O, T, Tf27, and SC102. The last three identify TensorFlow and Scikit Learn runtimes. |
sourceType |
Identifies the tool that built the model. Discovery means Einstein Discovery built it. UserUpload means an external tool built it and the model was uploaded into Salesforce; this source type is not supported in the Metadata API. |
status |
Describes activation, upload, or validation state. Enabled means active; Disabled means inactive. Upload and validation states do not by themselves mean the model is active. |
modelFields |
Describes the model's variables, including their name, label, values, and type. Variable types are Text, Number, and Date. Nested isSensitive and isDisparateImpact flags record variable designations. |
transformations |
Describes preprocessing before prediction. Each transformation connects sourceFieldNames to targetFieldNames using a type and config. |
trainingMetrics |
A JSON object serialized as a string. It records metrics from model training, not observed performance of current production predictions. |
label |
The model's display label. If the model is packaged, this label appears in Package Manager. |
Behavior and Constraints
Prediction settings work together. predictedField identifies the target, while predictionType describes the kind of outcome. For Regression, classificationThreshold is null. For binary classification, the threshold can apply. Do not extend that binary-only rule to MulticlassClassification.
Algorithm, runtime, and origin are different properties. algorithmType describes the learning algorithm, modelRuntimeType describes where the model executes, and sourceType describes the tool that built it. They are not interchangeable indicators of origin or Metadata API compatibility. The additional TensorFlow and Scikit Learn runtime definitions do not remove the restriction on UserUpload models.
Completion is not activation. In addition to Enabled and Disabled, the official status definition includes these stages:
-
Uploading,UploadFailed, andUploadCompleteddescribe the upload stage. -
Validating,ValidationFailed, andValidationCompleteddescribe the validation stage.
UploadCompleted and ValidationCompleted indicate completion of their respective stages, not an Enabled state. The failed states distinguish upload failure from validation failure, but do not identify the underlying cause. These status definitions do not establish a supported Metadata API mechanism for initiating or changing the lifecycle.
Transformations affect prediction meaning. Source variables can be transformed into derived variables before prediction, so the transformation configuration is part of the model's prediction semantics. Although transformations.type is exposed as a string, its documented values are TypographicClustering, SentimentAnalysis, FreeTextClustering, NumericalImputation, CatagoricalImputation, TimeSeriesForecast, ExtractMonthOfYear, ExtractDayOfWeek, and ZipCodeAnalysis. Preserve the API spelling CatagoricalImputation.
Variable flags are designations, not access controls or compliance results. The isSensitive and isDisparateImpact flags alone do not grant access to underlying Salesforce data, demonstrate regulatory compliance, or prove the model's current fairness characteristics. Similarly, trainingMetrics describes training results rather than live prediction performance.
Deployment and Retrieval
A DiscoveryAIModel is stored in the discovery folder as two matching files:
-
ModelName.modelcontains the actual model data. -
ModelName.model-meta.xmlcontains the model's metadata.
The metadata description alone is not the model payload. For a manifest-based retrieval, use DiscoveryAIModel as the type in package.xml and the model name as the member. The type supports the * wildcard in the manifest.
Retrieval and inspection do not prove that arbitrary edits can be written back. Write operations are generally not supported, and sourceType=UserUpload is specifically unsupported in the Metadata API. The ability to import an externally built model through Model Manager does not provide equivalent Metadata API write support. Editing a retrieved status value likewise does not establish a supported way to activate, disable, upload, or validate a model.
Relationships
The field-side relationship comes from variable entries inside modelFields. It does not mean that every model variable is a deployed Salesforce custom field. In the opposite direction, goals that actually reference the model matter for impact analysis. Neither relationship alone establishes execution, access rights, or a mandatory deployment sequence.
References
-
CustomField:namewithinmodelFields. The actual variable entries determine which field relationships apply.
Referenced By
-
DiscoveryGoal:aiModel.
Documentation Inconsistencies
Enumeration coverage differs between the exposed element schema and the official type definition:
-
predictionType: the exposed schema additionally includesMulticlassClassification, which the official type definition does not list. This difference does not extend the binary-only scope ofclassificationThreshold. -
modelRuntimeType: the exposed schema listsDiscoveryandH2O. The official definition additionally listsTandTf27for TensorFlow runtimes andSC102for Scikit Learn. -
status: the exposed schema lists onlyEnabledandDisabled, while the official definition also lists the upload and validation states described above.
Common Questions
Can I deploy an externally built DiscoveryAIModel through the Metadata API?
sourceType=UserUpload is not supported in the Metadata API, and write operations for this type are generally not supported. Importing the model through Model Manager in Analytics Studio does not imply equivalent Metadata API write support.
Why does DiscoveryAIModel have both a .model file and a .model-meta.xml file?
The .model file holds the actual model data. The matching .model-meta.xml file describes its metadata. Both belong to the asset; the metadata file alone is not the model payload.
Does ValidationCompleted mean the model is active?
No. ValidationCompleted means validation finished, and UploadCompleted means upload finished. Enabled is the status that means active.
When does classificationThreshold apply?
It applies only to binary classification models. It is null for regression models and is not a general threshold for every prediction type, including MulticlassClassification.
Which metadata can reference a DiscoveryAIModel?
DiscoveryGoal can reference a model through aiModel. In the other direction, modelFields.name provides the recognized association to CustomField, depending on the model's actual variable entries.