Using Group By for classification
Summarize
Summary of Using Group By for Classification
The Group By feature in ServiceNow allows customers to train a single classification solution that can handle multiple data areas, such as geographical locations or domains. By using the groupby parameter in API calls, customers can create models that cater to subsets of data defined by categorical columns, leading to more tailored predictions.
Show less
Key Features
- Group By Capability: Enables the creation of multiple models based on different values of a categorical column, enhancing classification accuracy across diverse datasets.
- Custom Model Training: Allows for training models specifically for separate regions or domains, such as creating distinct models for US and European incidents.
- API Utilization: The implementation of the groupby parameter during solution definition allows for streamlined classification processes via APIs.
- Prediction Routing: Ensures that prediction calls are directed to the appropriate model based on the Group By value present in the input data.
Key Outcomes
By utilizing the Group By feature, ServiceNow customers can expect improved classification outcomes, particularly in scenarios involving multiple geographical locations or domains. This capability simplifies the management of classification solutions and enhances the accuracy of predictions, allowing organizations to optimize their incident handling and support processes.
Use APIs to simultaneously submit multiple classification solutions for training based on the Group By field.
You can use the optional Group By capability to train and maintain one classification solution that covers more than one data area, such as geographical location or domain.
To train a solution using Group By, you must add the groupby parameter while creating a classification solution definition using APIs. The groupby parameter accepts only categorical columns as inputs, where individual models are created on the subset of data belonging to each of the groupby values. Only those child solutions that pass the minimum records criteria set for the capability are created. Here, the prediction calls are routed to the corresponding Group By model based on the Group By value present in the prediction input. Batch predictions are not supported.
A Group By scenario for geographical locations
Let's say your global company uses classification routing for incoming records, with one support center in the US and one in Europe. Here, you want to create a single classification solution that has one model for your United States incidents and another model for your European incidents.
- Create and train two separate ML classification solution definitions, where one is filtered by US incidents only, and one by European incidents only.
- Use the groupby parameter to create Groupby for the country location so that all US definitions create a US model and all European definitions create a European model. Then, based on the incident, the system identifies which model it uses to predict the correct classification category.
The second approach has benefits in that the models you use can even be in different domains, such as healthcare or finance. This approach is especially beneficial if you have several country locations or domains to maintain.
Example usage for training and prediction using Group By via API
var myIncidentData = new sn_ml.DatasetDefinition({
'tableName' : 'incident',
'fieldNames' : ['category','short_description','assignment_group','description','priority'],
'encodedQuery' : 'activeANYTHING'
});
var mySolution = new sn_ml.ClassificationSolution({
'label': 'solution label',
'dataset' : myIncidentData,
'groupByFieldName' : 'assignment_group',
'predictedFieldName': 'category',
'inputFieldNames': ['short_description','description','priority']
});
//Add solution definition
var solution_gr = sn_ml.ClassificationSolutionStore.add(mySolution)
//Get existing solution
var my_unique_name = sn_ml.ClassificationSolutionStore.get('solution name');
// submit training job
var solutionVersion = my_unique_name.submitTrainingJob();
// Run prediction
var input = new GlideRecord("incident");
input.get("sys_id");
// configure optional parameters
var options = {};
options.apply_threshold = false;
var mlSolution = sn_ml.ClassificationSolutionStore.get('solution name');
//Prediction using glide record
var results = mlSolution.getActiveVersion().predict(input, options);
//Prediction using map
var results = mlSolution.getActiveVersion().predict([{ 'short_description': input.short_description,
'assignment_group': input.assignment_group }], options);For more context regarding this example and the general usage of Machine Learning APIs, see the links in the Related Content section on this page.