Examples of Accumulator


Examples of com.facebook.presto.operator.aggregation.Accumulator

        typeRegistry.addType(new ClassifierType());
        typeRegistry.addType(new RegressorType());
        typeRegistry.addType(new ModelType());
        metadata.addFunctions(new MLFunctionFactory(typeRegistry).listFunctions());
        InternalAggregationFunction aggregation = metadata.getExactFunction(new Signature("evaluate_classifier_predictions", StandardTypes.VARCHAR, StandardTypes.BIGINT, StandardTypes.BIGINT)).getAggregationFunction();
        Accumulator accumulator = aggregation.bind(ImmutableList.of(0, 1), Optional.<Integer>absent(), Optional.<Integer>absent(), 1.0).createAccumulator();
        accumulator.addInput(getPage());
        Block block = accumulator.evaluateFinal();

        String output = VARCHAR.getSlice(block, 0).toStringUtf8();
        List<String> parts = ImmutableList.copyOf(Splitter.on('\n').split(output));
        assertEquals(parts.size(), 3);
        assertEquals(parts.get(0), "Accuracy: 1/2 (50.00%)");
View Full Code Here

Examples of com.facebook.presto.operator.aggregation.Accumulator

        typeRegistry.addType(new ClassifierType());
        typeRegistry.addType(new RegressorType());
        typeRegistry.addType(new ModelType());
        metadata.addFunctions(new MLFunctionFactory(typeRegistry).listFunctions());
        InternalAggregationFunction aggregation = metadata.getExactFunction(new Signature("evaluate_classifier_predictions", StandardTypes.VARCHAR, StandardTypes.BIGINT, StandardTypes.BIGINT)).getAggregationFunction();
        Accumulator accumulator = aggregation.bind(ImmutableList.of(0, 1), Optional.<Integer>absent(), Optional.<Integer>absent(), 1.0).createAccumulator();
        accumulator.addInput(getPage());
        Block block = accumulator.evaluateFinal();

        String output = VARCHAR.getSlice(block, 0).toStringUtf8();
        List<String> parts = ImmutableList.copyOf(Splitter.on('\n').split(output));
        assertEquals(parts.size(), 3);
        assertEquals(parts.get(0), "Accuracy: 1/2 (50.00%)");
View Full Code Here

