Note: This API runs with full privileges before the Vancouver Patch 7 Hotfix 2b and Washington DC Patch 7 releases. With later releases, grant access using ACLs. For more information see Query ACLs.
Method for encoding your solution. Possible values:
xgboost: XGBoost encoding to optimize the training.
logisticRegression: Method using the logistic regression model for categorical targets such as nominal or ordinal.
config.algorithmConfig.targetClassRecall
String
Applies a class recall parameter to steer a solution's training to bias a specific class. Format is `""` where the recall value is a number between 0 and 100 representing a percentage. For example, to set and apply this solution parameter to 90% accuracy for all records you train in the Email class, the value is set to `"Email:90"`.
Flag that indicates whether to provide model explainability. Use model explainability to identify the importance of each input field to your model's predictions.Valid values:
true: The Classification model includes explainability details. Information can be viewed on the Feature Importance tab of the model's solution form.
false: The Classification model does not include explainability details.
Optional. Field name by which the system groups records to build classification solutions. For usage information, see Using group by for classification.
config.inputFieldNames
Array
List of input field names as strings. The model uses these fields used to make predictions.
config.label
String
Identifies the prediction task.
config.minRowCount
String
Optional. Minimum number of records required in the dataset for training.Default: 10000
config.predictedFieldName
String
Identifies a field to be trained for predictability.
config.processingLanguage
String
Optional. Processing language in two-letter ISO 639-1 language code format. Default: "en"
config.stopwords
Array
Optional. Preset list of strings that the system automatically generates based on the language property setting. For details, see Create a custom stopwords list. Default: English Stopwords
config.trainingFrequency
String
The frequency to retrain the model. Possible values: - every\_30\_days - every\_60\_days - every\_90\_days - every\_120\_days - every\_180\_days - run\_once Default: run\_once
The following example shows how to create an object and add it to the ClassificationSolution store.
var myData = new sn_ml.DatasetDefinition(
{
'tableName' : 'incident',
'fieldNames' : ['category', 'short_description', 'priority'],
'fieldDetails' : [
{
'name' : 'category',
'type' : 'nominal'
},
{
'name' : 'short_description',
'type' : 'text'
}],
'encodedQuery' : 'activeANYTHING'
});
var mySolution = new sn_ml.ClassificationSolution({
'label': "my solution definition",
'dataset' : myData,
'predictedFieldName' : 'category',
'inputFieldNames': ['short_description']
});
var myClassificationName = sn_ml.ClassificationSolutionStore.add(mySolution);
ClassificationSolution - cancelTrainingJob()
Cancels a job for a solution object that has been submitted for training.
Name
Type
Description
None
Type
Description
None
The following example shows how to cancel an existing training job.
var mySolution = sn_ml.ClassificationSolutionStore.get('ml_sn_global_global_classification');
mySolution.cancelTrainingJob();
ClassificationSolution - getActiveVersion()
Gets the active ClassificationSolutionVersion object.
The following example shows how to get all ClassificationSolution version objects and call the getVersionNumber() and getStatus() solution version methods on them.
var mlSolution = sn_ml.ClassificationSolutionStore.get('ml_x_snc_global_global_classification');
var mlSolutionVersions = mlSolution.getAllVersions();
for (i = 0; i < mlSolutionVersions.length; i++) {
gs.print("Version " + mlSolutionVersions[i].getVersionNumber() + " Status: " + mlSolutionVersions[i].getStatus() +"\n");
};
Output:
Version 3 Status: {"state":"solution_complete","percentComplete":"100","hasJobEnded":"true"}
Version 2 Status: {"state":"solution_complete","percentComplete":"100","hasJobEnded":"true"}
Version 1 Status: {"state":"solution_cancelled","percentComplete":"0","hasJobEnded":"true"}
Contents of the Dataset and ClassificationSolution() object details in the ClassificationSolutionStore.{
"algorithmConfig": {
"algorithm": "String",
"targetClassRecall": "String"
},
"datasetProperties": {Object},
"domainName": "String",
"encoder": {Object},
"groupByFieldName": "String",
"inputFieldNames": [Array],
"label": "String",
"name": "String",
"predictedFieldName": "String",
"processingLanguage": "String",
"scope": "String",
"stopwords": [Array],
"trainingFrequency": "String"
}
<Object>.algorithmConfig
Method for encoding the solution. Data type: Object.
<Object>.algorithmConfig.algorithm
Name of the encoding algorithm for training this solution. Possible values:
xgboost: XGBoost encoding to optimize the training.
logisticRegression: Method using the logistic regression model for categorical targets such as nominal or ordinal.
Data type: String.
<Object>.algorithmConfig.targetClassRecall
Class recall parameter to steer a solution's training to bias a specific class. The recall value is a number between 0 and 100 representing a percentage.Data type: String
<Object>.datasetProperties
Lists the properties of the DatasetDefinition() object associated with the solution.
Field name by which the system groups records to build classification solutions. Data type: String
<Object>.inputFieldNames
List of input field names as strings. The model uses these fields used to make predictions. Data type: String.
<Object>.label
Identifies the prediction task.
{
"label": "my first prediction"
}
Data type: String.
<Object>.name
System-assigned name. Data type: String.
<Object>.predictedFieldName
Identifies a field to be trained for predictability. Data type: String.
<Object>.processingLanguage
Processing language in two-letter ISO 639-1 language code format. Data type: String.
<Object>.scope
Object scope. Currently the only valid value is `global`.Data type: String
<Object>.stopwords
Optional. Preset list of strings that the system automatically generates based on the language property setting. For details, see Create a custom stopwords list. Data type: Array.
<Object>.trainingFrequency
The frequency to retrain the model. Possible values: - every\_30\_days - every\_60\_days - every\_90\_days - every\_120\_days - every\_180\_days - run\_once Default: run\_once Data type: String.
The following example gets properties of a solution object in the store.
var mySolution = sn_ml.ClassificationSolutionStore.get('ml_sn_global_global_classification_solution');
gs.print(JSON.stringify(JSON.parse(mySolution.getProperties()), null, 2));
The following example shows how to create a dataset, apply it to a solution, add the solution to a store, and submit the training job.
// Create a dataset
var myData = new sn_ml.DatasetDefinition({
'tableName' : 'incident',
'fieldNames' : ['assignment_group', 'short_description', 'description'],
'encodedQuery' : 'activeANYTHING'
});
// Create a solution
var mySolution = new sn_ml.ClassificationSolution({
'label': "my solution definition",
'dataset' : myData,
'predictedFieldName' : 'assignment_group',
'inputFieldNames':['short_description']
});
// Add the solution to the store to later be able to retrieve it.
var my_unique_name = sn_ml.ClassificationSolutionStore.add(mySolution);
// Train the solution - this is a long running job
var myClassifierVersion = mySolution.submitTrainingJob();