{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":726,"path":"api-reference/server-api-reference/ClassificationSolutionAPI.md","title":"ClassificationSolution - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# ClassificationSolution- Global\n\nThe ClassificationSolution API is a scriptable object used in Predictive Intelligence stores.\n\nThis API requires the Predictive Intelligence plugin \\(com.glide.platform\\_ml\\) and is provided within the `sn_ml` namespace.\n\nThe solution setup-to-training flow is as follows:\n\n1.  Create a dataset using the [DatasetDefinition](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/DatasetDefinitionAPI.md) API.\n2.  Optional. Build an encoder using the [Encoder](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/EncoderAPI.md) API.\n3.  Use the [constructor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionAPI.md) to create a classification solution object.\n4.  Add the solution object to the classification solution store using the [ClassificationSolutionStore - add\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionStoreAPI.md) method.\n5.  Train the solution using the [submitTrainingJob\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionAPI.md) method. This creates a version of the object that you can manage using the [ClassificationSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionVersionAPI.md) API.\n6.  Get predictions using the [ClassificationSolutionVersion – predict\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionVersionAPI.md) method.\n\n**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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-security/query-acl-rule.md).\n\nFor usage guidelines, refer to [Using ML APIs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/intelligent-experiences/using-ml-apis.md).\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## ClassificationSolution - ClassificationSolution\\(Object config\\)\n\nCreates a classification solution.\n\n<table id=\"table_gm2_yt5_flb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nconfig\n\n</td><td>\n\nObject\n\n</td><td>\n\nJavaScript object containing configuration properties of thesolution.```\n{\n  \"algorithmConfig\": {Object},\n  \"dataset\": {Object},\n  \"domainName\": \"String\",\n  \"encoder\": {Object},\n  \"groupByFieldName\": \"String\", \n  \"inputFieldNames\": [Array],\n  \"label\": \"String\",\n  \"minRowCount\": \"String\",\n  \"predictedFieldName\": \"String\",\n  \"processingLanguage\": \"String\",\n  \"stopwords\": [Array],\n  \"trainingFrequency\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nconfig.algorithmConfig\n\n</td><td>\n\nObject\n\n</td><td>\n\nJavaScript object containing algorithm configuration properties. ```\n'algorithmConfig' : {\n  \"algorithm\": \"String\",\n  \"targetClassRecall\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nconfig.algorithmConfig.algorithm\n\n</td><td>\n\nString\n\n</td><td>\n\nMethod for encoding your solution. Possible values:\n\n-   **xgboost**: XGBoost encoding to optimize the training.\n-   **logisticRegression**: Method using the logistic regression model for categorical targets such as nominal or ordinal.\n\n</td></tr><tr><td>\n\nconfig.algorithmConfig.targetClassRecall\n\n</td><td>\n\nString\n\n</td><td>\n\nApplies a class recall parameter to steer a solution's training to bias a specific class. Format is `\"<ClassName:RecallValue>\"` 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\"`.\n\n</td></tr><tr><td>\n\nconfig.dataset\n\n</td><td>\n\nObject\n\n</td><td>\n\n[DatasetDefinition](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/DatasetDefinitionAPI.md) name.\n\n</td></tr><tr><td>\n\nconfig.domainName\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Domain name associated with this dataset. Default: Current domain, for example, `\"global\"`.\n\n</td></tr><tr><td>\n\nconfig.encoder\n\n</td><td>\n\nObject\n\n</td><td>\n\nOptional. Trained encoder object to assign to this solution. See [Encoder - Encoder\\(Object config\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/EncoderAPI.md).\n\n</td></tr><tr><td>\n\nconfig.explainability\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag 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:\n\n-   true: The Classification model includes explainability details. Information can be viewed on the **Feature Importance** tab of the model's solution form.\n-   false: The Classification model does not include explainability details.\n\nDefault: false\n\nSee also: [Model Explainability](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/intelligent-experiences/predictive-intel-explainability.md)\n\n</td></tr><tr><td>\n\nconfig.groupByFieldName\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Field name by which the system groups records to build classification solutions. For usage information, see [Using group by for classification](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/intelligent-experiences/using-group-by-for-classification.md).\n\n</td></tr><tr><td>\n\nconfig.inputFieldNames\n\n</td><td>\n\nArray\n\n</td><td>\n\nList of input field names as strings. The model uses these fields used to make predictions.\n\n</td></tr><tr><td>\n\nconfig.label\n\n</td><td>\n\nString\n\n</td><td>\n\nIdentifies the prediction task.\n\n</td></tr><tr><td>\n\nconfig.minRowCount\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Minimum number of records required in the dataset for training.Default: 10000\n\n</td></tr><tr><td>\n\nconfig.predictedFieldName\n\n</td><td>\n\nString\n\n</td><td>\n\nIdentifies a field to be trained for predictability.\n\n</td></tr><tr><td>\n\nconfig.processingLanguage\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Processing language in two-letter ISO 639-1 language code format. Default: \"en\"\n\n</td></tr><tr><td>\n\nconfig.stopwords\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. Preset list of strings that the system automatically generates based on the **language** property setting. For details, see [Create a custom stopwords list](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/intelligent-experiences/create-custom-stopwords-list.md). Default: English Stopwords\n\n</td></tr><tr><td>\n\nconfig.trainingFrequency\n\n</td><td>\n\nString\n\n</td><td>\n\nThe frequency to retrain the model. Possible values:\n\n-   every\\_30\\_days\n-   every\\_60\\_days\n-   every\\_90\\_days\n-   every\\_120\\_days\n-   every\\_180\\_days\n-   run\\_once\n\nDefault: run\\_once\n\n</td></tr></tbody>\n</table>The following example shows how to create an object and add it to the ClassificationSolution store.\n\n```\nvar myData = new sn_ml.DatasetDefinition(\n  { \n     'tableName' : 'incident', \n     'fieldNames' : ['category', 'short_description', 'priority'],\n     'fieldDetails' : [\n       {\n         'name' : 'category',\n         'type' : 'nominal'\n       },\n       {\n         'name' : 'short_description',\n         'type' : 'text'\n       }], \n     'encodedQuery' : 'activeANYTHING'\n  });\n\nvar mySolution = new sn_ml.ClassificationSolution({\n  'label': \"my solution definition\",\n  'dataset' : myData,\n  'predictedFieldName' : 'category',\n  'inputFieldNames': ['short_description']\n});\n\nvar myClassificationName = sn_ml.ClassificationSolutionStore.add(mySolution);\n```\n\n## ClassificationSolution - cancelTrainingJob\\(\\)\n\nCancels a job for a solution object that has been submitted for training.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|None| |\n\nThe following example shows how to cancel an existing training job.\n\n```\nvar mySolution = sn_ml.ClassificationSolutionStore.get('ml_sn_global_global_classification');\n\nmySolution.cancelTrainingJob();\n```\n\n## ClassificationSolution - getActiveVersion\\(\\)\n\nGets the active ClassificationSolutionVersion object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Object|Active [ClassificationSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionVersionAPI.md) object.|\n\nThe following example shows how to get an active ClassificationSolution version from the store and return its training status.\n\n```\nvar mlSolution = sn_ml.ClassificationSolutionStore.get('ml_x_snc_global_global_classification');\n\ngs.print(JSON.stringify(JSON.parse(mlSolution.getActiveVersion().getStatus()), null, 2));\n```\n\nOutput:\n\n```\n{\n  \"state\": \"solution_complete\",\n  \"percentComplete\": \"100\",\n  \"hasJobEnded\": \"true\"\n}\n```\n\n## ClassificationSolution - getAllVersions\\(\\)\n\nGets all versions of a classification solution.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Array|Existing versions of a solution object. See also [ClassificationSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionVersionAPI.md) API.|\n\nThe following example shows how to get all ClassificationSolution version objects and call the getVersionNumber\\(\\) and getStatus\\(\\) solution version methods on them.\n\n```\nvar mlSolution = sn_ml.ClassificationSolutionStore.get('ml_x_snc_global_global_classification');\n\nvar mlSolutionVersions = mlSolution.getAllVersions();\n\nfor (i = 0; i < mlSolutionVersions.length; i++) {\ngs.print(\"Version \" + mlSolutionVersions[i].getVersionNumber() + \" Status: \" + mlSolutionVersions[i].getStatus() +\"\\n\");\n};\n```\n\nOutput:\n\n```\nVersion 3 Status: {\"state\":\"solution_complete\",\"percentComplete\":\"100\",\"hasJobEnded\":\"true\"}\n\nVersion 2 Status: {\"state\":\"solution_complete\",\"percentComplete\":\"100\",\"hasJobEnded\":\"true\"}\n\nVersion 1 Status: {\"state\":\"solution_cancelled\",\"percentComplete\":\"0\",\"hasJobEnded\":\"true\"}\n```\n\n## ClassificationSolution - getLatestVersion\\(\\)\n\nGets the latest version of a solution.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Object|[ClassificationSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionVersionAPI.md) object corresponding to the latest version of a [ClassificationSolution\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionAPI.md).|\n\nThe following example shows how to get the latest version of a solution and return its training status.\n\n```\nvar mlSolution = sn_ml.ClassificationSolutionStore.get('ml_x_snc_global_global_classification');\n\ngs.print(JSON.stringify(JSON.parse(mlSolution.getLatestVersion().getStatus()), null, 2));\n```\n\nOutput:\n\n```\n{\n  \"state\": \"solution_complete\",\n  \"percentComplete\": \"100\",\n  \"hasJobEnded\": \"true\"\n}\n```\n\n## ClassificationSolution - getName\\(\\)\n\nGets the name of the object to use for interaction with the store.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Name of the solution object.|\n\nThe following example shows how to update ClassificationSolution dataset information and print the name of the object.\n\n```\n// Update solution\nvar myIncidentData = new sn_ml.DatasetDefinition({\n   'tableName' : 'incident',\n   'fieldNames' : ['category', 'short_description', 'priority'],\n   'encodedQuery' : 'activeANYTHING'\n});\n\nvar eligibleFields = JSON.parse(myIncidentData.getEligibleFields('classification'));\n\nvar myClassification = new sn_ml.ClassificationSolution({\n   'label': \"my classification solution\",\n   'dataset' : myIncidentData,\n   'inputFieldNames': eligibleFields['eligibleInputFieldNames'],\n   'predictedFieldName': 'category'\n});\n\n// update solution\nsn_ml.ClassificationSolutionStore.update('ml_x_snc_global_global_my_solution_definition_4', myClassification);\n\n// print solution name\ngs.print('Solution Name: '+myClassification.getName());\n```\n\nOutput:\n\n```\nSolution Name: ml_x_snc_global_global_my_solution_definition_4\n```\n\n## ClassificationSolution - getProperties\\(\\)\n\nGets solution object properties.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_qps_43z_llb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nContents of the Dataset and [ClassificationSolution\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionAPI.md) object details in the [ClassificationSolutionStore](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionStoreAPI.md).```\n{\n  \"algorithmConfig\": {\n    \"algorithm\": \"String\",\n    \"targetClassRecall\": \"String\"\n  },\n  \"datasetProperties\": {Object},\n  \"domainName\": \"String\",\n  \"encoder\": {Object},\n  \"groupByFieldName\": \"String\", \n  \"inputFieldNames\": [Array],\n  \"label\": \"String\",\n  \"name\": \"String\",\n  \"predictedFieldName\": \"String\",\n  \"processingLanguage\": \"String\",\n  \"scope\": \"String\",\n  \"stopwords\": [Array],\n  \"trainingFrequency\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.algorithmConfig\n\n</td><td>\n\nMethod for encoding the solution. Data type: Object.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.algorithmConfig.algorithm\n\n</td><td>\n\nName of the encoding algorithm for training this solution. Possible values:\n\n-   **xgboost**: XGBoost encoding to optimize the training.\n-   **logisticRegression**: Method using the logistic regression model for categorical targets such as nominal or ordinal.\n\n Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.algorithmConfig.targetClassRecall\n\n</td><td>\n\nClass 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\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.datasetProperties\n\n</td><td>\n\nLists the properties of the [DatasetDefinition\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/DatasetDefinitionAPI.md) object associated with the solution.\n\n ```\n{\n  \"encodedQuery\": \"String\",\n  \"fieldDetails\": [Array],\n  \"fieldNames\": [Array],\n  \"tableName\": \"String\"\n}\n```\n\n Data type: Object.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.datasetProperties.tableName\n\n</td><td>\n\nName of the table for the dataset. For example, `\"tableName\" : \"Incident\"`. Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.datasetProperties.fieldNames\n\n</td><td>\n\nList of field names from the specified table as strings. For example, `\"fieldNames\" : [\"short_description\", \"priority\"]`. Data type: Array.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.datasetProperties.fieldNames.fieldDetails\n\n</td><td>\n\nList of JavaScript objects that specify field properties. ```\n[\n  {\n    \"name\": \"String\",\n    \"type\": \"String\"\n  }\n]\n```\n\n Data type: Array.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.datasetProperties.fieldNames.fieldDetails.&lt;object&gt;.name\n\n</td><td>\n\nName of the field defining the type of information to restrict this dataset to. Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.datasetProperties.fieldDetails.&lt;object&gt;.type\n\n</td><td>\n\nMachine-learning field type. Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.datasetProperties.fieldDetails.encodedQuery\n\n</td><td>\n\nEncoded query string in the standard platform format. See [Encoded query strings](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-user-interface/c_EncodedQueryStrings.md).Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.domainName\n\n</td><td>\n\nDomain name associated with this dataset. See [Domain separation and Predictive Intelligence](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/intelligent-experiences/domain-separation-predictive-intelligence.md).Type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.encoder\n\n</td><td>\n\nEncoder object assigned to this solution. See [Encoder - Encoder\\(Object config\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/EncoderAPI.md).Data type: Object.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.groupByFieldName\n\n</td><td>\n\nField name by which the system groups records to build classification solutions. Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.inputFieldNames\n\n</td><td>\n\nList of input field names as strings. The model uses these fields used to make predictions. Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.label\n\n</td><td>\n\nIdentifies the prediction task. ```\n{\n  \"label\": \"my first prediction\"\n}\n```\n\n Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.name\n\n</td><td>\n\nSystem-assigned name. Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.predictedFieldName\n\n</td><td>\n\nIdentifies a field to be trained for predictability. Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.processingLanguage\n\n</td><td>\n\nProcessing language in two-letter ISO 639-1 language code format. Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.scope\n\n</td><td>\n\nObject scope. Currently the only valid value is `global`.Data type: String\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.stopwords\n\n</td><td>\n\nOptional. Preset list of strings that the system automatically generates based on the **language** property setting. For details, see [Create a custom stopwords list](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/intelligent-experiences/create-custom-stopwords-list.md). Data type: Array.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.trainingFrequency\n\n</td><td>\n\nThe frequency to retrain the model. Possible values:\n\n-   every\\_30\\_days\n-   every\\_60\\_days\n-   every\\_90\\_days\n-   every\\_120\\_days\n-   every\\_180\\_days\n-   run\\_once\n\nDefault: run\\_once\n\n Data type: String.\n\n</td></tr></tbody>\n</table>The following example gets properties of a solution object in the store.\n\n```\nvar mySolution = sn_ml.ClassificationSolutionStore.get('ml_sn_global_global_classification_solution');\n\ngs.print(JSON.stringify(JSON.parse(mySolution.getProperties()), null, 2));\n```\n\nOutput:\n\n```\n*** Script: {\n  \"datasetProperties\": {\n    \"tableName\": \"incident\",\n    \"fieldNames\": [\n      \"category\",\n      \"short_description\",\n      \"priority\",\n      \"assignment_group.name\"\n    ],\n    \"fieldDetails\": [\n      {\n        \"name\": \"category\",\n        \"type\": \"nominal\"\n      },\n      {\n        \"name\": \"short_description\",\n        \"type\": \"text\"\n      }\n    ]\n  },\n  \"domainName\": \"global\",\n  \"inputFieldNames\": [\n    \"short_description\"\n  ],\n  \"label\": \"my solution definition\",\n  \"name\": \"ml_x_snc_global_global_my_solution_definition_26\",\n  \"predictedFieldName\": \"category\",\n  \"processingLanguage\": \"en\",\n  \"scope\": \"global\",\n  \"stopwords\": [\n    \"Default English Stopwords\"\n  ],\n  \"trainingFrequency\": \"run_once\"\n}\n```\n\n## ClassificationSolution - getVersion\\(String version\\)\n\nGets a solution by provided version number.\n\n|Name|Type|Description|\n|----|----|-----------|\n|version|String|Existing version number of a solution.|\n\n|Type|Description|\n|----|-----------|\n|Object|Specified version of the [ClassificationSolution\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionAPI.md) object on which you can call [ClassificationSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionVersionAPI.md) API methods.|\n\nThe following example shows how to get the training status of a solution by version number.\n\n```\nvar mlSolution = sn_ml.ClassificationSolutionStore.get('ml_x_snc_global_global_classification');\n\ngs.print(JSON.stringify(JSON.parse(mlSolution.getVersion('1').getStatus()), null, 2));\n```\n\nOutput:\n\n```\n{\n  \"state\": \"solution_complete\",\n  \"percentComplete\": \"100\",\n  \"hasJobEnded\": \"true\"\n}\n```\n\n## ClassificationSolution - setActiveVersion\\(String version\\)\n\nActivates a specified version of a solution in the store.\n\n<table id=\"table_pps_43z_llb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nversion\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the [ClassificationSolution\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionAPI.md) object version to activate.Activating this version deactivates any other version.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|None| |\n\nThe following example shows how to activate a solution version in the store.\n\n```\nsn_ml.ClassificationSolution.setActiveVersion(\"ml_incident_categorization\");\n```\n\n## ClassificationSolution - submitTrainingJob\\(\\)\n\nSubmits a training job.\n\n**Note:** Before running this method, you must first add a solution to the store using the [ClassificationSolutionStore - add\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionStoreAPI.md) method.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Object|[ClassificationSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionVersionAPI.md) object corresponding to the [ClassificationSolution](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClassificationSolutionAPI.md) being trained.|\n\nThe following example shows how to create a dataset, apply it to a solution, add the solution to a store, and submit the training job.\n\n```\n// Create a dataset \nvar myData = new sn_ml.DatasetDefinition({\n\n  'tableName' : 'incident',\n  'fieldNames' : ['assignment_group', 'short_description', 'description'],\n  'encodedQuery' : 'activeANYTHING'\n\n});\n\n// Create a solution \nvar mySolution = new sn_ml.ClassificationSolution({\n\n  'label': \"my solution definition\",\n  'dataset' : myData,\n  'predictedFieldName' : 'assignment_group',\n  'inputFieldNames':['short_description']\n\n});\n\n// Add the solution to the store to later be able to retrieve it.\nvar my_unique_name = sn_ml.ClassificationSolutionStore.add(mySolution);\n\n// Train the solution - this is a long running job \nvar myClassifierVersion = mySolution.submitTrainingJob();\n```\n\n"}}