Predictions
Retrieve real-time scores prediction for a machine learning use case.
The components that make up the AI Accelerator real-time scoring API are:
- Configuration Resolution
- Feature Extractor
- Scorer
- DB Writer
Configuration Resolution
For each API request, the API resolves the configuration values at run time in the following order:
- API request (highest priority)
- Admin configurations in setup BPOs. See AI Accelerator.
- Use case configuration file setting
Feature Extractor
This component is applicable to only those use cases where it’s necessary to derive or calculate some features during run time. Just to clarify, features are the inputs to an ML model.
As an example, let’s consider an ML use case that predicts the price of a real estate property. To do so, the ML model requires features, such as the property’s square feet area, carpet area, location, number of bedrooms, construction year, and construction age.
Say all these features are available in the property’s record except the construction age feature. In this case, the API invokes Feature Extractor to calculate the construction age in runtime by subtracting the construction year feature from the current year.
Scorer
Scorer accepts features and uses the Einstein Discovery Predict API to interact with the ED platform for scoring the records.
DB Writer
If you configure an ML use case for persistence, DB Writer persists the features, scores, and insights in the specified object and as per the specified field mapping in the AIUsecaseFieldMapping object.
The AI Accelerator Predictions API returns the following output components:
- A single prediction score per record, rawdata, recordoverrides, extractedrawdata, or extractedrecordoverrides.
- Details on how the score was arrived at through a maximum of three prediction insights, which helps end users understand the impact of various features on the scores.
- Prediction improvements to improve the score.
{yourInstance} is the domain name of your Salesforce instance.
55.0
No
POST
An example of inputType as Records.
An example of inputType as RawData.
An example of inputType as RecordOverrides.
An example of inputType as ExtractedRawData.
An example of inputType as ExtractedRecordOverrides.
| Name | Type | Description | Required or Optional | Available Version |
|---|---|---|---|---|
async | Boolean | Indicates whether the execution mode is async (true) or not (false). | Optional | 55.0 |
columnNames | String[] | Comma-separated list of column names representing the columns that the model analyzes. These are the features that are inputs to the model for predicting the scores. | Optional Note: This field is required when type is rawdata or recordOverrides. | 55.0 |
enableFeaturePersistence | Boolean | Indicates whether you want to persist the features (true) or not (false). | Optional Note: This field is required only if raw data or when features are extracted. | 55.0 |
enableInsightPersistence | Boolean | Indicates whether you want to persist the insights (true) or not (false).Note: The enableScorePersistence field must be enabled to persist insights. | Optional | 55.0 |
enableScorePersistence | Boolean | Indicates whether you want to persist the prediction scores (true) or not (false). | Optional | 55.0 |
enableSuggestionPersistence | Boolean | Indicates whether you want to persist the suggestions (true) or not (false).Note: The enableScorePersistence field must be enabled to persist suggestions. | Optional | 55.0 |
enrichModelClassification | Boolean | Indicates whether you want to retrieve the classification model type and the classification threshold (true) or not (false). | Optional | 55.0 |
enrichModelFeatures | Boolean | Indicates whether you want to retrieve the model feature details, including label and data type (true) or not (false). | Optional | 55.0 |
enrichPredictionDefinition | Boolean | Indicates whether you want to retrieve the prediction definition label (true) or not (false). | Optional | 55.0 |
featureColumnMap | Map<String, String> | Represents the map that contains which features must be persisted and where they must be persisted. The key-value pair must contain:
| Optional | 55.0 |
featureExtractorDevName | String | The API name of the feature extractor record. | Optional Note: This field is required when the usecaseModel doesn’t have a default Feature Extractor and the input type is ExtractedRawData or ExtractedRecordOverrides. | 55.0 |
featureExtractionParameters | Feature Extraction Parameters Field Map Value[] | Represents the input parameters that are required by the Feature Extractor to extract the features that a model requires to make the prediction. Supports a maximum of 200 records. | Optional Note: This field is required when the input type is ExtractedRawData or ExtractedRecordOverrides. | 55.0 |
featureExtractorId | String | The ID of the feature extractor record from the AIFeatureExtractor object. The specified feature extractor is used to extract the features for the prediction. For information on the custom feature extractor interface implementation, see CustomFeatureExtractor Interface. | Optional | 55.0 |
historyReferencePoint | String | Represents a reference point for a comparison between current and previous prediction scores. | Optional | 55.0 |
inputType | String | The type of input used to make the prediction. Supports a maximum of 200 records. Possible values are:
| Required | 55.0 |
insightColumnMap | Map<String, String> | Represents the map that contains which insight’s Name/Value must be persisted, and to which object they must be persisted. The key-value pair must contain:
| Optional | 55.0 |
insightsSettings | Map<String, Integer> | A map for configuring insight settings. Here are the settings that contribute to the prediction score:
For more information, see Define Maximum Suggestions and Insights in the AI Accelerator Admin Guide. | Optional | 55.0 |
predictionDefinition | String | The developer name or API name from the DiscoveryGoal object. | Required | 55.0 |
rawData | Raw Data Input Wrap[] | A two-dimensional array of row values in which each row is a comma-separated list of values for features provided in columnNames. Supports a maximum of 200 records. | Optional Note: This field is required when the input type is RawData or RecordOverrides. | 55.0 |
records | String[] | The IDs of the Salesforce record that is used as input features for model to make the prediction. | Optional Note: This field is required when the input type is Records, RecordOverrides, or ExtractedRecordOverrides. | 55.0 |
scorePersistenceColumn | String | The name and value of the score that must be persisted, and to which object it must be persisted. The valid format is ResponseObject.FieldName. | Optional. Note: This field is required when enableScorePersistence is set to true. If enableScorePersistence is true and the value isn’t specified, the score column map from the setup page is used by default. | 55.0 |
suggestionColumnMap | Map<String, String> | Represents the map that contains which suggestions Name/Value must be persisted, and to which object they must be persisted. The key-value pair must contain:
| Optional | 55.0 |
usecaseDefinition | String | The ID of the usecase definition record from the AIUsecaseDefinition object. | Optional | 55.0 |
usecaseDevname | String | The API name of the usecase definition record. | Required | 55.0 |