The PredictabilityEstimateVersion API is a scriptable object used in Predictive Intelligence stores.

This API requires the Predictive Intelligence plugin (com.glide.platform_ml) and is provided within the sn_ml namespace.

Use this API when working with predictability estimate versions based on PredictabilityEstimate API objects in the PredictabilityEstimate store.

The system activates the most recent version of the predictability estimate when it completes training, and only allows one version to be active at a time. However, you can activate any previously trained version you want to use to make predictions.

Methods in this API are accessible using the following PredictabiltyEstimate methods:

PredictabilityEstimateVersion - getProperties()

Gets predictability estimate object properties and version number.

Table 1. Parameters
Name Type Description
None

Example

The following example gets properties of the active object version in the store.

// Get properties
var mlEstimate = sn_ml.PredictabilityEstimateStore.get('ml_incident_categorization');

gs.print(JSON.stringify(JSON.parse(mlEstimate.getActiveVersion().getProperties()), null, 2));

Output:

"datasetProperties": {
    "encodedQuery": "activeANYTHING^EQ",
    "fieldNames": [
      "short_description",
      "category"
    ],
    "tableName": "incident"
  },
  "domainName": "global",
  "inputFieldNames": [
    "short_description"
  ],
  "isActive": "true",
  "label": "Incident Categorization_Trainer",
  "name": "ml_incident_categorization",
  "predictedFieldName": "category",
  "processingLanguage": "en",
  "stopwords": [
    "Default English Stopwords"
  ],
  "versionNumber": "1"
}

PredictabilityEstimateVersion - getResults()

Returns JSON results containing suggested input fields for an output field.

Table 3. Parameters
Name Type Description
None

Example

The following example shows how to get results for a selected version of a predictability estimate in the store.

// Get results
var estimateName = "ml_x_snc_global_global_predictability_estimate;"
var mlEstimate = sn_ml.PredictabilityEstimateStore.get(estimateName);

var results = mlEstimate.getActiveVersion().getResults();

gs.print(JSON.stringify(JSON.parse(results), null, 2));

Output:

{
  "category": {
    "nominalInputFields": [
      {
        "fieldName": "number",
        "modelImprovement": "0.167052396325189"
      },
      {
        "fieldName": "task_effective_number",
        "modelImprovement": "0.167052396325189"
      }
    ],
    "textInputFields": [
      {
        "fieldName": "short_description",
        "density": "1.0"
      }
    ]
  }
}

PredictabilityEstimateVersion - getStatus(Boolean includeDetails)

Gets training completion status.

Table 5. Parameters
Name Type Description
includeDetails Boolean Flag that indicates whether to return status details.
Valid values:
  • true: Return additional details.
  • false: Don't return additional details.

Default: False

Example

The following example shows a successful result with training complete.

// Get status
var mlEstimate = sn_ml.PredictabilityEstimateStore.get('ml_incident_categorization');

gs.print(JSON.stringify(JSON.parse(mlEstimate.getActiveVersion().getStatus(true), null, 2)));

Output:

{
 "state":"solution_complete",
 "percentComplete":"100",
 "hasJobEnded":"true",
 "details":{"stepLabel":"Solution Complete"} // This information is only returned if getStatus(true);
}

Example

The following example shows an unsuccessful result with training complete.

// Get status
var mlEstimate = sn_ml.PredictabilityEstimateStore.get('ml_x_snc_global_global_my_estimate_definition');
var trainingStatus = mlEstimate.getLatestVersion().getStatus();

gs.print(JSON.stringify(JSON.parse(trainingStatus), null, 2));

Output:

{
  "state": "solution_complete",
  "percentComplete": "100",
  "hasJobEnded": "true"
}

PredictabilityEstimateVersion - getVersionNumber()

Gets the version number of a predictability estimate object.

Table 7. Parameters
Name Type Description
None
Table 8. Returns
Type Description
String Version number.

Example

The following example shows how to get a version number.

// Get version number
var mlEstimate = sn_ml.PredictabilityEstimateStore.get('ml_x_snc_global_global_predictability_estimate');

gs.print("Version number: "+JSON.stringify(JSON.parse(mlEstimate.getActiveVersion().getVersionNumber()), null, 2));

Output:

Version number: 1