MLSolution - Global
-
- UpdatedJan 30, 2025
- 5 minutes to read
- Yokohama
- API reference
The MLSolution API provides methods for handling Predictive Intelligence predictions and retrieving solution objects for all capabilities: similarity, classification, and clustering).
- Common methods used for all solution objects:
- getCapability()
- getVersion()
- isActive()
- predict()
- Methods only used for classification and regression solutions:
- applyPrediction()
- Methods only used for clustering solutions:
- getClusterAssignments()
- getClusterForRecord()
- getClusterInfo()
The MLSolution
API requires the Predictive Intelligence plugin (com.glide.platform_ml) and is provided
within the sn_ml
namespace.
The methods in this object are instantiated using MLSolutionFactory.
MLSolution - applyPrediction(GlideRecord now_GR)
Gets the prediction result for a classification solution and applies it to the input GlideRecord if the confidence value is higher than the threshold.
Name | Type | Description |
---|---|---|
now_GR | GlideRecord | GlideRecord object containing values on which to run a prediction and apply the results. |
Type | Description |
---|---|
Boolean | Flag that indicates whether the prediction was applied:
|
Example
MLSolution - getCapability()
Gets the capability information of a trained solution.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Type of trained solution. Possible values:
|
Example
MLSolution - getClusterAssignments(Object options)
Gets assignments for a clustering solution.
Type | Description |
---|---|
Object | JSON array containing cluster information in increasing order by cluster_id:
|
Example
Output:
MLSolution - getClusterForRecord(GlideRecord now_GR)
Gets the cluster information for a clustering solution.
Name | Type | Description |
---|---|---|
now_GR | GlideRecord | Name of the input GlideRecord. |
Type | Description |
---|---|
String | The cluster_id from the Cluster Summary [ml_cluster_summary] table if the record belongs to a cluster. Empty string returns if the record does not belong to a cluster. |
Example
MLSolution - getClusterInfo(Object options)
Gets information for a specified clustering solution.
Name | Type | Description |
---|---|---|
options | Object | Optional. Narrows down the returned results by group and level within a
clustering solution. Default: Return cluster memberships for all clusters. |
options.group_by | String | Optional. Identifies the segmentation field for which to
retrieve cluster memberships, for example, assignment_group. This field provides the same grouping as options provided in the Use Group By check box in the Clustering Definition form. The information provided varies based on the table selected in the Table field. For more information, see Create and train a clustering solution . |
options.cluster_id | String | Optional. Cluster ID of a trained solution in the Cluster Summary [ml_cluster_summary] table. |
Type | Description |
---|---|
Object | JSON array containing cluster information in increasing order by cluster_id:
|
Example
Output:
MLSolution - getVersion()
Gets the version of the active solution.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | Version of the active solution. |
Example
MLSolution - isActive()
Determines if a solution is active.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Boolean | Flag that indicates whether the solution is active.
|
Example
MLSolution - predict(Object input, Object options)
Gets the prediction results from the prediction server given a GlideRecord or an array of key-value pairs.
You can use this method to call prediction with multiple input records because GlideRecord is an iterator.
Name | Type | Description |
---|---|---|
input | Object | GlideRecord or array of JSON objects containing field names and values as key-value pairs. |
options | Object | Optional. JSON key-value pair with the following properties:
|
Type | Description |
---|---|
Object | JSON object containing the prediction results sorted by
sys_id or record_number.
|
Example
Example
Output:
Example
On this page
- MLSolution - applyPrediction(GlideRecord now_GR)
- MLSolution - getCapability()
- MLSolution - getClusterAssignments(Object options)
- MLSolution - getClusterForRecord(GlideRecord now_GR)
- MLSolution - getClusterInfo(Object options)
- MLSolution - getVersion()
- MLSolution - isActive()
- MLSolution - predict(Object input, Object options)
Related Content
- MLSolutionUtil
The MLSolutionUtil script include provides methods for getting Predictive Intelligence predictions.
- REST API: Get predictions for multiple solutions
The Predictive Intelligence API provides endpoints that predict a field value based on one or more input fields and a trained solution.