{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":730,"path":"api-reference/server-api-reference/ClusteringSolutionAPI.md","title":"ClusteringSolution - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# ClusteringSolution- Global\n\nThe ClusteringSolution 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.  Use the [constructor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionAPI.md) to create a clustering solution object.\n3.  Add the solution object to the clustering solution store using the [ClusteringSolutionStore - add\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionStoreAPI.md) method.\n4.  Train the solution using the [submitTrainingJob\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionAPI.md) method. This creates a version of the object that you can manage using the [ClusteringSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionVersionAPI.md) API.\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## ClusteringSolution - ClusteringSolution\\(Object config\\)\n\nCreates a cluster 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  \"clusterConcept\": \"String\",\n  \"clusterConceptFieldNames\": [Array],\n  \"dataset\": {Object},\n  \"domainName\": \"String\",\n  \"groupByFieldName\": \"String\",\n  \"groupUnclusteredRecords\": Boolean,\n  \"inputFieldNames\": [Array],\n  \"label\": \"String\",\n  \"maxTimeWindowForUpdate\" : Number,\n  \"minRecordsPerCluster\" : Number,\n  \"minRowCount\": \"String\",\n  \"processingLanguage\": \"String\",\n  \"stopwords\": [Array],\n  \"trainingFrequency\": \"String\",\n  \"updateFrequency\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nconfig.algorithmConfig\n\n</td><td>\n\nObject\n\n</td><td>\n\nRequired. JavaScript object containing algorithm configuration properties. Property settings vary by the value set in the **algorithm** property.```\n'algorithmConfig': {\n  \"algorithm\": \"String\",  \n  // See algorithmConfig.algorithm setting description for property settings based on algorithm\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. Valid values:\n\n-   **dbscan** – Density-Based Spatial Clustering of Applications with Noise \\(DBSCAN\\) clustering algorithm. Properties used with this algorithm:\n    -   **distanceMetric**\n    -   **epsilon**\n    -   **minimumNeighbours**\n-   **hdbscan** – Hierarchical Density Based Spatial Clustering of Applications with Noise \\(HDBSCAN\\) clustering algorithm. Properties used with this algorithm:\n    -   **minimumSamples**\n-   **kmeans** – K-means clustering algorithm. Default. The **targetCoverage** property is used with this algorithm.\n\n Some users prefer DBSCAN because it doesn't require you to specify the number of clusters in the data before clustering.\n\n Properties for **dbscan**:\n\n```\n'algorithmConfig': {\n  \"algorithm\": \"dbscan\",\n  \"distanceMetric\": \"String\",\n  \"epsilon\": Number,\n  \"minimumNeighbours\": Number\n}\n```\n\n Properties for **hdbscan**:\n\n```\n'algorithmConfig': {\n  \"algorithm\": \"hdbscan\",\n  \"minimumSamples\": Number\n}\n```\n\n Properties for **kmeans**:\n\n```\n'algorithmConfig': {\n  \"algorithm\": \"kmeans\",\n  \"targetCoverage\": Number\n}\n```\n\n</td></tr><tr><td>\n\nconfig.algorithmConfig.distanceMetric\n\n</td><td>\n\nString\n\n</td><td>\n\nDBSCAN algorithm only. Distance metric to scan for similar data objects. Valid values: **levenshteinDistance**\n\n</td></tr><tr><td>\n\nconfig.algorithmConfig.epsilon\n\n</td><td>\n\nNumber\n\n</td><td>\n\nDBSCAN algorithm only. Decimal value between 0 and 1 representing the size of the neighborhood search radius.\n\n</td></tr><tr><td>\n\nconfig.algorithmConfig.minimumNeighbours\n\n</td><td>\n\nNumber\n\n</td><td>\n\nDBSCAN algorithm only. Minimum number of neighbors required in a point to be a part of a cluster. For **levenshteinDistance** the value must be 1 so that no points are excluded from the dataset.\n\n</td></tr><tr><td>\n\nconfig.algorithmConfig.minimumSamples\n\n</td><td>\n\nNumber\n\n</td><td>\n\nMinimum number of data samples in a neighborhood required to determine if a point is a core point.Default: None\n\n</td></tr><tr><td>\n\nconfig.algorithmConfig.targetCoverage\n\n</td><td>\n\nNumber\n\n</td><td>\n\nK-means algorithm only. Percentile field to filter out records that are less similar to each other.\n\n</td></tr><tr><td>\n\nconfig.clusterConcept\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Concept type. A concept is a set of words listed in descending order of frequency. To generate a TFIDF-based cluster concept, set the value to `tfidf`. Concept types are listed in the Clustering Definitions \\[ml\\_capability\\_definition\\_clustering\\] table. Default: Frequency-based cluster concept\n\n</td></tr><tr><td>\n\nconfig.clusterConceptFieldNames\n\n</td><td>\n\nArray\n\n</td><td>\n\nOptional. List of cluster concept field names. These values are external columns for creating a cluster concept and not used for cluster solution training. If external columns are provided, those columns are only used for the cluster concept and not for clustering solution training. Cluster concept fields are listed in the Clustering Definitions \\[ml\\_capability\\_definition\\_clustering\\] table.Default: Input text columns generate the cluster concept\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) object 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.groupByFieldName\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Field name by which the system groups records into one or more clusters. In the following setup example, the system groups each type into an individual cluster, rendering 10 clusters.\n\n-   **groupByFieldName** value is `'category'`\n-   [DatasetDefinition](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/DatasetDefinitionAPI.md) **tableName** value is `'incident'`\n-   Incident \\[incident\\] table has 10 category types\n\n</td></tr><tr><td>\n\nconfig.groupUnclusteredRecords\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether to group unclustered records in results.\n\n Valid values:\n\n-   true: Group unclustered records separately in results.\n-   false: Do not group unclustered records in results. Unclustered values \\(-1\\) display with the rest of the results.\n\n Default: false\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.maxTimeWindowForUpdate\n\n</td><td>\n\nNumber\n\n</td><td>\n\nOptional. Number of minutes preceding the model update point to look for records. For example, if the value is 15, the system only looks for records created in the preceding 15 minutes. By default, the system scans all records.\n\n</td></tr><tr><td>\n\nconfig.minRecordsPerCluster\n\n</td><td>\n\nNumber\n\n</td><td>\n\nOptional. Minimum number of records to allow in any cluster. The value must be greater than or equal to 2.Default: 2\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.processingLanguage\n\n</td><td>\n\nString\n\n</td><td>\n\nProcessing language in two-letter ISO 639-1 language code format.\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><tr><td>\n\nconfig.updateFrequency\n\n</td><td>\n\n \n\n</td><td>\n\nThe frequency at which the model for the solution definition must be rebuilt. Possible values:\n\n-   do\\_not\\_update\n-   every\\_1\\_day\n-   every\\_1\\_hour\n-   every\\_6\\_hours\n-   every\\_12\\_hours\n-   every\\_1\\_minute\n-   every\\_15\\_minutes\n-   every\\_30\\_minutes\n\nDefault: do\\_not\\_update\n\n</td></tr></tbody>\n</table>The following example shows how to create an object and add it to the ClusteringSolution store. The example also shows how to submit the object for training.\n\n```\ntry{\n    var myData = new sn_ml.DatasetDefinition({\n        'tableName' : 'incident',\n        'fieldNames' : ['category', 'short_description', 'state', 'description'],\n        'encodedQuery' : 'activeANYTHING'\n    });\n      \n    var mySolution = new sn_ml.ClusteringSolution({\n        'label': \"clustering solution\",\n        'dataset' : myData,\n        'inputFieldNames':['short_description'],                \n        'groupByFieldName' : 'category',        \n        'algorithmConfig' : {\n            'algorithm' : 'kmeans',\n            'targetCoverage' : '90'\n        }\n    });\n    \n    // add solution\n    var solutionName = sn_ml.ClusteringSolutionStore.add(mySolution);\n    var solutionVersion = mySolution.submitTrainingJob();    \n    var trainingStatus = solutionVersion.getStatus();\n    gs.print(JSON.stringify(JSON.parse(trainingStatus), null, 2));\n​\n} catch(ex){\n    gs.print('Exception caught: '+ ex.getMessage());\n}\n```\n\nOutput:\n\n```\n{\n  \"state\": \"waiting_for_training\",\n  \"percentComplete\": \"0\",\n  \"hasJobEnded\": \"false\"\n}\n```\n\nThe following example shows how to include the 'description' field as a cluster concept field.\n\n```\nvar myIncidentData = new sn_ml.DatasetDefinition({\n    'tableName' : 'incident',\n    'fieldNames' : ['category', 'short_description', 'description'],\n});\n\nvar mySolution = new sn_ml.ClusteringSolution({\n\t'label': 'clustering_test',\n\t'dataset': myIncidentData,\n\t'inputFieldNames': ['short_description'],\n\t'clusterConceptFieldNames': ['description']\n});\n\nvar solutionNameFromStore = sn_ml.ClusteringSolutionStore.add(mySolution);\nvar myClassifier = mySolution.submitTrainingJob(); \n```\n\n## ClusteringSolution - 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.ClusteringSolutionStore.get('ml_sn_global_global_clustering');\n\nmySolution.cancelTrainingJob();\n```\n\n## ClusteringSolution - getActiveVersion\\(\\)\n\nGets the active ClusteringSolutionVersion object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Object|Active [ClusteringSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionVersionAPI.md) object.|\n\nThe following example shows how to get an active ClusteringSolution version from the store and return its training status.\n\n```\nvar mlSolution = sn_ml.ClusteringSolutionStore.get('ml_x_snc_global_global_clustering');\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## ClusteringSolution - getAllVersions\\(\\)\n\nGets all versions of a clustering solution.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Array|Existing versions of a solution object. See also [ClusteringSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionVersionAPI.md) API.|\n\nThe following example shows how to get all ClusteringSolution version objects and call the getVersionNumber\\(\\) and getStatus\\(\\) solution version methods on them.\n\n```\nvar mlSolution = sn_ml.ClusteringSolutionStore.get('ml_x_snc_global_global_clustering');\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## ClusteringSolution - getLatestVersion\\(\\)\n\nGets the latest version of a solution.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Object|[ClusteringSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionVersionAPI.md) object corresponding to the latest version of a [ClusteringSolution\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionAPI.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.ClusteringSolutionStore.get('ml_x_snc_global_global_clustering');\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## ClusteringSolution - 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 ClusteringSolution 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('clustering'));\n\nvar myCluster = new sn_ml.ClusteringSolution({\n   'label': \"my clustering solution\",\n   'dataset' : myIncidentData,\n   'inputFieldNames': eligibleFields['eligibleInputFieldNames'],\n   'predictedFieldName': 'category'\n});\n\n// update solution\nsn_ml.ClusteringSolutionStore.update('ml_x_snc_global_global_clustering_solution', myCluster);\n\n// print solution name\ngs.print('Solution Name: '+myCluster.getName());\n```\n\nOutput:\n\n```\nSolution Name: ml_x_snc_global_global_clustering_solution\n```\n\n## ClusteringSolution - 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 [ClusteringSolution\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionAPI.md) object details in the [ClusteringSolutionStore](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionStoreAPI.md).```\n{\n  \"algorithmConfig\": {Object},\n  \"datasetProperties\": {Object},\n  \"domainName\": \"String\",\n  \"groupByFieldName\": \"String\",\n  \"inputFieldNames\": [Array],\n  \"label\": \"String\",\n  \"minRecordsPerCluster\" : Number,\n  \"name\": \"String\",\n  \"processingLanguage\": \"String\",\n  \"scope\": \"String\",\n  \"stopwords\": [Array],\n  \"trainingFrequency\": \"String\",\n  \"updateFrequency\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.algorithmConfig\n\n</td><td>\n\nJavaScript object containing algorithm configuration properties. Property results vary by the value set in the **algorithm** property.```\n'algorithmConfig' : {\n  \"algorithm\": \"String\",  \n  // See algorithmConfig.algorithm setting description for property settings based on algorithm\n}\n```\n\n Data type: Object.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.algorithmConfig.algorithm\n\n</td><td>\n\nMethod for encoding your solution. Properties for **dbscan**:\n\n```\n'algorithmConfig': {\n  \"algorithm\": \"dbscan\",\n  \"distanceMetric\": \"String\",\n  \"epsilon\": Number,\n  \"minimumNeighbours\": Number\n}\n```\n\n Properties for **kmeans**:\n\n```\n'algorithmConfig': {\n  \"algorithm\": \"kmeans\",\n  \"targetCoverage\": Number\n}\n```\n\n Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.algorithmConfig.distanceMetric\n\n</td><td>\n\nDBSCAN algorithm only. Distance metric to scan for similar data objects. Data type: String.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.algorithmConfig.epsilon\n\n</td><td>\n\nDBSCAN algorithm only. Decimal value between 0 and 1 representing the size of the neighborhood search radius. Data type: Number.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.algorithmConfig.minimumNeighbours\n\n</td><td>\n\nDBSCAN algorithm only. Minimum number of neighbors required in a point to be a part of a cluster. For **levenshteinDistance** the value must be 1 so that no points are excluded from the dataset. Data type: Number.\n\n</td></tr><tr><td>\n\n&lt;Object&gt;.algorithmConfig.targetCoverage\n\n</td><td>\n\nK-means algorithm only. Percentile field to filter out records that are less similar to each other. Data type: Number.\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;.groupByFieldName\n\n</td><td>\n\nField name by which the system groups records into one or more clusters. 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;.minRecordsPerCluster\n\n</td><td>\n\nMinimum number of records to allow in any cluster. Data type: Number.\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><tr><td>\n\n&lt;Object&gt;.updateFrequency\n\n</td><td>\n\nThe frequency at which the model for the solution definition must be rebuilt. Possible values:\n\n-   do\\_not\\_update\n-   every\\_1\\_day\n-   every\\_1\\_hour\n-   every\\_6\\_hours\n-   every\\_12\\_hours\n-   every\\_1\\_minute\n-   every\\_15\\_minutes\n-   every\\_30\\_minutes\n\nDefault: do\\_not\\_update\n\n Datatype: String\n\n</td></tr></tbody>\n</table>The following example gets properties of a solution object in the store.\n\n```\nvar myCluster = new sn_ml.ClusteringSolutionStore.get(\"ml_x_snc_global_global_clustering_solution\");\n\ngs.print(JSON.stringify(JSON.parse(myCluster.getProperties()), null, 2));\n```\n\nOutput:\n\n```\n*** Script: {\n  \"algorithmConfig\": {\n    \"algorithm\": \"kmeans\",\n    \"targetCoverage\": \"90\"\n  },\n  \"datasetProperties\": {\n    \"tableName\": \"incident\",\n    \"fieldNames\": [\n      \"category\",\n      \"short_description\",\n      \"state\",\n      \"description\"\n    ],\n    \"encodedQuery\": \"activeANYTHING\"\n  },\n  \"domainName\": \"global\",\n  \"groupByFieldName\": \"category\",\n  \"inputFieldNames\": [\n    \"short_description\"\n  ],\n  \"label\": \"clustering solution\",\n  \"minRecordsPerCluster\": 2,\n  \"name\": \"ml_x_snc_global_global_clustering_solution\",\n  \"processingLanguage\": \"en\",\n  \"scope\": \"global\",\n  \"stopwords\": [\n    \"Default English Stopwords\"\n  ],\n  \"trainingFrequency\": \"run_once\",\n  \"updateFrequency\": \"do_not_update\"\n}}\n```\n\n## ClusteringSolution - 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 [ClusteringSolution\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionAPI.md) object on which you can call [ClusteringSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionVersionAPI.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.ClusteringSolutionStore.get('ml_x_snc_global_global_clustering');\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## ClusteringSolution - 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 [ClusteringSolution\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionAPI.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.ClusteringSolution.setActiveVersion(\"ml_incident_categorization\");\n```\n\n## ClusteringSolution - submitTrainingJob\\(\\)\n\nSubmits a training job.\n\n**Note:** Before running this method, you must first add a solution to the store using the [ClusteringSolutionStore - add\\(\\)](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionStoreAPI.md) method.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Object|[ClusteringSolutionVersion](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionVersionAPI.md) object corresponding to the [ClusteringSolution](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/ClusteringSolutionAPI.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.ClusteringSolution({\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.ClusteringSolutionStore.add(mySolution);\n\n// Train the solution - this is a long running job \nvar myClusterVersion = mySolution.submitTrainingJob();\n```\n\n"}}