Execute model
To check model quality, prepare a test set of documents and run the execution process. ModelEvaluationRunner.java contains similar logic as the training runner. Once the execution process is finished, model results are available in the output directory. Statistics are located in /outputDir/statistics.csv and contain information about what actually was extracted by the model against what was expected. For more information about runners, see the Test model execution locally page.
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import com.workfusion.vds.sdk.run.ModelRunner;
import com.workfusion.vds.sdk.run.config.LocalExecutionConfiguration;
public class ModelExecutionRunner {
public static void main(String[] args) throws Exception {
System.setProperty("WORKFLOW_LOG_FOLDER", "./logs/");
//TODO put correct values for the paths
Path trainedModelPath = Paths.get("model/train/training/output/model");
Path inputDirPath = Paths.get("model/docs");
Path outputDirPath = Paths.get("model/extract");
//TODO add parameters if needed
Map<String, Object> parameters = new HashMap<>();
LocalExecutionConfiguration configuration = LocalExecutionConfiguration.builder()
.inputDir(inputDirPath)
.outputDir(outputDirPath)
.trainedModelDir(trainedModelPath)
.parameters(parameters)
.build();
ModelRunner.run(IeModelModel.class, configuration);
}
}