
Classifiers
nokori Programmable Classifiers are cloud-native, configurable classifiers, addressing a number of workflow headaches with many common approaches today.
Classifiers are useful tools for quickly "classifying" documents or text for many downstream tasks such as Customer Support Automation, Email Routing, Spam Detection, Content Recommendation, and more.
A downside for developers who are not experience data scientists is that building, deploying, and serving machine learning models for classification is a heavy lift, with signficant on-going maintenance and support.
Programmable Classifiers
nokori Programmable Classifiers are a cloud-native, programmable solution allowing developers to quickly, and easily create, train, and modify classifiers in the cloud without having to build, deploy, serve, or maintain complex models.
Creating a basic classifier is quick and easy. Adding additional classes as new needs arrive is even easier.
Create a classifier
My email router
import nokori from '@nokori/js-sdk'
const nk = new nokori()
const { data, error } = await nk.classifiers.create({
name: "Email Classifier"
})
A new classifier is created:
Create classifier response
{
"id": "nk.clfr.c9m2PctnajCkyU6vBtQ",
"name": "Email Classifier"
}
Train your classifier
The next step in the process is to train your classifier to know how to categorize your documents. Fortunately, nokori makes it amazingly simple to do so.
Training Examples
await nk.classifiers.train({
classifierId: "nk.clfr.c9m2PctnajCkyU6vBtQ",
label: "sales",
context: "I would like to purchase a new widget today."
})
await nk.classifiers.train({
classifierId: "nk.clfr.c9m2PctnajCkyU6vBtQ",
label: "support",
context: "Please help me - my widget isn't working!"
})
await nk.classifiers.train({
classifierId: "nk.clfr.c9m2PctnajCkyU6vBtQ",
label: "spam",
context: "HeRe Is OnE dEaL yOu WoNt WaNnA mIsS"
})
Here we've created three classes for our classifier to utilize in future prediction attempts: sales
, support
, spam
.
Note: in a prodution environment, you would provide multiple examples for each label. We'll show how this can be done at any time later in this guide.
Use your classifier
Now that we have trained our classifier with some examples, lets see it in action.
Predicting a class label
const { data, error } = await nk.classifiers.predict({
classifierId: "nk.clfr.c9m2PctnajCkyU6vBtQ",
context: 'I need helping buying a new widget please.'
})
The result:
Prediction result
{
"label": "sales",
"confidence": 0.88
}
Updating your Classifier
So what happens now that you have some new examples you would like to train your classifier with? Historically this would have required a new training run locally to update the full model, packaging it up, and then deploying a new version of your classification service.
We've simplified this process to just an API call:
Updating your classifier
await nk.classifiers.train({
classifierId: "nk.clfr.c9m2PctnajCkyU6vBtQ",
label: "sales",
context: "Can a sales associate please give me a call?"
})
Then to verify that we're indeed seeing our new example classified correctly:
Predicting after model update
const { data, error } = await nk.classifiers.predict({
classifierId: "nk.clfr.c9m2PctnajCkyU6vBtQ",
context: 'Can a sales associate please give me a call?'
})
The result:
Prediction result
{
"label": "sales",
"confidence": 0.94
}
Conclusion
This is only Version 1, but as you can see, we are working hard to make the process of creating and using text classifiers in the cloud easy and effortless like never before.