Search in sources :

Example 1 with Dimension

use of org.dkpro.lab.task.Dimension in project dkpro-lab by dkpro.

the class BatchTaskTest method testNested.

@Test
public void testNested() throws Exception {
    Dimension innerDim = Dimension.create("inner", "1", "2", "3");
    ParameterSpace innerPSpace = new ParameterSpace(innerDim);
    DefaultBatchTask innerTask = new DefaultBatchTask() {

        @Override
        public void setConfiguration(Map<String, Object> aConfig) {
            super.setConfiguration(aConfig);
            System.out.printf("A %10d %s %s%n", this.hashCode(), getType(), aConfig);
        }
    };
    innerTask.setParameterSpace(innerPSpace);
    innerTask.addTask(new ConfigDumperTask1());
    Dimension outerDim = Dimension.create("outer", "1", "2", "3");
    ParameterSpace outerPSpace = new ParameterSpace(outerDim);
    DefaultBatchTask outerTask = new DefaultBatchTask() {

        @Override
        public void setConfiguration(Map<String, Object> aConfig) {
            super.setConfiguration(aConfig);
            System.out.printf("B %10d %s %s%n", this.hashCode(), getType(), aConfig);
        }
    };
    outerTask.setParameterSpace(outerPSpace);
    outerTask.addTask(innerTask);
    outerTask.addTask(new ConfigDumperTask2());
    Lab.getInstance().run(outerTask);
}
Also used : ParameterSpace(org.dkpro.lab.task.ParameterSpace) Dimension(org.dkpro.lab.task.Dimension) Map(java.util.Map) DefaultBatchTask(org.dkpro.lab.task.impl.DefaultBatchTask) Test(org.junit.Test)

Example 2 with Dimension

use of org.dkpro.lab.task.Dimension in project dkpro-tc by dkpro.

the class ExperimentBuilder method build.

/**
 * Wires all provided information into a parameter space object that can be provided to an
 * experiment
 *
 * @return the parameter space filled with the provided information
 */
public ParameterSpace build() {
    List<Dimension<?>> dimensions = new ArrayList<>();
    dimensions.add(getAsDimensionMachineLearningAdapter());
    dimensions.add(getAsDimensionFeatureMode());
    dimensions.add(getAsDimensionLearningMode());
    dimensions.add(getAsDimensionFeatureSets());
    dimensions.add(getAsDimensionReaders());
    ParameterSpace ps = new ParameterSpace();
    ps.setDimensions(dimensions.toArray(new Dimension<?>[0]));
    return ps;
}
Also used : ParameterSpace(org.dkpro.lab.task.ParameterSpace) ArrayList(java.util.ArrayList) Dimension(org.dkpro.lab.task.Dimension)

Example 3 with Dimension

use of org.dkpro.lab.task.Dimension in project dkpro-tc by dkpro.

the class Experiment_ImplBase method addConversionServiceEntries.

private void addConversionServiceEntries(TaskContext aContext) {
    ParameterSpace pSpace = getParameterSpace();
    Dimension<?>[] dimensions = pSpace.getDimensions();
    for (Dimension<?> d : dimensions) {
        if (d.getName().equals(Constants.DIM_READERS)) {
            addConversionForCollectionReader(aContext, d);
        }
    }
}
Also used : ParameterSpace(org.dkpro.lab.task.ParameterSpace) Dimension(org.dkpro.lab.task.Dimension)

Aggregations

Dimension (org.dkpro.lab.task.Dimension)3 ParameterSpace (org.dkpro.lab.task.ParameterSpace)3 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 DefaultBatchTask (org.dkpro.lab.task.impl.DefaultBatchTask)1 Test (org.junit.Test)1