How to Create Classifier Service with Slamby TAU and .Net SDK

In this tutorial, we will show you how to prepare and run a classifier service.

Slamby TAU is an integrated data management solution that communicates directly with your Slamby Server. It makes you able to use your server resources in the cloud and manage your data easily in a real-time on your computer.

With Slamby, you can easily create Text Classification service with high capacity and accuracy using Slamby Twister classification algorithm in any language.

Classifier Service Video Tutorial

1. Creating a Classifier Service

Let’s start with adding a new classifier service.

Example TAU Create New Service Screen
Slamby TAU Classifier Service Creation

To create a Classifier Service, provide the significant name and the short description. Then, click on the ‘Okay’ button. Now, you can see that service is displayed in New status.

Create New Service Example using .Net SDK

var service = new Service()
{
Name = "Classifier",
Description = "This is a demo service description",
Type = ServiceTypeEnum.Classifier
};
var result = await serviceManager.CreateServiceAsync(service);
var createdService = result.ResponseObject;

2. Preparation of Classifier Service

To prepare your Classifier Service, provide your custom settings by using Json.

Example TAU Preparation Setting Screen
Slamby TAU Classifier Preparation

Write the source ‘Dataset Name’ that you are going to use to create Classifier Service. Provide the Tag IDs to use for classification or just keep it as null to use all the leaf Tag IDs. And, Set the n-gram list with an array to use during your classification.

{
"DataSetName": "demo-dataset",
"TagIdList": [ "4", "132", "211", "3" ],
"NGramList": [ 1, 2 , 3 ]
}

Then, Click on the OK button to start the process.

Tips: to select your custom Tag Ids and paste it into the JSON setting, select your required Tags in Data>Tags, and press ctrl+c, then ctrl+v in the json document. The selected Tag IDs array will be pasted as a JSON array.

Preparation of New Service Example using .Net SDK

var classifierServiceManager = new ClassifierServiceManager(_configuration);
var classifierPrepareSettings = new ClassifierPrepareSettings()
{
DataSetName = "demo-dataset",
NGramList = new List() { 1, 2, 3 }
};
var prepareResponse = await classifierServiceManager.PrepareServiceAsync(serviceId, classifierPrepareSettings);
var process = prepareResponse.ResponseObject;

3. Activation of Classifier Service

After preparation process is finished, you can set the activation settings in a JSON format.

Example TAU Activation Setting Screen
Slamby TAU Classifier Activation

Define Tag IDs from the prepared list to use for classification or keep it as null to use all the prepared Tag IDs. And , which n-gram model you like to use during the classification.

{
"EmphasizedTagIdList": null,
"TagIdList": null,
"NGramList": [1,2,3]
}

Then, click on the OK button to activate the service.

Activation of Classifier Service Example using .Net SDK

var classifierServiceManager = new ClassifierServiceManager(_configuration);
var classifierActivateSettings = new Models.Services.ClassifierActivateSettings()
{
NGramList = new List() { 1, 2, 3 }
};
var activateResponse = await classifierServiceManager.ActivateServiceAsync(serviceId, classifierActivateSettings);

4. Testing of Classifier Service

And finally, everything is ready to test the classifier. To test it, click on the Recommend button. You just need to fill the JSON setting input form with the available settings and send your request to the Service API endpoint.

Example TAU Recommend Screen
Slamby TAU CLassifier Recommendation

This text will be analyzed and used for classification. Set the count to adjust the response tag number to display. If you don’t need tag in result, keep it as false. But when you value it as true, you will receive the results with details. Such as; Tag Id, Tag Name, Tag Parent ID and related properties.

{
"Text": "Brand New Laptop for Sales !!!",
"Count": 3,
"UseEmphasizing": false,
"NeedTagInResult": true
}

Then, click on the OK button to receive the result.

Testing of Classifier Service Example using .Net SDK

var classifierServiceManager = new ClassifierServiceManager(_configuration);
var classifierRecommendationRequest = new Models.Services.ClassifierRecommendationRequest()
{
Text = "Brand New Laptop for Sales !!!",
NeedTagInResult = true,
Count = 3
};
var recommendResponse = (await classifierServiceManager.RecommendServiceAsync(serviceId, classifierRecommendationRequest));

Example TAU Classifier Recommendation Result
Slamby TAU Classifier Recommendation Result

 

Download our SDKs from Github.com/Slamby

Leave a Reply

Your email address will not be published. Required fields are marked *