Examples of Accumulator


Examples of ivory.smrf.retrieval.Accumulator

          float score = Float.parseFloat(lines[i]);
          i++;
          String originalDocID = lines[i];
          docnoMapping.put(new Integer(docid), originalDocID);
          i++;
          results[j] = new Accumulator(docid, score);
          j++;
        }
        sLogger.info("returning original scores.");
        return results;
      }
View Full Code Here

Examples of ivory.smrf.retrieval.Accumulator

    PostingsReaderWrapper structureReader;
    structureReader = new PostingsReaderWrapper(query, env, globalEvidence);

    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;
    }
    while (docno < Integer.MAX_VALUE) {
      float score = 0.0f;

      // Document-at-a-time scoring.
      NodeWeight sc = structureReader.computeScore(docno);
      score = sc.getScore();

      // 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();
      accs[accs.length - 1 - i] = acc;
    }

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

Examples of org.broad.igv.tdf.Accumulator

            } else {
                float normalizationFactor = 1.0f;
                List<LocusScore> scores = new ArrayList(nBins);
                double scale = (double) (endLocation - startLocation) / nBins;

                Accumulator accumulator = new Accumulator(windowFunction, 5);
                int accumulatedStart = -1;
                int accumulatedEnd = -1;
                int lastEndBin = 0;

                int size = starts.length;

                // Loop through and bin scores for this interval.
                for (int i = 0; i < size; i++) {

                    int true_end = ends == null ? starts[i] + 1 : ends[i];

                    float v = values[i] * normalizationFactor;
                    if (starts[i] >= endLocation) {
                        break// We're beyond the end of the requested interval
                    } else if (true_end <= startLocation || Float.isNaN(v)) {
                        //Not yet to interval, or not a number
                        continue;
                    }

                    // Bound feature at interval, other "piece" will be in another tile.
                    int s = Math.max(startLocation, starts[i]);
                    int e = Math.min(endLocation, true_end);

                    String probeName = features == null ? null : features[i];

                    // Compute bin numbers, relative to start of this tile
                    int endBin = (int) ((e - startLocation) / scale);
                    int startBin = (int) ((s - startLocation) / scale);

                    // If this feature spans multiple bins, or extends beyond last end bin, record
                    if (endBin > lastEndBin || endBin > startBin) {
                        if (accumulator.hasData()) {
                            scores.add(getCompositeScore(accumulator, accumulatedStart, accumulatedEnd));
                            accumulator = new Accumulator(windowFunction, 5);
                        }
                    }

                    if (endBin > startBin) {
                        scores.add(new NamedScore(s, e, v, probeName));
                    } else {
                        if (!accumulator.hasData()) accumulatedStart = s;
                        accumulatedEnd = e;
                        accumulator.add(e - s, v, probeName);
                    }

                    lastEndBin = endBin;
                }

                // Cleanup
                if (accumulator.hasData()) {
                    scores.add(getCompositeScore(accumulator, accumulatedStart, accumulatedEnd));
                }

                tile.addAllScores(scores);
            }
View Full Code Here

Examples of org.broad.igv.tdf.Accumulator

                finishLastLocation(chr, dataPoints);
            }

            for (String s : samples) {
                float[] data = sampleData.get(s);
                Accumulator dp = dataPoints.get(s);
                if (dp == null) {
                    dp = new Accumulator(WindowFunction.mean);
                    dataPoints.put(s, dp);
                }
                try {
                    dp.add(1, data[i], null);
                } catch (Exception e) {
                    log.error("Error adding to GenomeSummaryData", e);
                }
            }
View Full Code Here

Examples of org.broad.igv.tdf.Accumulator

     */
    private void finishLastLocation(String chr, Map<String, Accumulator> dataPoints) {
        nDataPts++;

        for (String s : dataMap.get(chr).keySet()) {
            Accumulator dp = dataPoints.get(s);
            dp.finish();
            dataMap.get(chr).get(s).add(dp.getValue());
        }
        dataPoints.clear();
    }
View Full Code Here

Examples of org.drools.core.spi.Accumulator

                                                                           false,
                                                                           false );

            AccumulateFunction accFunction = new SumAccumulateFunction();

            Accumulator accumulator = new MVELAccumulatorFunctionExecutor( compilationUnit,
                                                                           accFunction );
            ((MVELCompileable) accumulator).compile( data );

            Accumulate accumulate = new Accumulate( sourcePattern,
                                                    new Declaration[]{}, // required declaration
View Full Code Here

Examples of org.drools.core.spi.Accumulator

    public final class Wirer implements Wireable, Serializable {
        private static final long serialVersionUID = -9072646735174734614L;

        public void wire( Object object ) {
            Accumulator acc = KiePolicyHelper.isPolicyEnabled() ? new Accumulator.SafeAccumulator((Accumulator) object) : (Accumulator) object;
            accumulator = acc;
            for ( Accumulate clone : cloned ) {
                ((SingleAccumulate)clone).accumulator = acc;
            }
        }
View Full Code Here

Examples of org.drools.core.spi.Accumulator

        public Wirer( int index ) {
            this.index = index;
        }

        public void wire( Object object ) {
            Accumulator accumulator = KiePolicyHelper.isPolicyEnabled() ? new Accumulator.SafeAccumulator((Accumulator) object) : (Accumulator) object;
            accumulators[index] = accumulator;
            for ( Accumulate clone : cloned ) {
                ((MultiAccumulate)clone).accumulators[index] = accumulator;
            }
        }
View Full Code Here

Examples of org.drools.core.spi.Accumulator

        public Wirer( int index ) {
            this.index = index;
        }

        public void wire( Object object ) {
            Accumulator accumulator = KiePolicyHelper.isPolicyEnabled() ? new SafeAccumulator((Accumulator) object) : (Accumulator) object;
            accumulators[index] = accumulator;
            for ( Accumulate clone : cloned ) {
                clone.accumulators[index] = accumulator;
            }
        }
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.