Examples of com.facebook.presto.operator.aggregation.Accumulator

            throws Exception
    {
        MetadataManager metadata = new MetadataManager();
        metadata.addFunctions(new MLFunctionFactory().listFunctions());
        InternalAggregationFunction aggregation = metadata.getExactFunction(new Signature("evaluate_classifier_predictions", VARCHAR, BIGINT, BIGINT)).getAggregationFunction();
        Accumulator accumulator = aggregation.createAggregation(Optional.<Integer>absent(), Optional.<Integer>absent(), 1.0, 0, 1);
        accumulator.addInput(getPage());
        Block block = accumulator.evaluateFinal();

        String output = VARCHAR.getSlice(block, 0).toStringUtf8();
        List<String> parts = ImmutableList.copyOf(Splitter.on('\n').split(output));
        assertEquals(parts.size(), 3);
        assertEquals(parts.get(0), "Accuracy: 1/2 (50.00%)");
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.aggregate.Accumulator

                    // Create if does not exist.
                    if ( accs == null )
                    {
                        for ( ExprAggregator agg : aggregators )
                        {
                            Accumulator x = agg.getAggregator().createAccumulator() ;
                            Var v = agg.getVar() ;
                            accumulators.put(key, Pair.create(v, x)) ;
                        }
                        accs = accumulators.get(key) ;
                    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.aggregate.Accumulator

                    // Create if does not exist.
                    if ( accs == null )
                    {
                        for ( ExprAggregator agg : aggregators )
                        {
                            Accumulator x = agg.getAggregator().createAccumulator() ;
                            Var v = agg.getVar() ;
                            accumulators.put(key, Pair.create(v, x)) ;
                        }
                        accs = accumulators.get(key) ;
                    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.aggregate.Accumulator

                    // Create if does not exist.
                    if ( accs == null )
                    {
                        for ( ExprAggregator agg : aggregators )
                        {
                            Accumulator x = agg.getAggregator().createAccumulator() ;
                            Var v = agg.getVar() ;
                            accumulators.put(key, Pair.create(v, x)) ;
                        }
                        accs = accumulators.get(key) ;
                    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.aggregate.Accumulator

                    // Create if does not exist.
                    if ( accs == null )
                    {
                        for ( ExprAggregator agg : aggregators )
                        {
                            Accumulator x = agg.getAggregator().createAccumulator() ;
                            Var v = agg.getVar() ;
                            accumulators.put(key, Pair.create(v, x)) ;
                        }
                        accs = accumulators.get(key) ;
                    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.aggregate.Accumulator

                    // Create if does not exist.
                    if ( accs == null )
                    {
                        for ( ExprAggregator agg : aggregators )
                        {
                            Accumulator x = agg.getAggregator().createAccumulator() ;
                            Var v = agg.getVar() ;
                            accumulators.put(key, Pair.create(v, x)) ;
                        }
                        accs = accumulators.get(key) ;
                    }
View Full Code Here

Examples of com.persistit.Accumulator

import com.persistit.exception.PersistitInterruptedException;

public class AccumulatorAdapter {

    public static long getSnapshot(AccumInfo accumInfo, Tree tree) throws PersistitInterruptedException {
        Accumulator accumulator = getAccumulator(accumInfo, tree);
        return accumulator.getSnapshotValue();
    }
View Full Code Here

Examples of ivory.smrf.retrieval.Accumulator

      throw new RuntimeException(e);
    }
    ////System.out.println("Ranker created.");

    sortedAccumulators.clear();
    Accumulator a = new Accumulator(0, 0.0f);

    // NodeWeight that must be achieved to enter result set.
    double scoreThreshold = Double.NEGATIVE_INFINITY;

    int docno = Integer.MAX_VALUE;
    int nextDocno = structureReader.getNextCandidate(docno);
    if(nextDocno < docno){
      docno = nextDocno;
    }
    int cnt = 0;
    while (docno < Integer.MAX_VALUE) {
      float score = 0.0f;

      // Document-at-a-time scoring.
      //      try {
      //    LOG.info("Advance to docno " + docno+" => "+getDocnoMapping().getDocid(docno));
      //      } catch (IOException e) {
      //    e.printStackTrace();
      //      }
      NodeWeight sc = structureReader.computeScore(docno,0);
      score = sc.getBM25((int) env.getDocumentCount(), env.getDocumentLength(docno), env.getCollectionSize()/ (float) env.getDocumentCount());
//      LOG.info("Docno " + docno + ","+docnoMapping.getDocid(docno)+" scored: "+score);

      cnt++;
      // Keep track of numResults best accumulators.
      if (score > scoreThreshold) {
        a.docno = docno;
        a.score = score;
        sortedAccumulators.add(a);

        if (sortedAccumulators.size() == numResults + 1) {
          a = sortedAccumulators.poll();
          scoreThreshold = sortedAccumulators.peek().score;
        } else {
          a = new Accumulator(0, 0.0f);
        }
      }    

      // Advance to next document
      docno = Integer.MAX_VALUE;
      nextDocno = structureReader.getNextCandidate(docno);
      if(nextDocno < docno){
        docno = nextDocno;
      }
    }

    // Grab the accumulators off the stack, in (reverse) order.
    Accumulator[] accs = new Accumulator[Math.min(numResults, sortedAccumulators.size())];
    for (int i = 0; i < accs.length; i++) {
      Accumulator acc = sortedAccumulators.poll();
      //    LOG.info((accs.length - 1 - i)+"="+acc.docno+","+acc.score);
      accs[accs.length - 1 - i] = acc;
    }

    this.results.put(qid, accs);
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.