Examples of TupleListIterator


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

    @Override
    protected void processIteration(Object[] iterationData)
            throws ActivityProcessingException, ActivityTerminatedException,
            ActivityUserException
    {
        TupleListIterator tuples = (TupleListIterator)iterationData[2];
        TupleListIterator values = (TupleListIterator)iterationData[0];

        Set<Integer> columns = getColumns((ListIterator)iterationData[1]);
        TupleMetadata valuesMetadata = (TupleMetadata)values.getMetadataWrapper().getMetadata();
        TupleMetadata tuplesMetadata = (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        Tuple value = getValues(values);
       
        Replace replace = new Replace(value, columns, valuesMetadata, tuplesMetadata);
       
View Full Code Here

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

  protected void processIteration(Object[] iterationInputs)
      throws ActivityProcessingException, ActivityTerminatedException,
      ActivityUserException {
      try {
       
        TupleListIterator dataTuples = (TupleListIterator)iterationInputs[0];
        Tuple tuple;
        List<String> binNames = getBinNames((ListIterator)iterationInputs[1]);
        List<Double> aggregates = getAggregates((TupleListIterator)iterationInputs[2]);
        mOutput.write(ControlBlock.LIST_BEGIN);
        mOutput.write(prepareMetadata(dataTuples));
        while((tuple = (Tuple)dataTuples.nextValue()) != null) {
          ArrayList<String> list = new ArrayList<String>();
          list.add(getBinName(tuple, binNames, aggregates));
          mOutput.write(new SimpleTuple(list));
        }
        mOutput.write(ControlBlock.LIST_END);
View Full Code Here

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

            throws ActivityProcessingException, ActivityTerminatedException,
            ActivityUserException
    {

        List<ClassifierPriorityPair> classifiers = getClassifiers(iterationInputs);
        TupleListIterator tuples = (TupleListIterator)iterationInputs[0];
        TupleMetadata metadata =
            (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        try
        {
          boolean isNumeric = classifiers.get(0).classifier.classIsNumeric();
            mOutput.write(ControlBlock.LIST_BEGIN);
            ColumnMetadata column;
            if (isNumeric)
            {
                column = new SimpleColumnMetadata("class", TupleTypes._DOUBLE, 0, 0, 0);               
            }
            else
            {
                column = new SimpleColumnMetadata("class", TupleTypes._STRING, 0, 0, 0);
            }
           
            TupleMetadata outMetadata = new SimpleTupleMetadata(Collections.singletonList(column));
            mOutput.write(new MetadataWrapper(outMetadata));
            Tuple tuple;
            while ((tuple = (Tuple)tuples.nextValue()) != null)
            {
               
               
                Object result = classify(classifiers, tuple);
               
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];
        TupleMetadata metadata =
            (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        Tuple tuple;
        Mean[] calc = getMeanCalculator(metadata);
        while ((tuple = (Tuple)tuples.nextValue()) != null)
        {
            for (int i = 0; i < calc.length; i++)
            {
                calc[i].process(tuple);
            }
View Full Code Here

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

     * {@inheritDoc}
     */
  protected void processIteration() throws ActivityProcessingException,
      ActivityTerminatedException, ActivityUserException {
    FullListTupleListIterator items = new FullListTupleListIterator(INPUT_ITEMS, mItems);
    TupleListIterator customers = new FullListTupleListIterator(INPUT_TRANSACTIONS, mTransactions);
    Integer keyIndex= getKeyIndex();
   
    TupleMetadata metadata = prepareMetadata(items);
   
   
View Full Code Here

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

        {
            command.append(iterationData[i]);
            command.append(" ");
        }
        String base = command.toString();
        TupleListIterator tuples = (TupleListIterator)iterationData[iterationData.length-1];
        try
        {  
            Tuple tuple;
            boolean haveWrittenMetadata = false;
            mOutput.write(ControlBlock.LIST_BEGIN);
            while ((tuple = (Tuple)tuples.nextValue()) != null)
            {
                command = new StringBuffer();
                command.append(base);
                for (int i=0; i<tuple.getColumnCount(); i++)
                {
View Full Code Here

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

    //while ((file=(String)files.nextValue())!=null){
    //  System.out.println("file: "+fileName);
    //}
    //String fileName = file;
     
    TupleListIterator tupleListIterator = (TupleListIterator) iterationData[1];
      MetadataWrapper metadataWrapper = tupleListIterator.getMetadataWrapper();
      TupleMetadata tupleMetadata = (TupleMetadata) metadataWrapper.getMetadata();
      Tuple tuple;
    try {
     
     mOutputBlockWriter = getOutput(OUTPUT_DATA);
       BlockWriter meanOut = getOutput(MEAN);
       mMetadataOutputBlockWriter = getOutput(METADATA);
       List<ResponsePAZ> responses=new ArrayList<ResponsePAZ>()
       int i=0;
       parametersMap = new HashMap<String,String>();
       while((tuple= (Tuple)tupleListIterator.nextValue())!= null){
         System.out.println("in iteration tuple");
        ResponsePAZ response= new ResponsePAZ();
        response.setName(tuple.getString(tupleMetadata,NAME));
        response.setGain(tuple.getDouble(tupleMetadata,GAIN));
        response.setGainFreq(tuple.getDouble(tupleMetadata,GAIN_FREQUENCY));
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 = null;

    while ((tuple = (Tuple) tuples.nextValue()) != null)
    {               
      // add the feature into the classifier
      double[] features= (double[]) tuple.getObject(0);
      classifier.addFeatures(features);
      LOG.debug("Features: size " + features.length + " [0] " + features[0]);
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];
        int sampleSize = ((Integer)iterationData[1]).intValue();
        int sampleRepeat = ((Integer)iterationData[2]).intValue();
       
        LOG.debug("Sample size = " + sampleSize);
        LOG.debug("Sample repeate = " + sampleRepeat);
       
       
        MetadataWrapper metadataWrapper = tuples.getMetadataWrapper();
       
        TupleMetadata metadata =
            (TupleMetadata)metadataWrapper.getMetadata();
       
        Tuple[] sampleTuples = new Tuple[sampleSize];
       

        try
        {
            //mOutput.write(ControlBlock.LIST_BEGIN);

          Queue<Integer> randomIndexes = randomNumbers(sampleRepeat, sampleSize);
            Tuple tuple;
           
            for (long i=0;(tuple = (Tuple)tuples.nextValue()) != null;i++)
            {
              if(randomIndexes.size()>0 && i% sampleRepeat == randomIndexes.peek().intValue()){
                sampleTuples[sampleSize - randomIndexes.size()] = tuple;
                randomIndexes.poll();
               
View Full Code Here

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

    protected void processIteration(Object[] iterationInputs)
            throws ActivityProcessingException, ActivityTerminatedException,
            ActivityUserException
    {

        TupleListIterator tuples = (TupleListIterator)iterationInputs[0];
        TupleMetadata metadata = (TupleMetadata)tuples.getMetadataWrapper().getMetadata();
        Map<Integer, List<Object>> nominalValues =
            getNominalValues(iterationInputs, metadata);
        Instances dataset = WekaUtilities.createAssociationDataset(tuples, nominalValues);
        String options = TupleUtilities.getAsString(iterationInputs[1], INPUT_OPTIONS);
        String algorithmClass = TupleUtilities.getAsString(iterationInputs[2], INPUT_ALGORITHM_CLASS);
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.