Exploration API
About the Exploration API
The Exploration API allows for the request of statistical metrics of SymetryML projects using univariate, bivariate, Hypothesis Testing (ztest, test, ftest, ANOVA) as well as Information Gain analyses. The body of the request contains a ExploreContext which in turn is a list of MLContext, one for each feature for which exploration data is needed.
MLContext Parameters for Peer Exploration
If the project is part of a federation it might be possible to ask that the exploration result is fetched from a given node. This can be done by specifying which peer to use with the following extra parameters inside a MLContext. Please consult the About Federated Learning : Peer Exploration section for details.
| Key | |
|---|---|
| fed_peer_uuid_for_explore | Peer ID to use for exploration results. |
URL
POST /symetry/rest/{cid}/projects/{pid}/explore?metric={_metric_} [body=ExploreContext]Query Parameters
| Parameter | Required / Optional | Description |
|---|---|---|
| metric | Required | Metric to use for exploration. For more information, see the section List of Metrics |
| async | Optional | If set to true then the exploration will be done asynchronously and the result will be fetched using the Job API. |
| returnProjectInfo | Optional | Whether to return project info in the response. Default is true. |
HTTP Responses
| HTTP Status Code | HTTP Status Message | Description |
|---|---|---|
| 200 | OK | Success. |
| 400 | BAD REQUEST | Unknown SymetryML project. {"statusCode":"BAD_REQUEST","statusString":" Cannot Find SYMETRYML id[r2] for Customer id [c1]","values":{}} |
HTTP Response Entity
The response is a KSVDMap entity. This structure is an array of map<key,value>, where keys are string and values are an Institute of Electrical and Electronics Engineers (IEEE) 64-bit double floating-point number. One such map is added to the response for each MLContext in the ExploreContext request body. The keys in each map depend on the metric query parameter. For more information, see the section ExploreContext.
| HTTP Response Entity | Example |
|---|---|
| KSVDMap | {"statusCode":"OK","statusString":"OK","values":{"KSVDMap":{"values":[{"count":150.0,"mean":5.843333333333334,"variance":0.6811222222222204,"skewness":0.31808651443435426,"stddev":0.8253012917851398}]}}} |
| ProjectInfo | A project info entity is also returned to reflect the state of the project that might have changed. |
List of "Metric" Query Parameters
Depending on the metric query parameter, different information is returned in the KSVDMap JSON response entity. The KSVDMap JSON entity is an array of map<key, value>, where key is a string and value is an IEEE 64-bit double floating-point number. The following table enumerates the keys that the response will contain for all valid metric query parameters.
| Metric | Description | KSVDMap Key |
|---|---|---|
| uni | Returns all univariate metrics for the attribute listed in each MLContext in the ExploreContext. If an MLContext has more than one attribute, only the first one is used. | - count = count of the attribute. - mean = mean of the attribute. - variance = variance of the attribute. - stddev = standard deviation of the attribute. - skewness = skewness of the attribute. - kurtosis = kurtosis of the attribute. - stderr = the standard deviation divided by the square root of the count for this feature. - meanMarginErrorC95 = Mean standard error 95% confidence level. |
| uni (with histogram) | For project with histogram enabled, additional information is returned. Please consult this section to learn how to enable histogram for a project. | - min = minimum value for this feature. - max = maximum value for this feature. - median = median value for this feature. |
| bi | Returns all bivariate metrics for the two attributes listed in each MLContext in the ExploreContext. Each MLContext should contain at least two attribute indexes. If there are more than two, only the first two are used. | - covar = covariance between the two attributes. - linCorr = linear correlation between the two attributes. - condMean = conditional mean. - condCount = conditional count. - condVariance = conditional variance. - condSum = conditional sum. - condStddev = conditional standard deviation. - biCi95Down = bivariate 95% confidence interval lower bound. - biCi95Up = bivariate 95% confidence interval upper bound. |
| ztest | Returns the z-test metrics using all of the MLContext in the ExploreContext request body. | - zn1 = count between attribute and target 1. - zn2 = count between attribute and target 2. - zm1 = mean between attribute and target 1. - zm2 = mean between attribute and target 2. - zs1 = variance between attribute and target 1. - zs2 = variance between attribute and target 2. - z = z test value. - zp = z test value probability. |
| ztestp | Returns the z-test-proportion metrics using all of the MLContext in the ExploreContext request body. | - z = z test value. - zp = z test value probability. |
| ztestmu | Returns the z-test - against a known mean - metrics using all of the MLContext in the ExploreContext request body. | - z = z test value. - zp = z test value probability. |
| ftest | Returns the f-test metrics using all of the MLContext in the ExploreContext request body. | - fn1 = count between attribute and target 1. - fn2 = count between attribute and target 2. - fm1 = mean between attribute and target 1. - fm2 = mean between attribute and target 2. - fs1 = variance between attribute and target 1. - fs2 = variance between attribute and target 2. - fdf1 = degree of freedom between attribute and target 1. - fdf2 = degree of freedom between attribute and target 2. - f = F test value. - fp = F test value probability. |
| ftestsigma | Returns the f-test - against a known variance - metrics using all of the MLContext in the ExploreContext request body. | - f = F test value. - fp = F test value probability. |
| ttest | Returns the t-test metrics using all of the MLContext in the ExploreContext request body. | - tn1 = count between attribute and target 1. - tn2 = count between attribute and target 2. - tm1 = mean between attribute and target 1. - tm2 = mean between attribute and target 2. - ts1 = variance between attribute and target 1. - ts2 = variance between attribute and target 2. - t = t test value. - tdf = t test value degree of freedom. - tp = t test value probability. - tu = t test value for unequal variance. - tdfu = t test value degree of freedom for unequal variance. - tpu = t test value probability for unequal variance. |
| ttestmu | Returns the T-test - against a known mean - metrics using all of the MLContext in the ExploreContext request body. | - t = T test value. - tp = T test value probability. |
| anova | Returns the ANOVA metrics using all of the MLContext in the ExploreContext request body. | - SSb = sum square between groups. - SSw = sum square within groups. - Dfb = degree of freedom between groups. - Dfw = degree of freedom within groups. - MSb = mean square between groups. - MSw = mean square within groups. - F = F value from F distribution. - Ssgamma = total sum of square. - Dfgamma* = total degree of freedom. - P = probability of F. |
| chi2 | Returns chi-square information using all of the MLContext in the ExploreContext request body. | - chiStat = chi-square value. - df = degree of freedom. - pval = probability. - coef = contingency coefficient. Additionally, for all the pair wise values the observed count will be returned as a value using the following format for the key. Example: obs$1:4 |
| gain | Returns information gain for a given attribute –input - given another attributes – target. |
Note ztestmu, ttestmu, and ftestsigma require the following parameters to be set in MLContext.extraParameters respectively: sml_explore_ztest_known_mu, sml_explore_ttest_known_mu, and sml_explore_ftest_known_sigma.
Various Hypothesis Test
Its possible to perform variations on ztest, ftest, ttest, anova, and chi-squared test. Depending on which test needs to be performed the MLContext must be populated differently.
| Hypothesis Testing Suite | |
|---|---|
| Hypothesis Test | MLContext Content |
| Z test Compare means of 2 continuous features. | inputAttributes: contains 2 continuous attributes ids |
| Z test Compare mean of 1 continuous feature against a known mean | * inputAttributes: contains 1 continuous attribute id * extraParameters: contains one key sml_explore_ztest_known_mu with known mean |
| Z test Compare means of a continuous feature conditioned on 2 binary features | inputAttributes: contains 3 attribute id, first one is continuous followed by 2 binary ids |
| Z test proportion Compare two proportions originated from two binary features | inputAttributes: contains 2 binary attribute id |
| F test Compare variance of 2 continuous features. | inputAttributes: contains 2 continuous attributes id |
| F test Compare variance of continuous feature against a known variance | * inputAttributes: contains 1 continuous attribute id * extraParameters: contains one key sml_explore_ftest_known_sigma with known variance / sigma |
| F test Compare variances of a continuous feature conditioned on 2 binary features | inputAttributes: contains 3 attribute id, first one is continuous followed by 2 binary ids |
| T test Compare means of 2 continuous features. | inputAttributes: contains 2 continuous attributes id |
| T test Compare mean of 1 continuous feature against a known mean | * inputAttributes: contains 1 continuous attribute id * extraParameters: contains one key sml_explore_ttest_known_mu with known mean |
| T test Compare means of a continuous feature conditioned on 2 binary features | inputAttributes: contains 3 attribute id, first one is continuous followed by 2 binary ids |
| Anova Compare means of 2 or more continuous features | inputAttributes: contains 2 or more continuous attribute id |
| Anova Compare means of a continuous feature conditioned on 2 or more binary features | * inputAttributes: contains 1 continuous attribute id * targets: contains 1 or more binary attribute id |
| Chi square Determine the association between binary features. | *inputAttributes: contains 2 or more binary attribute ids * targets: contains 2 or more binary attribute ids see Chi Square for example. |
| Chi square Determine the association between binary features based on category names | inputAttributes: list of category name See Chi Square for example. |
MLContext Extra Parameters for Bivariate Statistics
When using the bi metric, the following extra parameters can be included in the MLContext extraParameters field to request additional conditional statistics:
| Parameter | Type | Description |
|---|---|---|
| need_bi_conditional | Boolean | Request bivariate conditional statistics |
| need_bi_conditional_mmm | Boolean | Request conditional min, max, and median values |
| need_bi_conditional_ci95 | Boolean | Request conditional 95% confidence interval bounds |
Sample Request/Response Bivariate Statistics
Request:
POST url="http://charm:8080/symetry/rest/c1/projects/irisTest/explore?metric=bi"
Body:
{"values":[{"targets":[],"inputAttributes":["0","3"],"extraParameters":{}}]}
Response:
{"statusCode":"OK","statusString":"OK","values":{"smlInfo":{"pid":"r1","isDirty":true,"modelsList":[],"modelTypeList":[],"attributeNames":["sepal_length","sepal_width","petal_length","petal_width","sepal_lengt_b1","sepal_lengt_b2","sepal_width_b1","sepal_width_b2","petal_length_b1","petal_length_b2","petal_width_b1","petal_width_b2","Iris_setosa","Iris_versicolor","Iris_virginica"],"attributeIndexes":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"attributeTypes":["C","C","C","C","B","B","B","B","B","B","B","B","B","B","B"],"modelAssessments":{},"modelPredictions":{},"hash":-1,"categorySeparator":"$","type":"cpu","creationDate":1488220762857,"lastModificationDate":1488220780484,"loaded":true,"persisted":true},"KSVDMap":{"values":[{"linCorr":0.8180000000000001,"condVariance":30.9294,"covar":0.5135000000000001,"condCount":179.8,"condMean":6.2717}]}}}Sample Request/Response chi2 Example 1
Request:
POST url="http://charm:8080/symetry/rest/c1/projects/irisTest/explore?metric=chi2"
Body:
{"values":[{"targets":["12","13","14"],"inputAttributes":["10","11"],"inputAttributeNames":[],"extraParameters":{}}]}
Response:
{"statusCode":"OK","statusString":"OK","values":{"smlInfo":{"pid":"irisP","isDirty":true,"modelsList":[],"modelTypeList":[],"dsList":["Iris_rtlm.csv"],"attributeNames":["sepal_length","sepal_width","petal_length","petal_width","sepal_lengt_b1","sepal_lengt_b2","sepal_width_b1","sepal_width_b2","petal_length_b1","petal_length_b2","petal_width_b1","petal_width_b2","Iris_setosa","Iris_versicolor","Iris_virginica"],"attributeIndexes":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"attributeTypes":["C","C","C","C","B","B","B","B","B","B","B","B","B","B","B"],"modelAssessments":{},"modelPredictions":{},"params":{},"hash":-1,"categorySeparator":"$","type":"cpu","creationDate":1588623147023,"lastModificationDate":1588623148044,"loaded":true,"persisted":true,"histogramEnabled":true},"KSVDMap":{"values":[{"df":2.0,"obs$11:12":0.0,"coef":0.8409000000000001,"pval":0.0,"chiStat":150.0,"obs$10:14":0.0,"obs$10:13":0.0,"obs$10:12":50.0,"obs$11:13":50.0,"obs$11:14":50.0}]}}}Sample Request/Response chi2 Example 2
Request:
POST url="http://charm:8080/symetry/rest/c1/projects/dice/explore?metric=chi2"
Body:
{"values":[{"targets":[],"inputAttributes":["d1","d2","d3","d4","d5"],"inputAttributeNames":[],"extraParameters":{}}]}
Response:
{"statusCode":"OK","statusString":"OK","values":{"smlInfo":{"pid":"dicep","isDirty":true,"modelsList":[],"modelTypeList":[],"dsList":["dice5.csv"],"attributeNames":["d1$1","d1$5","d1$6","d1$3","d1$4","d1$2","d2$3","d2$2","d2$5","d2$6","d2$4","d2$1","d3$2","d3$1","d3$6","d3$4","d3$3","d3$5","d4$5","d4$2","d4$3","d4$6","d4$4","d4$1","d5$1","d5$2","d5$3","d5$4","d5$6","d5$5"],"attributeIndexes":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29],"attributeTypes":["B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B"],"modelAssessments":{},"modelPredictions":{},"params":{},"hash":-1,"categorySeparator":"$","type":"cpu","creationDate":1589219373647,"lastModificationDate":1589219374612,"loaded":true,"persisted":true,"histogramEnabled":false},"KSVDMap":{"values":[{"obs$d1:4":174.0,"obs$d2:3":180.0,"obs$d3:2":179.0,"obs$d4:2":155.0,"obs$d5:1":169.0,"obs$d1:3":156.0,"obs$d2:2":162.0,"obs$d3:1":175.0,"obs$d4:3":179.0,"obs$d5:2":172.0,"obs$d1:2":161.0,"obs$d2:1":145.0,"obs$d4:4":196.0,"obs$d5:3":164.0,"df":20.0,"obs$d1:1":182.0,"obs$d4:5":166.0,"obs$d5:4":177.0,"obs$d3:6":155.0,"obs$d2:6":178.0,"obs$d3:5":174.0,"pval":0.20470000000000002,"obs$d1:6":149.0,"obs$d2:5":141.0,"obs$d3:4":168.0,"obs$d1:5":178.0,"obs$d2:4":194.0,"obs$d3:3":149.0,"obs$d4:1":158.0,"obs$d4:6":146.0,"obs$d5:5":156.0,"obs$d5:6":162.0,"coef":0.0334,"chiStat":24.9148}]}}}VIF Exploration
This rest endpoint return the variance inflation factor for a list of features. This API function is asynchronous. If it succeeds, it returns a 202 response, along with a Location header that specifies the job URL. For more information about SymetryML asynchronous job please refer the section on Symetry Job.
URL
POST /symetry/rest/{cid}/projects/{pid}/vif [body=ExploreContext]HTTP Responses
| HTTP Status Code | HTTP Status Message | Description |
|---|---|---|
| 202 | OK | Job accepted. |
| 400 | BAD REQUEST | Unknown SymetryML project. {"statusCode":"BAD_REQUEST","statusString":" + Cannot Find SYMETRYML id[r2] for Customer id [c1]","values":{}} |
HTTP Response Entity
The response is a KSVSMap, the key are the input index as specified in the MLContext body and the value is the variance inflation factor for that index.
Sample Request/Response
Request:
POST url="http://charm:8080/symetry/rest/c1/projects/irisTest/vif"
Body:
{"values":[{"targets":[],"inputAttributes":["2","4"]}]}
Response Header:
Location: http://charm:8080/symetry/rest/c1/jobs/4
Response:
{"statusCode":"ACCEPTED","statusString":"Job Created","values":{}}
Job Request:
GET url="http://charm:8080/symetry/rest/c1/jobs/4
Job Response:
KSVSMapPCA Exploration
This REST endpoint allows for the request of the principal component analysis (PCA) of a set of attributes.
Note: PCA results are limited to a maximum of 100 dimensions by default to avoid excessively large response bodies. This limit can be configured using the
pcaNumDimensionparameter in the request body (see below), but the maximum number of Eigen values/vectors returned will not exceed 100.
This API function is asynchronous. If it succeeds, it returns a 202 response, along with a Location header that specifies the job URL. For more information about SymetryML asynchronous job please refer the section on Symetry Job.
URL
POST /symetry/rest/{cid}/projects/{pid}/explorepca?explainedCovariance [body=ExploreContext]Query Parameters
| Parameter | Required/Optional? | Description |
|---|---|---|
| explainedCovariance | Optional | This parameter controls how many Eigen vectors/values will be returned in term of explained covariance. Default is 1 which correspond to 100% of explained covariance. Note that in order to avoid sending too much large response body, the maximum number of Eigen values/vectors that will be returned is 100. |
Request Body
The request body is gonna be a MLContext that contains information about the inputs to use. It can also contains the following extra parameter pcaNumDimension to specify a maximum number of dimension to return. The default value is 100.
HTTP Responses
| HTTP Status Code | HTTP Status Message | Description |
|---|---|---|
| 200 | OK | Success. |
| 400 | BAD REQUEST | Unknown SymetryML project. {"statusCode":"BAD_REQUEST","statusString":" + Cannot Find SYMETRYML id[r2] for Customer id [c1]","values":{}} |
HTTP Response Entity
The response contains three keys:
- pcaVectors
- pcaValues
- pcaSumValues
The value for the pcaVectors and pcaValues keys is a Matrix stored in a DataFrame JSON data structure. The pcaSumValues key consists of a number that is the sum of all the Eigen values. See DataFrame for information on the DataFrame JSON structure.
| HTTP Response Entity | Example |
|---|---|
| pcaVectors | A DataFrame containing the PCA vectors. |
| pcaValues | A DataFrame containing the PCA values. |
| pcaSumValues | A number representing the total sum of the PCA values. You can use that number to compute the % of covariance explained by a given Eigen vectors. |
Sample Request/Response
Request:
POST url="http://charm:8080/symetry/rest/c1/projects/irisTest/explorepca"
Body:
{"values":[{"targets":[],"inputAttributes":["2","4"]}]}
Response Header:
Location: http://charm:8080/symetry/rest/c1/jobs/4
Response:
{"statusCode":"ACCEPTED","statusString":"Job Created","values":{}}
Job Request:
GET url="http://charm:8080/symetry/rest/c1/jobs/4
Job Response:
{pcaVectors, pcaValues, pcaSumValues}SVD Exploration
This REST endpoint allows to get the singular values decomposition (SVD) of a set of attributes.
This API function is asynchronous. If it succeeds, it returns a 202 response, along with a Location header that specifies the job URL. For more information about SymetryML asynchronous job please refer the section Symetry Job.
The request body needs to contains the list of input attributes id to be used while computing the singular value decomposition. Refer to section ExploreContext for details.
URL
POST /symetry/rest/{cid}/projects/{pid}/exploresvd [body=ExploreContext]HTTP Responses
| HTTP Status Code | HTTP Status Message | Description |
|---|---|---|
| 200 | OK | Success. |
| 400 | BAD REQUEST | Unknown SymetryML project. {"statusCode":"BAD_REQUEST","statusString":" + Cannot Find SYMETRYML id[r2] for Customer id [c1]","values":{}} |
HTTP Response Entity
| HTTP Response Entity | Example |
|---|---|
| KSVSMap | A map<String, String> map containing singular values along their attributes names. Each key/value pair in the result map contains: key = a SVD computed number, that is a singular value value = The name of the attribute |
Sample Request/Response
Request:
POST url="http://charm:8080/symetry/rest/c1/projects/irisTest/exploresvd"
Body:
{"values":[{"targets":[],"inputAttributes":["2","4", "3", "5"]}]}
Response Header:
Location: http://charm:8080/symetry/rest/c1/jobs/4
Response:
{"statusCode":"ACCEPTED","statusString":"Job Created","values":{}}
Job Request:
GET url="http://charm:8080/symetry/rest/c1/jobs/4
Job Response:
KSVSMAP{}SVD Features Selection
This REST endpoint allows to use singular value decomposition to perform feature selection. This endpoint will return a subset of attributes that are not singular based on the SVD algorithms. The SVD algorithms might be used multiple time internally to eventually reach the solution.
This API function is asynchronous. If it succeeds, it returns a 202 response, along with a Location header that specifies the job URL. For more information about SymetryML asynchronous job please refer the section Symetry Job.
The request body needs to contains the list of input attributes id to be used while computing the singular value decomposition. Refer to section ExploreContext for details.
URL
POST /symetry/rest/{cid}/projects/{pid}/exploresvdfs [body=ExploreContext]HTTP Responses
| HTTP Status Code | HTTP Status Message | Description |
|---|---|---|
| 200 | OK | Success. |
| 400 | BAD REQUEST | Unknown SymetryML project. {"statusCode":"BAD_REQUEST","statusString":" + Cannot Find SYMETRYML id[r2] for Customer id [c1]","values":{}} |
HTTP Response Entity
| HTTP Response Entity | Example |
|---|---|
| KSVSMap | A map<String, String> map containing singular values along their attributes names. Each key/value pair in the result map contains: key = a SVD computed number, that is a singular value value = The name of the attribute |
Density Estimates
This method returns the density estimate / histogram for any continuous or binary attributes in your SymetryML project. Histogram building must have been enabled - for the wanted symetry project - before invoking this rest endpoint. Histogram building for a project can be enabled by 2 means:
- When creating the project with the
enableHistogramquery parameter. See Create Project endpoint. - Explicitly invoking the Enable Histogram rest endpoint on any given project.
URL
POST /symetry/rest/{cid}/projects/{pid}/densityEstimate [body=ExploreContext]Query Parameters
| Parameter | Required / Optional | Description |
|---|---|---|
| useLocal | Optional | If "true", use local project for federated projects |
MLContext Parameters for Density Estimates
For each features / attributes for which histogram are requested a MLContext is needed inside the ExplorationContext. The following tables describes the extra parameters can be used:
| Parameter | Required / Optional | Description |
|---|---|---|
| hist_bins | Required | Number of bins in the histogram |
| hist_max | Optional | Minimum value of the histogram on the x axis |
| hist_min | Optional | Maximum value of the histogram on the x axis |
HTTP Responses
| HTTP Status Code | HTTP Status Message | Description |
|---|---|---|
| 200 | OK | Success. |
| 400 | BAD REQUEST | Unknown SymetryML project. {"statusCode":"BAD_REQUEST","statusString":" + Cannot Find SYMETRYML id[r2] for Customer id [c1]","values":{}} |
HTTP Response Entity
| HTTP Response Entity | Example |
|---|---|
| DensityList | see sample response below |
Sample Request/Response
Request:
POST url="http://charm:8080/symetry/rest/c1/projects/irisTest/densityEstimate"
Body:
{"values":[{"inputAttributeNames":["sepal_length"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"20"}},{"inputAttributeNames":["sepal_width"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"20"}},{"inputAttributeNames":["petal_length"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"20"}},{"inputAttributeNames":["petal_width"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"20"}},{"inputAttributeNames":["sepal_lengt_b1"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["sepal_lengt_b2"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["sepal_width_b1"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["sepal_width_b2"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["petal_length_b1"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["petal_length_b2"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["petal_width_b1"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["petal_width_b2"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["Iris_setosa"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["Iris_versicolor"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}},{"inputAttributeNames":["Iris_virginica"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"2"}}]}
Response:
{"statusCode":"OK","statusString":"OK","values":{"densityList":{"values":[{"attrName":"sepal_length","min":4.3,"max":7.9,"width":0.18000000000000002,"histogram":[4.0,5.0,7.0,16.0,9.0,5.0,13.0,14.0,10.0,6.0,10.0,16.0,7.0,11.0,5.0,1.0,4.0,1.0,5.0,1.0]},{"attrName":"sepal_width","min":2.0,"max":4.4,"width":0.12000000000000002,"histogram":[1.0,3.0,4.0,3.0,8.0,14.0,14.0,10.0,26.0,12.0,19.0,12.0,6.0,3.0,9.0,2.0,1.0,1.0,1.0,1.0]},{"attrName":"petal_length","min":1.0,"max":6.9,"width":0.29500000000000004,"histogram":[4.0,33.0,11.0,2.0,0.0,0.0,1.0,2.0,3.0,5.0,12.0,14.0,12.0,17.0,6.0,12.0,7.0,4.0,2.0,3.0]},{"attrName":"petal_width","min":0.1,"max":2.5,"width":0.12,"histogram":[34.0,7.0,7.0,1.0,1.0,0.0,0.0,7.0,3.0,5.0,21.0,12.0,4.0,2.0,17.0,6.0,6.0,3.0,8.0,6.0]},{"attrName":"sepal_lengt_b1","min":0.0,"max":1.0,"width":0.5,"histogram":[67.0,83.0]},{"attrName":"sepal_lengt_b2","min":0.0,"max":1.0,"width":0.5,"histogram":[83.0,67.0]},{"attrName":"sepal_width_b1","min":0.0,"max":1.0,"width":0.5,"histogram":[93.0,57.0]},{"attrName":"sepal_width_b2","min":0.0,"max":1.0,"width":0.5,"histogram":[57.0,93.0]},{"attrName":"petal_length_b1","min":0.0,"max":1.0,"width":0.5,"histogram":[89.0,61.0]},{"attrName":"petal_length_b2","min":0.0,"max":1.0,"width":0.5,"histogram":[61.0,89.0]},{"attrName":"petal_width_b1","min":0.0,"max":1.0,"width":0.5,"histogram":[100.0,50.0]},{"attrName":"petal_width_b2","min":0.0,"max":1.0,"width":0.5,"histogram":[50.0,100.0]},{"attrName":"Iris_setosa","min":0.0,"max":1.0,"width":0.5,"histogram":[100.0,50.0]},{"attrName":"Iris_versicolor","min":0.0,"max":1.0,"width":0.5,"histogram":[100.0,50.0]},{"attrName":"Iris_virginica","min":0.0,"max":1.0,"width":0.5,"histogram":[100.0,50.0]}]}}}
Conditional Density Estimates
This method returns conditional density estimates (histograms) for pairs of attributes in your SymetryML project. It is useful for bivariate analysis with conditional distributions. Histogram building must have been enabled for the project before invoking this endpoint.
URL
POST /symetry/rest/{cid}/projects/{pid}/conditionalDensityEstimate [body=ExploreContext]Query Parameters
| Parameter | Required / Optional | Default | Description |
|---|---|---|---|
| tps | Optional | 10 | Thread pool size for parallel processing |
| useLocal | Optional | - | If "true", use local project for federated projects |
Request Body
The request body is an ExploreContext containing pairs of attributes. Each MLContext should specify:
- The conditional attribute (the attribute to condition on)
- The target attribute (the attribute for which to compute the conditional density)
HTTP Responses
| HTTP Status Code | HTTP Status Message | Description |
|---|---|---|
| 200 | OK | Success. |
| 400 | BAD REQUEST | Unknown SymetryML project. {"statusCode":"BAD_REQUEST","statusString":"Cannot Find SYMETRYML id[r2] for Customer id [c1]","values":{}} |
HTTP Response Entity
| HTTP Response Entity | Example |
|---|---|
| DensityList | Contains conditional density estimates for each pair of attributes requested. |
Sample Request/Response
Request:
POST url="http://charm:8080/symetry/rest/c1/projects/irisTest/conditionalDensityEstimate?tps=10"
Body:
{"values":[{"inputAttributeNames":["sepal_length","petal_length"],"inputAttributes":[],"targets":[],"extraParameters":{"hist_bins":"20"}}]}
Response:
{"statusCode":"OK","statusString":"OK","values":{"densityList":{"values":[{"attrName":"petal_length|sepal_length","min":1.0,"max":6.9,"width":0.295,"histogram":[...]}]}}}