Constructor
new Clustering()
- Source:
Methods
(async) addClusterLabel(documentDb, input) → {Promise.<Object>}
- Description:
- returns a success message if the cluster label was inserted successfully.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorId: "abc", modelVersion: "2", clusterIndex: "1", label: "left"};
let clusteringObject = new mdx.Services.Clustering();
let result = await clusteringObject.addClusterLabel(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Description |
sensorId |
string
|
|
modelVersion |
string
|
|
clusterIndex |
string
|
|
label |
string
|
|
|
Returns:
A success message is returned
-
Type
-
Promise.<Object>
(async) doesClusterLabelExist(documentDb, input) → {Promise.<boolean>}
- Description:
- returns if a cluster label already exists.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorId: "abc", modelVersion: "2", label: "left"};
let clusteringObject = new mdx.Services.Clustering();
let clusterLabelExists = await clusteringObject.doesClusterLabelExist(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Description |
sensorId |
string
|
|
modelVersion |
string
|
|
label |
string
|
|
|
Returns:
A boolean is returned which signifies whether the cluster label already exists
-
Type
-
Promise.<boolean>
(async) getClusterLabels(documentDb, input) → {Promise.<Map.<string, string>>}
- Description:
- returns a map containing clusterIndex and the latest cluster label associated to it.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorId: "abc", modelVersion: "2"};
let clusteringObject = new mdx.Services.Clustering();
let labelMap = await clusteringObject.getClusterLabels(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Attributes |
Default |
Description |
sensorId |
string
|
|
|
|
modelVersion |
string
|
|
|
|
clusterIndex |
string
|
<optional>
<nullable>
|
null
|
|
|
Returns:
A map containing clusterIndex and the latest cluster label associated to it is returned
-
Type
-
Promise.<Map.<string, string>>
(async) getSampledBehaviorClusters(documentDb, input) → {Promise.<Object>}
- Description:
- returns sampled behaviors for each cluster.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorId: "abc", fromTimestamp: "2023-01-12T11:20:10.000Z", toTimestamp: "2023-01-12T14:20:10.000Z"};
let clusteringObject = new mdx.Services.Clustering();
let clusters = await clusteringObject.getSampledBehaviorClusters(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Attributes |
Default |
Description |
sensorId |
string
|
|
|
|
fromTimestamp |
string
|
|
|
|
toTimestamp |
string
|
|
|
|
clusterIndex |
string
|
<optional>
<nullable>
|
null
|
|
maxClusterSampleSize |
number
|
<optional>
|
100
|
maxClusterSampleSize must be an integer. |
minBehaviorDistance |
number
|
<optional>
|
30
|
|
|
Returns:
An object containing sampled behaviors for each cluster is returned
-
Type
-
Promise.<Object>
(async) isValidCluster(documentDb, input) → {Promise.<boolean>}
- Description:
- returns if a cluster is valid.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
const elastic = new mdx.Utils.Elasticsearch({node: "elasticsearch-url"},databaseConfigMap);
let input = {sensorId: "abc", modelVersion: "2", clusterIndex: "1"};
let clusteringObject = new mdx.Services.Clustering();
let validCluster = await clusteringObject.isValidCluster(elastic,input);
Parameters:
Name |
Type |
Description |
documentDb |
Database
|
Database Object |
input |
Object
|
Input object.
Properties
Name |
Type |
Description |
sensorId |
string
|
|
modelVersion |
string
|
|
clusterIndex |
string
|
|
|
Returns:
Validity of the cluster is returned
-
Type
-
Promise.<boolean>