API Document

Clicking on the API Document tab beside the Inference tab will show all the information required by a user to perform a bulk inference or make inferences via the Logical Glue API.

This page provides information about:

1. The API endpoint for inferences: 

2.  An example JSON object containing the model data

You can download this example JSON by clicking on the Download Example JSON button. You can also change the values of the data in the JSON object while calling the API.

3. Information about the headers and the method to be used to call the API.

4. Along with the JSON object user can pass some additional parameters in the request to perform bulk inference or to get detailed response from the model.

  • Detailed: You can add the property "detailed":true in the JSON input object to get a more detailed response for the inference as shown below:

The detailed information flag will show the rules and drivers that go into contributing to the final decision, just like the fuzzy insight pages.

The detailed result section has 3 sub sections:
1. Detailed Results: Here we can find the contribution of each of the rules towards the final score. The rules are listed as per their contribution to the target feature classes. For the regression model, the rules are listed by contribution to each of the output membership functions.
  • rank : In case of binary models, rank will be 1 for the majority class and 2 for the minority class. For multiclass models, the rank class can be figured out by the name attribute. For regression models, they are based on membership function of output class.
  • name: Name of the class or membership function depending on the model type.
  • overall: In binary models, It shows the model score of the majority class for rank 1 and (1-model score for majority class) for rank 2 whereas in regression models, it shows the model score for the given membership function of the output class.
  • color: It shows the rgb values of the color that represent the rank in the UI.
  • rules:  This field contains array of rules where each rule contain the following fields:
    • firingStrength: Combining membership functions of the antecedents in the rule for this instances data.
    • dominance: Dominance score represents the importance of a rule. The dominance combines support (how frequently a rule applies), and confidence (how frequently the rule is correct).
    • ratioAsPercentage: Proportionate contribution of this rule towards the final score, when combining rules pointing on both directions. It is a combination of dominance and firing strength.
    • antecedent: List of all premises.
    • ruleId: Id of this rule in the ruleset.
    • dominanceRating: The dominance score of the rule is normalised and bucketed into five ranges- the star rating between 1-5 inclusive.
    • label: Direction or membership function this rule points towards.
2. Compact Result: The compact result lists the summarised detailed with drivers for each class in case of classification models. For regression models, it lists  the drivers to each of the membership function of target feature. Compact Result has similar fields as in detailed results but here the rules field contains information about the drivers instead of the rules:
  • rules: This field contains array of drivers where each driver contain the following fields:
    • feature: feature name from which this driver is derived.
    • drivers: NONEMPTY list of all nonzero memberships of the given feature.
3. Fuzzy Drivers: This also lists the drivers but with deeper insights about their contribution. It contains the consonances, dissonances and weight of each of the drivers towards the final score. 
  • rules: Rules in fuzzy drivers contains the following fields for each driver:
    • feature: feature name from which this driver is derived.
    • values: NONEMPTY list of all nonzero memberships of the given feature.
    • actualValue: Record value of the instance for the given feature.
    • consonances: NONEMPTY rules which point towards this rank.
    • dissonances: This field shows the rules which point towards the other ranks. If the rule points towards only one direction then it will contain an empty list.
    • weight: contribution of this driver towards the final score, where the driver weight is calculated as shown below:

  • Probability: You can also add the property "probability":true in the JSON input object to get the corresponding probability value along with the response for the inference as shown below:

The probability value will only be shown if the corresponding model has a default bucketing, otherwise the key will be omitted.

  • Bulk: The API endpoint to perform batch inference request is:

A sample example of the JSON object to be passed as a request to perform bulk inference using the batch property is shown below:

The API response will be a JSON object as shown below:

You can download a sample JSON object by clicking on the Download Model Schema JSON button to know the features expected by the model, their type and the valid values that they may contain.

This page also gives detailed information about the response returned by the API along with a brief description about all the fields in the response object.

A multiclass inference has the output ratios for each of the non zero classes

{
  "externalId": null,
  "bucketName": null,
  "inferenceUri": "api/audit/model/767b715d-0771-4a60-a343-d805fc63cb52?time=1625223824936",
  "score": 0.6147466152906418,
  "detailedInformation": {
    "results": {}
  },
  "inferenceResultEncoded": 0,
  "inferenceResultDecoded": "RENT",
  "mapOutputRatios": {
    "OTHER": 0.03149736858904362,
    "OWN": 0.19873086810111998,
    "MORTGAGE": 0.12357391044497489,
    "NOne": 0.03145122341811657,
    "RENT": 0.6147466152906418
  },
  "warnings": [],
  "status": "SUCCESS"
}

If the model is regression, there is another element: scoreInterval, which is the confidence interval which the score lies within.

Still need help? Contact Us Contact Us