Name
global.MLSolutionUtil
Description
Implements extension point global.MLSolutionUtil Designed for extending global.MLSolutionUtil Class
Script
var MLSolutionUtil = Class.create();
MLSolutionUtil.prototype = {
initialize: function() {
},
/**
* getPredictions method is used to get ML predictions
* Input Parameters (injected into the method) are:
* 'input' - input can be GlideRecord or array of key-value pairs
* 'solutionNames' - array of names of solution against which prediction needs to be run
* Output - {JSON}
* Output format -
* {
* solution_name : {
* input_gr_sys_id1/record_number : [
* {
* predictedValue : ,
* predictedSysId : ,
* confidence : ,
* threshold :
* },
* {
* predictedValue : "",
* predictedSysId : "",
* confidence : "",
* threshold : ""
* }
* ]
* }
* }
*/
getPredictions: function(input, solutionNames, options) {
var predResults = {};
for (var index=0; index < solutionNames.length; index++) {
var solutionName = solutionNames[index];
var mlSolution = sn_ml.MLSolutionFactory.getSolution(solutionName);
predResults[solutionName] = JSON.parse(mlSolution.predict(input, options));
}
return predResults;
},
type: 'MLSolutionUtil'
};
Sys ID
3b2c57f27303330080b29ca9faf6a73a