Classifiers
A common need when dealing with documents and text of various types is to quickly and accurately label them to assist in scenarios like Customer Support Automation, Spam Detection, Sentiment Analysis, and Content Recommendation.
You can use this endpoint to easily incrementally train a classifier as new labeled documents becomes available and instantly use the updated classifier for classification tasks.
Create A Classifier
This endpoint allows you to create a classifier.
Request Body Parameters
- Name
name
- Type
- string
- required
- Description
The name of the classifier. A name will be generated automatically if none is supplied.
Request
curl https://api.nokori.com/v1/classifiers \
-X POST
-H 'x-nokori-api-key: {{apiKey}}'
-D '{
"name": "My cloud trainable classifier",
}'
Response
{
"id": "nk.clfr.DPyOe0qWGc-Jc1zXaZe"
}
Gets all Classifiers
This endpoint allows you to get all configured classifiers
Request
curl https://api.nokori.com/v1/classifiers\
-X GET
-H 'x-nokori-api-key: {{apiKey}}'
Response
[
{
"classifierId": "nk.clfr.DPyOe0qWGc-Jc1zXaZe",
"name": "My cloud trainable classifier",
"createdAt": "2023-05-22T12:00:48.000Z",
"updatedAt": null
}
]
Gets a Classifier
This endpoint allows you to get a classifier.
Query Parameters
- Name
classifierId
- Type
- string
- required
- Description
The ID of the classifier you want to get
Request
curl https://api.nokori.com/v1/classifiers/:classifierId \
-X GET
-H 'x-nokori-api-key: {{apiKey}}'
Response
{{
"classifierId": "nk.clfr.DPyOe0qWGc-Jc1zXaZe",
"name": "My cloud trainable classifier",
"createdAt": "2023-05-20T18:33:16.000Z",
"classes": [
{
"classId": "nk.clfc.rlOSbYCVHnx5ZDRlhjL",
"label": "positive",
"observations": 7
},
{
"classId": "nk.clfc.KFfQdzpmQ1oMkR0Z4ua",
"label": "negative",
"observations": 4
}
]
}}
Train a classifier
This endpoint allows you to train a classifier. New training observations can be supplied incrementally at any time.
Request Body Parameters
- Name
label
- Type
- string
- required
- Description
The label (class) that the example belongs to.
- Name
context
- Type
- string
- required
- Description
The example text to train the classifier with.
Request
curl https://api.nokori.com/v1/classifiers/:classifierId/train \
-X POST
-H 'x-nokori-api-key: {{apiKey}}'
-D '{
"label": "positive",
"context" : "I really love this pizza."
}'
Response
{
"classId": "nk.clfc.rlOSbYCVHnx5ZDRlhjL",
"observations": 1
}
Predict
This endpoint allows you to generate a prediction.
Request Body Parameters
- Name
context
- Type
- string
- required
- Description
A document text to be classified
Request
curl https://api.nokori.com/v1/classifiers/:classifierId/predict \
-X POST
-H 'x-nokori-api-key: {{apiKey}}'
-D '{
"context" : "I really love this pizza."
}'
Response
{
"classId": "nk.clfc.rlOSbYCVHnx5ZDRlhjL",
"label": "positive",
"confidence": 1.0 // 100% Confidence
}
Delete a Class
This endpoint allows you to delete a class. It prevents it from being predicted in future predictions.
Request Body Parameters
- Name
context
- Type
- string
- required
- Description
A document text to be classified
Request
curl https://api.nokori.com/v1/classifiers/:classifierId/classes/:classId \
-X DELETE
-H 'x-nokori-api-key: {{apiKey}}'
Delete a Classifier
This endpoint allows you to delete a classifier.
Request
curl https://api.nokori.com/v1/classifiers/:classifierId \
-X DELETE
-H 'x-nokori-api-key: {{apiKey}}'