Package uk.org.ogsadai.activity

Examples of uk.org.ogsadai.activity.MockInputPipe


      {
      
          BuildIterationalClassifierActivity activity = new BuildIterationalClassifierActivity();

          List<Object> input = buildInputTable();
          MockInputPipe dataInput = new MockInputPipe(input.toArray());
          activity.addInput(BuildIterationalClassifierActivity.INPUT_DATA, dataInput);
         
          MockInputPipe classIndexInput = new MockInputPipe(new Object[] {4});
          activity.addInput(BuildIterationalClassifierActivity.INPUT_CLASS_INDEX, classIndexInput);

          MockInputPipe nominalColumnsInput = new MockInputPipe(new Object[] {
                  ControlBlock.LIST_BEGIN,
                  0, 1, 4,
                  ControlBlock.LIST_END
          });
          activity.addInput(BuildIterationalClassifierActivity.INPUT_COLUMN_INDICES, nominalColumnsInput);

          MockInputPipe nominalValuesInput = new MockInputPipe(new Object[] {
                  ControlBlock.LIST_BEGIN,
                  ControlBlock.LIST_BEGIN, "sunny", "overcast", "rain", ControlBlock.LIST_END,
                  ControlBlock.LIST_BEGIN, "true", "false", ControlBlock.LIST_END,
                  ControlBlock.LIST_BEGIN, "yes", "no", ControlBlock.LIST_END,
                  ControlBlock.LIST_END
          });
          activity.addInput(BuildIterationalClassifierActivity.INPUT_NOMINAL_VALUES, nominalValuesInput);

          MockOutputPipe output = new MockOutputPipe(new Object[] {});
          activity.addOutput(BuildIterationalClassifierActivity.CLASSIFIER_OUTPUT, output);
         
          activity.process();
         
          TupleClassifier classifier = (TupleClassifier)output.getActualBlocks().get(0);
          System.out.println(classifier);
         
          ClassifyActivity classify = new ClassifyActivity();
          MockInputPipe inputClassifier = new MockInputPipe(classifier);
          classify.addInput(ClassifyActivity.INPUT_CLASSIFIER, inputClassifier);
          MockInputPipe inputData = new MockInputPipe(buildInputTable().toArray());
          classify.addInput(ClassifyActivity.INPUT_DATA, inputData);
          MockOutputPipe outputClassify = new MockOutputPipe(new Object[] {});
          classify.addOutput(ClassifyActivity.OUTPUT, outputClassify);
         
          classify.process();
View Full Code Here


   
    public void testSimple() throws Exception
    {
        ColumnMetadata col = new SimpleColumnMetadata("class", TupleTypes._STRING, 0,0,0);
        TupleMetadata metadata = new SimpleTupleMetadata(Collections.singletonList(col));
        MockInputPipe inputExpected = new MockInputPipe(new Object[] {
            ControlBlock.LIST_BEGIN,
            new MetadataWrapper(metadata),
            new SimpleTuple(Arrays.asList("yes")),
            new SimpleTuple(Arrays.asList("no")),
            new SimpleTuple(Arrays.asList("yes")),
            new SimpleTuple(Arrays.asList("maybe")),
            new SimpleTuple(Arrays.asList("yes")),
            new SimpleTuple(Arrays.asList("no")),
            new SimpleTuple(Arrays.asList("no")),
            new SimpleTuple(Arrays.asList("no")),
            ControlBlock.LIST_END
        });
        MockInputPipe inputPredicted = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList("yes")),
                new SimpleTuple(Arrays.asList("yes")),
                new SimpleTuple(Arrays.asList("yes")),
View Full Code Here

    public void testUnmatched() throws Exception
    {
        ColumnMetadata col = new SimpleColumnMetadata("class", TupleTypes._STRING, 0,0,0);
        TupleMetadata metadata = new SimpleTupleMetadata(Collections.singletonList(col));
        MockInputPipe inputExpected = new MockInputPipe(new Object[] {
            ControlBlock.LIST_BEGIN,
            new MetadataWrapper(metadata),
            new SimpleTuple(Arrays.asList("yes")),
            new SimpleTuple(Arrays.asList("no")),
            ControlBlock.LIST_END
        });
        MockInputPipe inputPredicted = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList("yes")),
                ControlBlock.LIST_END
            });
