Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
RequestParam: threshold
RequestBody: EvaluateDocumentRequest
6 api/tags/ POST {"body": ""}
RequestParam: pagesize
RequestParam: page
RequestParam: sort (id/created/name/last_label_change)
RequestParam: contains
7 api/tags/ GET RequestParam: order (asc, desc)
RequestBody: CreateLabelRequest
{"body": "",
"value": 0.0,
"title": "",
"meta": "",
"externalId": ""}
8 api/tags/{id}/labels POST PathVariable: id
RequestBody: AddLabelRequest
{"value": 0.0,
"externalId": ""}
9 api/tags/{id}/labeldocument POST PathVariable: id
RequestBody: AddLabelsRequest
{ "labels": {
"entry": [
{
"key": "",
"value": 0.0
}
]
}
}
10 api/tags/{id}/labeldocuments POST PathVariable: id
11 api/tags/{id}/labels GET PathVariable: id
Output Description
HttpStatus.CREATED (201, "Created") API to create a new Tag Object into
database
call method trainTag(String tagName, String type, Integer limit, Boolean balanced)
Step1: Get a list of Label from tagName param.
-> Select * from Label where Tag.name = "tagName";
Step2: Check that if(limit != null || balanced) == true
-> truncate data from list of Label from #Step1. (spilt data set into negative and positive
with the same size limited by the limit param to perform the training process.)
Step3: Create instance of Tag by tagName param got from database.
-> Select * from Tag whe name = "tagName";
Step4: Create new TagBinaryClassifier instance and call method
createBinaryClassifierForTagName(tagName, trainingData, ClassifierType.DL4J_MLP)
-> Create new ClassifierType instance as param passed and set BatchSize, Epochs (control
how the algorithm work through and evaluate the entire training dataset)
-> Call method setTrainingData(trainingData) by classifier instance.(setup step for our
training dataset before train)
-> call method train by classifier as long as training dataset size.
Step5: Set classifier into Tag object and save it into database
Step 4:
If NULL is returned, then return HttpStatus.NOT_FOUND
If TrainInfo in step#3 is returned, then return HttpStatus.OK with body
Step 1: validate request body
If it is missing, then return ApiRequiredFieldIsMissingException
Step 2: Call method evaluateTag(id, requestBody) in TagService
Step 2.1: Get TagBinaryClassifier from tagName (id in URL)
Step 2.2: get Tag object in existing map(binaryClassifierMap) or DB by tagName
select t.* from tags t where t.name=?tagName
Step 2.3: If classifier in step#2.1 is NULL, then get classifier from Tag in step 2.2
deserialize Classifier from tag.getModel()
set tokenizerFactory for classifier
store
Note