trainable: true. The module assistant allows the user to define a training store, can capture training options. If we want to allow our module to be trained, we also need to provide a train function.
📘 Training Options It is important to note that in the inference we pass the training options as a parameters, however in the training we pass the training options as a dictionary.The
train function is called by the module runtime when the module is trained. The training_store is the store is the document store that the user has selected to use for training. The training_options are the options that the user has selected for training. The module_data is a directory that the module can use to store “trained module”. A module can store anything in the module_data directory. This contains the module_data directory will be stored in the module store as a Module Training.
We place the responsibility of iterating over the documents in the training store and training module on the module. This provides flexibility in how the module wants to process all the training documents. Once completed, the module can save any “trained materials” in module_data.
Supporting Module Testing in the UI
One of the powerful features in Kodexa is support for the Robotic Assistant, allowing a user to label a document, and then test the module against that document. This allows the user to see how the module is performing against a document that they have labeled. To support this, we need to include an extra parameter in thetrain function. This parameter is additional_training_document. This will be an instance of a KodexaDocument.
📘 Additional Training Document The additional training document should always be a KodexaDocument. However, it is important to note that you need to confirm (using the path of the Kodexa Document) that you don’t pick up the same document from the training store.We can see below an example of how you might write the logic to allow you to train:
Using files you deployed with the Module
When you deploy a module, you can include files that will be deployed with the module. These files can be used by the module at runtime. To access these files, you can add the parametermodule_base, this will be the folder where the module code has been deployed.