View Full Code Here

        v1.add("90");
        Vector v2 = new Vector();
        v2.add("10 20");
        v2.add("40 60 70");
        PowerSetActivity activity = new PowerSetActivity();
        MockInputPipe input = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                new SimpleTuple(Arrays.asList(new Object[] {1, v1})),               
                new SimpleTuple(Arrays.asList(new Object[] {2, v2})),
                ControlBlock.LIST_END
View Full Code Here

        TupleMetadata metadata = new SimpleTupleMetadata(cdlist);
        TestBlockReader dataInput = new TestBlockReader(10000);
        dataInput.setTupleFactory(new GroupTupleFactory());
        dataInput.setTupleMetadata(metadata);
        activity.addInput(GroupByActivity.INPUT_DATA, dataInput);
        MockInputPipe columnsInput = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                new Integer(0),
                ControlBlock.LIST_END
        });
        activity.addInput(GroupByActivity.INPUT_GROUPBY_COLUMNS, columnsInput);
        MockInputPipe aggregatesInput = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                "SUM(A)",
                "COUNT(A)",
                "AVG(A)",
                "MAX(B)",
View Full Code Here

        String data2 = "Hello, this is a test.";

        String name = "string";
        int type = TupleTypes._STRING;
       
        MockInputPipe nameInput = new MockInputPipe(name);
        MockInputPipe typeInput = new MockInputPipe(type);
        MockInputPipe dataInput = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                data1,
                data2,
                ControlBlock.LIST_END
        });
View Full Code Here

        int data1 = 42;

        String name = "int";
        int type = TupleTypes._INT;
       
        MockInputPipe nameInput = new MockInputPipe(name);
        MockInputPipe typeInput = new MockInputPipe(type);
        MockInputPipe dataInput = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                data1,
                ControlBlock.LIST_END
        });
       
View Full Code Here

            "this is a test.Hello, this is a test.Hello, this is a test.Hello, this is a test.";

        String name = "object";
        int type = TupleTypes._OBJECT;
       
        MockInputPipe nameInput = new MockInputPipe(name);
        MockInputPipe typeInput = new MockInputPipe(type);
        MockInputPipe dataInput = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                data1,
                ControlBlock.LIST_END
        });
       
View Full Code Here

        classifier.addClassType(0);
        classifier.addFeatures(new double[]{1.1, 2.2, 3.3, 4.4});
        classifier.addClassType(1);
        classifier.addFeatures(new double[]{5.5, 6.6, 7.7, 8.8});
      
        MockInputPipe nameInput = new MockInputPipe(resultColumnName);
        MockInputPipe classifierInput = new MockInputPipe(classifier);
        MockInputPipe dataInput = new MockInputPipe(new Object[] {
                ControlBlock.LIST_BEGIN,
                tupleMetadata,
                tuple,
                ControlBlock.LIST_END
        });
View Full Code Here

        cdlist.add(new SimpleColumnMetadata("X", TupleTypes._INT, 0, 0, 11));
        cdlist.add(new SimpleColumnMetadata("Y", TupleTypes._INT, 0, 0, 11));
        SimpleTupleMetadata metadata = new SimpleTupleMetadata(cdlist);
       
        CalculateMeanActivity activity = new CalculateMeanActivity();
        MockInputPipe input = new MockInputPipe( new Object[] {
                ControlBlock.LIST_BEGIN,
                new MetadataWrapper(metadata),
                createTuple(new Object[] {2, 3}),
                createTuple(new Object[] {4, 7}),
                createTuple(new Object[] {2, 3}),
View Full Code Here

TOP

Related Classes of uk.org.ogsadai.activity.MockInputPipe

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.