use of org.dkpro.tc.ml.report.util.ID2OutcomeCombiner in project dkpro-tc by dkpro.
the class DeepLearningInnerBatchReport method execute.
@Override
public void execute() throws Exception {
StorageService store = getContext().getStorageService();
Properties prop = new Properties();
List<File> id2outcomeFiles = new ArrayList<>();
Set<String> ids = getTaskIdsFromMetaData(getSubtasks());
for (String id : ids) {
if (!TcTaskTypeUtil.isMachineLearningAdapterTask(store, id)) {
continue;
}
Map<String, String> discriminatorsMap = store.retrieveBinary(id, Task.DISCRIMINATORS_KEY, new PropertiesAdapter()).getMap();
File id2outcomeFile = store.locateKey(id, Constants.ID_OUTCOME_KEY);
id2outcomeFiles.add(id2outcomeFile);
for (Entry<String, String> e : discriminatorsMap.entrySet()) {
String key = e.getKey();
String value = e.getValue();
prop.setProperty(key, value);
}
}
String learningMode = getDiscriminator(store, ids, DIM_LEARNING_MODE);
ID2OutcomeCombiner<String> aggregator = new ID2OutcomeCombiner<>(learningMode);
for (File id2o : id2outcomeFiles) {
aggregator.add(id2o, learningMode);
}
writeCombinedOutcomeReport(aggregator.generateId2OutcomeFile());
}
use of org.dkpro.tc.ml.report.util.ID2OutcomeCombiner in project dkpro-tc by dkpro.
the class Id2OutcomeAggregatorTest method testAggregatorSingleLabel.
@Test
public void testAggregatorSingleLabel() throws Exception {
ID2OutcomeCombiner<String> aggregator = new ID2OutcomeCombiner<>(Constants.LM_SINGLE_LABEL);
aggregator.add(new File("src/test/resources/id2outcome/combine/singleLabelID2outcome_1.txt"), Constants.LM_SINGLE_LABEL);
aggregator.add(new File("src/test/resources/id2outcome/combine/singleLabelID2outcome_2.txt"), Constants.LM_SINGLE_LABEL);
assertEquals(18, aggregator.generateId2OutcomeFile().split("\n").length);
}
use of org.dkpro.tc.ml.report.util.ID2OutcomeCombiner in project dkpro-tc by dkpro.
the class Id2OutcomeAggregatorTest method testAggregatorRegression.
@Test
public void testAggregatorRegression() throws Exception {
ID2OutcomeCombiner<String> aggregator = new ID2OutcomeCombiner<>(Constants.LM_REGRESSION);
aggregator.add(new File("src/test/resources/id2outcome/combine/regressionID2outcome_1.txt"), Constants.LM_REGRESSION);
aggregator.add(new File("src/test/resources/id2outcome/combine/regressionID2outcome_2.txt"), Constants.LM_REGRESSION);
assertEquals(8, aggregator.generateId2OutcomeFile().split("\n").length);
System.out.println(aggregator.generateId2OutcomeFile());
}
use of org.dkpro.tc.ml.report.util.ID2OutcomeCombiner in project dkpro-tc by dkpro.
the class Id2OutcomeAggregatorTest method testAggregatorMultilabel.
@Test
public void testAggregatorMultilabel() throws Exception {
ID2OutcomeCombiner<String> aggregator = new ID2OutcomeCombiner<>(Constants.LM_MULTI_LABEL);
aggregator.add(new File("src/test/resources/id2outcome/combine/multiLabelId2outcome_1.txt"), Constants.LM_MULTI_LABEL);
aggregator.add(new File("src/test/resources/id2outcome/combine/multiLabelId2outcome_2.txt"), Constants.LM_MULTI_LABEL);
assertEquals(8, aggregator.generateId2OutcomeFile().split("\n").length);
}
Aggregations