Examples of TupleListIterator


Examples of uk.org.ogsadai.activity.io.TupleListIterator

    protected void processIteration(Object[] iterationData)
            throws ActivityProcessingException, ActivityTerminatedException,
            ActivityUserException
    {
        String condition = (String)iterationData[0];
        TupleListIterator tuples = (TupleListIterator)iterationData[1];
       
        try
        {
            mOutput.write(ControlBlock.LIST_BEGIN);
            MetadataWrapper wrapper = tuples.getMetadataWrapper();
            Filter filter =
                new Filter(condition, (TupleMetadata)wrapper.getMetadata());
            mOutput.write(wrapper);
            Tuple tuple;
            while ((tuple = (Tuple)tuples.nextValue()) != null)
            {
                if (filter.isValid(tuple))
                {
                    mOutput.write(tuple);
                }
View Full Code Here

Examples of uk.org.ogsadai.activity.io.TupleListIterator

    protected void processIteration(Object[] iterationData)
        throws ActivityProcessingException,
               ActivityTerminatedException,
               ActivityUserException
    {
        TupleListIterator tuples = (TupleListIterator)iterationData[0];
        PMMLDocument pmmlInput = (PMMLDocument) iterationData[1];
       
        ModelStatsInterval modelStats =
            new ModelStatsInterval(tuples, pmmlInput);
        modelStats.countStatistics();
View Full Code Here

Examples of uk.org.ogsadai.activity.io.TupleListIterator

@Override
protected void processIteration(Object[] iterationData)
  throws ActivityProcessingException,
       ActivityTerminatedException,
       ActivityUserException {
  TupleListIterator tuples = (TupleListIterator)iterationData[0];
    Tuple tuple;
    try
    {
        mOutput.write(ControlBlock.LIST_BEGIN);
        List columns = new ArrayList();
View Full Code Here

Examples of uk.org.ogsadai.activity.io.TupleListIterator

    protected void processIteration(Object[] iterationData)
            throws ActivityProcessingException, ActivityTerminatedException,
            ActivityUserException
    {
        String condition = (String)iterationData[0];
        TupleListIterator tuples = (TupleListIterator)iterationData[1];
       
        try
        {
            mOutputTrue.write(ControlBlock.LIST_BEGIN);
            mOutputFalse.write(ControlBlock.LIST_BEGIN);
            MetadataWrapper wrapper = tuples.getMetadataWrapper();
            Filter filter =
                new Filter(condition, (TupleMetadata)wrapper.getMetadata());
            mOutputTrue.write(wrapper);
            mOutputFalse.write(wrapper);
            Tuple tuple;
            while ((tuple = (Tuple)tuples.nextValue()) != null)
            {
                if (filter.isValid(tuple))
                {
                    mOutputTrue.write(tuple);
                }
View Full Code Here

Examples of uk.org.ogsadai.activity.io.TupleListIterator

    /** Interface implementation */
    protected void processIteration(Object[] iterationData)
            throws ActivityProcessingException, ActivityTerminatedException,
            ActivityUserException
    {
        TupleListIterator tupleList = (TupleListIterator) iterationData[0];
        ListIterator columnList = (ListIterator) iterationData[1];
        ListIterator methodsList = (ListIterator) iterationData[2];
        ListIterator causeList = (ListIterator) iterationData[3];
        ListIterator parameterList = (ListIterator) iterationData[4];
        PMMLDocument pmml = (PMMLDocument) iterationData[5];

        Integer column;
        while ((column = (Integer) columnList.nextValue()) != null)
        {
            String method = (String) methodsList.nextValue();
            String cause = (String) causeList.nextValue();
            Object[] parameters = (Object[]) parameterList.nextValue();

            if (method == null || cause == null || parameters == null)
            {
                throw new ActivityUserException(
                        new UnmatchedInputException(
                                new String[] {
                                        INPUT_COLUMNS,
                                        INPUT_METHODS,
                                        INPUT_CAUSE,
                                        INPUT_PARAMETERS },
                                new Object[] {
                                        column, method, cause, parameters }));
            }

            DPPMethodForColumn methodForColumn = loadMethod(
                    column.intValue(),
                    method,
                    cause,
                    parameters,
                    pmml.getPMML());
            mColumnMethods.put(column, methodForColumn);
        }

        if (methodsList.nextValue() != null
                || causeList.nextValue() != null
                || parameterList.nextValue() != null)
        {
            throw new ActivityUserException(
                    new UnmatchedInputException(
                            new String[] {
                                    INPUT_COLUMNS,
                                    INPUT_METHODS,
                                    INPUT_CAUSE,
                                    INPUT_PARAMETERS }));
        }

        TupleMetadata metadata =
            (TupleMetadata) tupleList.getMetadataWrapper().getMetadata();

        // load all intervals
        mInterval = DPPHelper.loadIntervals(metadata, pmml.getPMML());

        // write metadata to output
        writeBlock(tupleList.getMetadataWrapper());
        // now apply DPP methods to input tuples and write the results
        Tuple tuple;
        while ((tuple = (Tuple) tupleList.nextValue()) != null)
        {
            Tuple result = applyMethods(tuple);
            writeBlock(result);
        }
    }
View Full Code Here

Examples of uk.org.ogsadai.activity.io.TupleListIterator

    @Override
    protected void processIteration(Object[] iterationData)
            throws ActivityProcessingException, ActivityTerminatedException,
            ActivityUserException
    {
        TupleListIterator tuples1 = (TupleListIterator)iterationData[0];
        TupleListIterator tuples2 = (TupleListIterator)iterationData[1];
        try
        {
            List columns = new ArrayList();
            ColumnMetadata col = new SimpleColumnMetadata("row", TupleTypes._STRING, 0, 0, 0);
            columns.add(col);
View Full Code Here

Examples of uk.org.ogsadai.activity.io.TupleListIterator

            iterativeStageComplete();
            return;
        }
        LOG.debug("Started BuildIterationalClassifier");
        Map<Integer, List<Object>> nominalValues = getNominalValues();
        TupleListIterator tuples = new FullListTupleListIterator(INPUT_DATA, mDataInput);
        TupleMetadata metadata = (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
      columns = "Trained on: [";
      for(int i=0; i<metadata.getColumnCount();i++)
        columns += metadata.getColumnMetadata(i).getName() + " ";
     
      columns += "]\n";
        Instances dataset = WekaUtilities.createEmptyDataset(metadata, classIndex, nominalValues);
        if(mDescriptionInput != null)
          description = TupleUtilities.getString(readBlock(mDescriptionInput), INPUT_DESCRIPTION);
        else
          description = "";
         
       
        HoeffdingTree tree = new HoeffdingTree();
        String options;
        try
        {
        if(mOptionsInput != null)
          options = TupleUtilities.getMoaOptions(readBlock(mOptionsInput));
        else
          options = DEFAULT_OPTIONS;
         
        }
        catch (Exception e)
        {
            throw new ActivityUserException(e);
        }
        try
        {
          Tuple tuple;
       
          tree.getOptions().setViaCLIString(options);
          tree.prepareForUse();
          Calendar cal = Calendar.getInstance();
          this.startTime = cal.getTimeInMillis();

          while((tuple = (Tuple)tuples.nextValue()) != null && tuple != ControlBlock.LIST_END) {
            Instance inst = WekaUtilities.createInstance(dataset, tuple);
            tree.trainOnInstance(inst);
            if(stepCounter == 0) {

                  writeOutput(new TupleClassifier(tree, WekaUtilities.getAttributes(dataset), classIndex));                                        
View Full Code Here

Examples of uk.org.ogsadai.activity.io.TupleListIterator

    protected void processIteration(Object[] iterationData)
            throws ActivityProcessingException, ActivityTerminatedException,
            ActivityUserException
    {
        String template = (String)iterationData[0];
        TupleListIterator tuples = (TupleListIterator)iterationData[1];
        TupleMetadata metadata = (TupleMetadata) tuples.getMetadataWrapper().getMetadata();
        StringReplacer replacer = new StringReplacer(template, metadata);
        Tuple tuple;
        while ((tuple = (Tuple)tuples.nextValue()) != null)
        {
            String output = replacer.createString(tuple);
            try
            {
                mOutput.write(output);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.