Examples of AdaptiveHistogram


Examples of com.flaptor.hist4j.AdaptiveHistogram

        NodeDescriptor node = cluster.getNodes().get(Integer.parseInt(request.getParameter("id")));
        String eventName = request.getParameter("eventName");
        MonitorModule monitor = (MonitorModule)cluster.getModule("monitor");
        MonitorNodeDescriptor mnode = monitor.getModuleNode(node);
        Statistics statistics = (Statistics)mnode.getLastState().getProperties().get("statistics");
        AdaptiveHistogram hist = statistics.getLastPeriodStats(eventName).getHistogram();
        Calendar c = DateUtil.getCanonicalDayFromToday(0);
       
        Map<Date, List<Number>> ret = new HashMap<Date, List<Number>>();
        float last = 0;
        for (int i = 0; i<100; i += 10) {
            float value = hist.getValueForPercentile(i) - last;
            last = hist.getValueForPercentile(i);
            List<Number> numbers = new ArrayList<Number>();
            numbers.add(last);
            numbers.add(last);
            ret.put(c.getTime(), numbers);
            c = DateUtil.getCanonicalDayFrom(c, 1);
View Full Code Here

Examples of com.flaptor.hist4j.AdaptiveHistogram

        cycleCount = 0;
        failedPages = 0;
        fetchedPages = 0;
        fetchedScore = 0;
        initialized = true;
        priorityHistogram = new AdaptiveHistogram();
        scoreHistogram = new AdaptiveHistogram();
        antiScoreHistogram = new AdaptiveHistogram();
    }
View Full Code Here

Examples of com.flaptor.hist4j.AdaptiveHistogram

        } else {
            pageCount = 0;
            failedPages = 0;
            fetchedPages = 0;
            fetchedScore = 0;
            priorityHistogram = new AdaptiveHistogram();
            scoreHistogram = new AdaptiveHistogram();
            antiScoreHistogram = new AdaptiveHistogram();
        }
        try {
            pageSource.open();
            while (true) {
                Page page = pageSource.nextPage();
View Full Code Here

Examples of com.flaptor.hist4j.AdaptiveHistogram

        pagedb = new ArrayList<Page>();
        for (int i = 0; i < maxPages; i++) {
            Page page = new Page(i);
            pagedb.add(page);
        }
        histogram = new AdaptiveHistogram();
pagedb.get(0).probSuccess = 0.0f;
pagedb.get(0).probChange = 1.0f;
    }
View Full Code Here

Examples of com.flaptor.hist4j.AdaptiveHistogram

        public LuceneIterator() {
            seen = 0;
            try {
                int terms = 0;
                maxFreq = 0;
                AdaptiveHistogram hist = new AdaptiveHistogram();
                termEnum = reader.terms(new Term(field,""));

                while (termEnum.next()) {
                    hist.addValue(termEnum.docFreq());
                    terms++;
                    maxFreq = Math.max(maxFreq,termEnum.docFreq());
                }

                threshold = (int)hist.getValueForPercentile(90);

                termEnum = reader.terms(new Term(field,""));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
View Full Code Here

Examples of com.flaptor.hist4j.AdaptiveHistogram

public class Hist4jExample {

    public static void main(String[] args) {
        Random rnd = new Random(new Date().getTime());
        AdaptiveHistogram h = new AdaptiveHistogram();

        System.out.println();
        System.out.println("Loading 10000 Gauss(0,1) data points into the histogram.");
       
        for (int i=0; i < 10000; i ++) {
            h.addValue((float)rnd.nextGaussian());
        }

        System.out.println();
        System.out.println("Main percentiles:");
        System.out.println("   5%: " + h.getValueForPercentile(5));
        System.out.println("  25%: " + h.getValueForPercentile(25));
        System.out.println("  50%: " + h.getValueForPercentile(50));
        System.out.println("  75%: " + h.getValueForPercentile(75));
        System.out.println("  95%: " + h.getValueForPercentile(95));
        System.out.println();
        System.out.println("Cumulative density:");
        for (float x=-1; x<=1; x+=0.5) {
            System.out.println("  " + x + ": " + h.getAccumCount(x));
        }
        System.out.println();
    }
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.