protected void trainAndStoreModel(TaskContext aContext) throws Exception { boolean multiLabel = learningMode.equals(Constants.LM_MULTI_LABEL); if (multiLabel) { throw new TextClassificationException("Multi-label is not yet implemented"); } File fileTrain = getTrainFile(aContext); trainModel(aContext, fileTrain); copyOutcomeMappingToThisFolder(aContext); copyFeatureNameMappingToThisFolder(aContext); }
@Override public void execute(TaskContext aContext) throws Exception { trainAndStoreModel(aContext); writeModelConfiguration(aContext); }
private void copyOutcomeMappingToThisFolder(TaskContext aContext) throws IOException { if (isRegression()) { return; } File trainDataFolder = aContext.getFolder(TEST_TASK_INPUT_KEY_TRAINING_DATA, AccessMode.READONLY); String mapping = AdapterFormat.getOutcomeMappingFilename(); FileUtils.copyFile(new File(trainDataFolder, mapping), new File(outputFolder, mapping)); }
protected void copyOutcomeMappingToThisFolder(TaskContext aContext) throws IOException { if (isRegression()) { return; } File trainDataFolder = aContext.getFolder(TEST_TASK_INPUT_KEY_TRAINING_DATA, AccessMode.READONLY); String mapping = AdapterFormat.getOutcomeMappingFilename(); FileUtils.copyFile(new File(trainDataFolder, mapping), new File(outputFolder, mapping)); }
private void trainAndStoreModel(TaskContext aContext) throws Exception { boolean multiLabel = learningMode.equals(Constants.LM_MULTI_LABEL); if (multiLabel) { throw new TextClassificationException("Multi-label is not yet implemented"); } File fileTrain = getTrainFile(aContext); trainModel(aContext, fileTrain); copyOutcomeMappingToThisFolder(aContext); copyFeatureNameMappingToThisFolder(aContext); }
@Override public void execute(TaskContext aContext) throws Exception { trainAndStoreModel(aContext); writeModelConfiguration(aContext); }