Package edu.brown.markov

Examples of edu.brown.markov.MarkovGraph


                assert(false);
            }
            assert(partition >= 0);
            totals.get(catalog_proc).incrementAndGet();
           
            MarkovGraph markov = m.get(partition).getFromParams(xact.getTransactionId(), partition, xact.getParams(), catalog_proc);
            if (markov == null) {
                LOG.warn(String.format("No MarkovGraph for %s at partition %d", catalog_proc.getName(), partition));
                continue;
            }
           
            // Check whether we predict the same path
            List<MarkovVertex> actual_path = markov.processTransaction(xact, p_estimator);
            MarkovEstimate est = MarkovPathEstimator.predictPath(markov, t_estimators.get(partition), xact.getParams());
            assert(est != null);
            List<MarkovVertex> predicted_path = est.getMarkovPath();
            if (actual_path.equals(predicted_path)) correct_path_txns.get(catalog_proc).incrementAndGet();
           
View Full Code Here


        super(procedures);
    }

    @Override
    public MarkovGraph getFromParams(Long txn_id, int base_partition, Object[] params, Procedure catalog_proc) {
        MarkovGraph ret = null;
       
        String proc_name = catalog_proc.getName();
        int id = -1;
       
        // NEWORDER
View Full Code Here

    public static void launch(
            Map<Pair<Procedure, Integer>, MarkovGraph> partitionGraphs,
            Pair<Procedure,Integer> selection) {
        JFrame frame = new JFrame("Simple Graph View");
        JComboBox partcombo = MarkovViewer.makePartitionComboBox(partitionGraphs);
        MarkovGraph test_graph = partitionGraphs.get(selection);
        frame.setContentPane(MarkovViewer.getPanel(test_graph));
        frame.add(partcombo);
        partcombo.setSelectedItem(selection);
        frame.setBounds(50, 50, 2000, 500);
        frame.setVisible(true);
View Full Code Here

        public void actionPerformed(ActionEvent e) {
            JComboBox cb = (JComboBox) e.getSource();
            JFrame frame = getFrame(cb);
            Procedure proc = MarkovViewer.this.args.catalog_db.getProcedures()
                    .get((String) cb.getSelectedItem());
            MarkovGraph g = procedureGraphs.get(
                    proc);
            assert (g != null);
            GraphVisualizationPanel<MarkovVertex, MarkovEdge> graph_panel = MarkovViewer.getPanel(g);
            graph_panel.add(cb);
            frame.setContentPane(graph_panel);
View Full Code Here

        @Override
        public void actionPerformed(ActionEvent e) {
            JComboBox cb = (JComboBox) e.getSource();
            JFrame frame = (JFrame) cb.getParent().getParent().getParent().getParent();
            Pair<Procedure, Integer> proc = (Pair<Procedure, Integer>) cb.getSelectedItem();
            MarkovGraph g = partitionGraphs.get(proc);
            assert (g != null);
            GraphVisualizationPanel<MarkovVertex, MarkovEdge> graph_panel = MarkovViewer.getPanel(g);
            graph_panel.add(cb);
            frame.setContentPane(graph_panel);
            frame.setBounds(50, 50, 500, 500);
View Full Code Here

     * @param catalog_proc
     * @param initialize
     * @return
     */
    public MarkovGraph getOrCreate(Integer id, Procedure catalog_proc, boolean initialize) {
        MarkovGraph markov = this.get(id, catalog_proc);
        if (markov == null) {
            synchronized (this) {
                markov = this.get(id, catalog_proc);
                if (markov == null) {
                    if (debug.val)
                        LOG.warn(String.format("Creating a new %s MarkovGraph for id %d",
                                 catalog_proc.getName(), id));
                    markov = new MarkovGraph(catalog_proc);
                    if (initialize) markov.initialize();
                    this.put(id, markov);
                }
            } // SYNCH
        }
        return (markov);
View Full Code Here

     * @param catalog_proc
     * @return
     */
    public MarkovGraph getFromParams(Long txn_id, int base_partition, Object params[], Procedure catalog_proc) {
        assert(catalog_proc != null);
        MarkovGraph m = this.getOrCreate(base_partition, catalog_proc, true);
        if (m == null) {
            LOG.warn(String.format("Failed to find MarkovGraph for %s txn #%d [base_partition=%d, params=%s]",
                                   catalog_proc.getName(), txn_id, base_partition, Arrays.toString(params)));
            LOG.warn("MarkovGraphsContainer Dump:\n" + this);
        }
View Full Code Here

     * Invoke MarkovGraph.calculateProbabilities() for all of the graphs stored within this container
     */
    public void calculateProbabilities(PartitionSet partitions) {
        for (Map<Procedure, MarkovGraph> inner : this.markovs.values()) {
            for (Entry<Procedure, MarkovGraph> e : inner.entrySet()) {
                MarkovGraph m = e.getValue();
                m.calculateProbabilities(partitions);
                boolean is_valid = m.isValid();
                if (is_valid == false) {
                    try {
                        File dump = new File("/tmp/" + e.getKey().getName() + ".markovs");
                        m.save(dump);
                        System.err.println("DUMP: " + dump);
                        System.err.println("GRAPHVIZ: " + MarkovUtil.exportGraphviz(e.getValue(), false, null).writeToTempFile(e.getKey()));
                    } catch (Exception ex) {
                        throw new RuntimeException(ex);
                    }
View Full Code Here

    }
   
    public Map<Integer, MarkovGraph> getAll(Procedure catalog_proc) {
        Map<Integer, MarkovGraph> ret = new HashMap<Integer, MarkovGraph>();
        for (Integer id : this.markovs.keySet()) {
            MarkovGraph m = this.markovs.get(id).get(catalog_proc);
            if (m != null) ret.put(id, m);
        } // FOR
        return (ret);
    }
View Full Code Here

           
            maps[++i] = new ListOrderedMap<String, Object>();
            maps[i].put("ID", "#" + id);
            maps[i].put("Number of Procedures", m.size());
            for (Entry<Procedure, MarkovGraph> e : m.entrySet()) {
                MarkovGraph markov = e.getValue();
                String val = String.format("[Vertices=%d, Recomputed=%d, Accuracy=%.4f]",
                                           markov.getVertexCount(), markov.getRecomputeCount(), markov.getAccuracyRatio());
                maps[i].put("   " + e.getKey().getName(), val);
            } // FOR
        } // FOR
       
        return StringUtil.formatMaps(maps);
View Full Code Here

TOP

Related Classes of edu.brown.markov.MarkovGraph

Copyright © 2018 www.massapicom. 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.