Skip to content

Classifiers


The Fidescls framework is constructed in a way that allows for modularity in the classification method to be used. In other words, each classifier paradigm's method is designed to be able to be swapped out by a different method so long as the API interface contracts are adhered to.

Input

Classify API Input Contract

The API input to an arbitrary classification method is expected to adhere to the following format (as described by ClassifyPayload in api/api_models.py):

1
2
3
4
5
6
7
{ "content|context": 
    {
      "data": "input data to be classified",
      "method": "method_name",
      "method_params": "classification kwargs"
    }
}

This contract allows for the backend functionality to be abstracted from the API interface.

Output

Classify Method Output Contract

A classification method's output is expected to adhere to the following format (as described by MethodLabel in ``cls/data_models.py):

1
2
3
4
5
6
{
  "label": "Union[str, List]",
  "score": "float",
  "position_start": "Union[int, None (default)]",
  "position_end": "Union[int, None (default)]"
}

Classify API Output Contract

A classification API output is expected to adhere to the following format:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "content|context": 
  [
    {
      "input1": "input string 1",
      "labels": {
        "data": "input data to be classified",
        "method": "method_name",
        "method_params": "classification kwargs"
      }
    },
    {
      "inputN": "input string N",
      "labels": {
        "data": "input data to be classified",
        "method": "method_name",
        "method_params": "classification kwargs"
      }
    }
  ]
}
Back to top