---
schema_version: "1"
id: fb4f16792e54ae7ae9e9caef5cd983ac5e4fdd38246fbec82a482360d619b3f6
title: DiscoveryAIModel
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_discoveryaimodel.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_discoveryaimodel.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9c2c64de768da47c4fccd67dbc27626c5328c7ed6c0b0b790d8d8558b841da9d
description: Represents the metadata associated with a model used in Einstein Discovery.
---
# 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.

![Note](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png)

#### Note

Write operations for DiscoveryAIModel objects are generally not supported.

## 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:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <members\>Maximize\_Sales</members\>
        <name\>DiscoveryAIModel</name\>
    </types\>
    <version\>53.0</version\>
</Package\>

## Version

DiscoveryAIModels are available in API version 51.0 and later.

## Fields

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d384673e115">Field Name</th>

              <th class="featureTableHeader  " id="d384673e118">Field Type</th>

              <th class="featureTableHeader  " id="d384673e121">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">algorithmType</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type"><a class="xref" href="#DiscoveryAlgorithmType">DiscoveryAlgorithmType</a></td>

              <td class="entry" headers="d384673e121" data-title="Description">Algorithm that Einstein Discovery used to create the model
                associated with this story.</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">classificationThreshold</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type">double</td>

              <td class="entry" headers="d384673e121" data-title="Description">Threshold value. Applies only to binary classification models.
                For regression models, this is null.</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">description</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type">string</td>

              <td class="entry" headers="d384673e121" data-title="Description">Model description.</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">label</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type">string</td>

              <td class="entry" headers="d384673e121" data-title="Description">Model label. If you package a model, this label appears in
                Package Manager.</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">modelFields</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type">
                <a class="xref" href="#DiscoveryModelField">DiscoveryModelField</a>[]
              </td>

              <td class="entry" headers="d384673e121" data-title="Description">One or more model fields (variables).</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">modelRuntimeType</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type"><a class="xref" href="#DiscoveryModelRuntimeType">DiscoveryModelRuntimeType</a></td>

              <td class="entry" headers="d384673e121" data-title="Description">Model run-time type.</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">predictedField</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type">string</td>

              <td class="entry" headers="d384673e121" data-title="Description">Name of the field that is predicted.</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">predictionType</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type">DiscoveryPredictionType</td>

              <td class="entry" headers="d384673e121" data-title="Description">Type of prediction. One of the following strings: <ul class="ul bulletList">
                  <li class="li"><span class="keyword parmname">Regression</span></li>

                  <li class="li"><span class="keyword parmname">Classification</span></li>

                  <li class="li"><span class="keyword parmname">Unknown</span></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">sourceType</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type"><a class="xref" href="#DiscoveryModelSourceType">DiscoveryModelSourceType</a></td>

              <td class="entry" headers="d384673e121" data-title="Description">Source type.</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">status</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type"><a class="xref" href="#DiscoveryAIModelStatus">DiscoveryAIModelStatus</a></td>

              <td class="entry" headers="d384673e121" data-title="Description">Model status (enabled or disabled).</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">trainingMetrics</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type">string</td>

              <td class="entry" headers="d384673e121" data-title="Description">JSON object that represents metrics about the model when it was
                trained. </td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e115" data-title="Field Name"><span class="keyword parmname">transformations</span></td>

              <td class="entry" headers="d384673e118" data-title="Field Type"><a class="xref" href="#DiscoveryModelTransform">DiscoveryModelTransform</a></td>

              <td class="entry" headers="d384673e121" data-title="Description">One or more model transformations.</td>

            </tr>

          </tbody>

        </table>

## 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](#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](#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).

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d384673e1015">Field Name</th>

              <th class="featureTableHeader  " id="d384673e1018">Field Type</th>

              <th class="featureTableHeader  " id="d384673e1021">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d384673e1015" data-title="Field Name"><span class="keyword parmname">Discovery</span></td>

              <td class="entry" headers="d384673e1018" data-title="Field Type">string</td>

              <td class="entry" headers="d384673e1021" data-title="Description">Einstein Discovery built the model.</td>

            </tr>

            <tr>
              <td class="entry" headers="d384673e1015" data-title="Field Name"><span class="keyword parmname">UserUpload</span></td>

              <td class="entry" headers="d384673e1018" data-title="Field Type">string</td>

              <td class="entry" headers="d384673e1021" data-title="Description">An external tool built the model. The model was then uploaded
                into Salesforce. <div class="box message info">
                  <div class="inner">
                    <div class="bd">
                      <div class="media">
                        <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png" alt="Note">
                        <div class="mediaBd">
                          <h4 class="mbs">Note</h4>
                          <p>This source type is not supported in the
                            Metadata API.</p>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </td>

            </tr>

          </tbody>

        </table>

## 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:

<?xml version="1.0" encoding="UTF-8"?>
<DiscoveryAIModel xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <content xsi:nil="true"/>
   <algorithmType\>Glm</algorithmType\>
   <classificationThreshold\>0.7383</classificationThreshold\>
   <label\>Maximize Tenure</label\>
   <modelFields\>
      <label\>Field</label\>
      <name\>Field</name\>
      <type\>Text</type\>
   </modelFields\>
   <modelFields\>
      <label\>PTO</label\>
      <name\>PTO</name\>
      <type\>Number</type\>
   </modelFields\>
   <modelFields\>
      <label\>Level</label\>
      <name\>Level</name\>
      <type\>Text</type\>
   </modelFields\>
   <modelFields\>
      <label\>Salary</label\>
      <name\>Salary</name\>
      <type\>Number</type\>
   </modelFields\>
   <modelFields\>
      <label\>Tenure</label\>
      <name\>Tenure</name\>
      <type\>Number</type\>
   </modelFields\>
   <modelRuntimeType\>Discovery</modelRuntimeType\>
   <predictedField\>Tenure</predictedField\>
   <predictionType\>Classification</predictionType\>
   <sourceType\>Discovery</sourceType\>
   <status\>Enabled</status\>
</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](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/file_based_zip_file.htm).