Predictive Intelligence Business Rule - New Learner Help

David168
Tera Expert

Good Afternoon Community.

I am trying to understand the Predictive Intelligence process and am stuck on the business rule that will populate the data on the incident table.  Perhaps I am missing something.

I have created an ML Solution (Solution Name: predict_business_service) that has examined the description and short description on the incident table to predict the Business Service.  This has examined 100,000+ records and is complete.  I have been able to run tests appropriately. 

I would like to use these results to enter the predicted business service on submit (insert) of a record producer that is from the service portal (channel is Self-service) and where the Business Service field is empty.  

My confusion is within the Advanced tab of the business rule.  I am looking for guidance on how / where to call the prediction from the solution and populate the Business Service field.

This is what I have:

(function executeRule(current, previous /*null when async*/) {
var predictor = new MLPredictor();
var solutions = predictor.predict_business_service(current);
predictor.applyPrediction(current, solutions);

})(current, previous);

Am I close at all, or am I off my rocker here?  I have read many documents ect and am drawing a blank.  

Your help is appreciated.

Thanks

Dave

1 ACCEPTED SOLUTION

Brian Bakker
ServiceNow Employee
ServiceNow Employee

Hello David,

The line var solutions = predictor.predict_business_service(current); is incorrect. There are two business rules, one for making the prediction and the other to Update Prediction Results, once the incident has been moved to the inactive state (active=false).

Out-of-box, we have the following BEFORE INSERT Business Rule (BR) script for making predictions, as follows -

(function executeRule(current, previous /*null when async*/) {
var predictor = new MLPredictor();
var solutions = predictor.findActiveSolutionsForRecord(current);
predictor.applyPrediction(current, solutions);

})(current, previous);

The findActiveSolutionsForRecord method will find the active Classification solutions on the table where the Business Rule is created on, which will be table [incident] for your implementation. The predictor.applyPrediction method will apply the predicted value of the Output field, if above the confidence threshold and add an entry in table [ml_predictor_results]. If it didn't apply the predicted value to the incident, the Skipped flag will be set to true for this prediction record in table [ml_predictor_results].

The Update Prediction Results BR will trigger on the condition current.active.changesTo(false), which will update table [ml_predictor_results] and populate the Final Value fields in this table and then we can determine if the prediction was correct or not.

To see the performance of your Predictive Intelligence solutions, we have the Prediction Results Report, which used Performance Analytics to generate this report, so you will need to enable the "[ML statistics] Daily data collection" job, which will generate the scores for this report based on table [ml_predictor_results]. To ensure some of these widgets are populated, such as "Daily Prediction Recall", you will need to ensure that the incidents where a prediction is made are in the Resolved or Closed state, where Active is set to false.

You can then fine tune your Classification solution using the Precision/Coverage Lookups it generated, but that is a whole new topic!

Let me know if this helps or if you have any additional questions on the Business Rules to populate predicted values.

Best regards,

Brian

View solution in original post

4 REPLIES 4

Brian Bakker
ServiceNow Employee
ServiceNow Employee

Hello David,

The line var solutions = predictor.predict_business_service(current); is incorrect. There are two business rules, one for making the prediction and the other to Update Prediction Results, once the incident has been moved to the inactive state (active=false).

Out-of-box, we have the following BEFORE INSERT Business Rule (BR) script for making predictions, as follows -

(function executeRule(current, previous /*null when async*/) {
var predictor = new MLPredictor();
var solutions = predictor.findActiveSolutionsForRecord(current);
predictor.applyPrediction(current, solutions);

})(current, previous);

The findActiveSolutionsForRecord method will find the active Classification solutions on the table where the Business Rule is created on, which will be table [incident] for your implementation. The predictor.applyPrediction method will apply the predicted value of the Output field, if above the confidence threshold and add an entry in table [ml_predictor_results]. If it didn't apply the predicted value to the incident, the Skipped flag will be set to true for this prediction record in table [ml_predictor_results].

The Update Prediction Results BR will trigger on the condition current.active.changesTo(false), which will update table [ml_predictor_results] and populate the Final Value fields in this table and then we can determine if the prediction was correct or not.

To see the performance of your Predictive Intelligence solutions, we have the Prediction Results Report, which used Performance Analytics to generate this report, so you will need to enable the "[ML statistics] Daily data collection" job, which will generate the scores for this report based on table [ml_predictor_results]. To ensure some of these widgets are populated, such as "Daily Prediction Recall", you will need to ensure that the incidents where a prediction is made are in the Resolved or Closed state, where Active is set to false.

You can then fine tune your Classification solution using the Precision/Coverage Lookups it generated, but that is a whole new topic!

Let me know if this helps or if you have any additional questions on the Business Rules to populate predicted values.

Best regards,

Brian

Hi Brian. Can you give more insight into the Precision/Coverage Lookups and how that can be leveraged for fine tuning your Classification Solution? We've implemented Predictive Intelligence into our instance, but I'm having trouble with the PI-Incident Dashboard as the "Predicted Incorrectly" & the "Predictions Skipped" are really high compared to the Predictions Accepted or Correct.

@rfairley22 

Can you create a new question in the forum for this on how to Fine Tune your Classification solutions using [ml_predictor_results] and [ml_pc_lookup], and I will gladly answer. I will write a KB article on this too. Please link me when you have posted the question.

 

Cheers,
Brian

David168
Tera Expert

Thank you for your help.  It does makes thing more clear for me.  This is the beginning of a long learning curve.  I am sure I will have more questions. It goign to be a long journey.

Your explaination is fantasic.  I really appreciate the response.