Giter VIP home page Giter VIP logo

mcmc's Introduction

MCMC

Documentation Status Updates

Markov Chain Monte Carlo

Features

In this version, seven py file are included.

The main program is mcmc.py which has the functionality:

1.Creating a list storing every graphs at each time points, which generated by a Markov Chain Monta Carlo Method (Metripolis-Hastings Algorithm);

2.Ploting out the first N graphs, where N is smaller or eqaul to the total time points;

3.Finding the most possible graph which has the largest appearance times in the graph list;

4.Giving the expected number of edges connected to vertex 0;

5.Giving the expected number of edges in the entire graph;

6.Giving the expected maximum distance of the shortest path ina graph that connects vertex 0 to another vertex.

Two classes are included:

1.edge_oper;

2.connec_graph.

And four independent functions are included:

3.posi_assign;

4.theta;

5.Metripolis_Hastings;

6.plot_graph;

1.edge_oper: including all the edge operation related functions

a.weight_calc: returning the matrix storing the distance between each vertex pairs given the position of each vertex

b.ran_edge: returning the random edge created unifromly

c.update_edges_list: Given the random created edge and edges list containing edges cannot be deleted which garantee the connected graph, return True if the edges list has been updated; return False if the edges list is unchanged. Meanwhile, adding the random edge if it is not exist; deleting it if it is already exist and not among the edges listcontaining edges connot be deleted;

d.edges_weighted: returning the edges with weight of the current graph given the weight matrix

2.connec_graph:

  1. init_graph: creating the initial graph only connecting vertex 0 to other vertexes.
  2. edges_keep: returning the edges list containing edges cannot be deleted which garantee the connected graph and its number of elements.
  1. posi_assign: creating a 2D grid and picking N random points uniformly.
  2. theta : calculating the theta function posted in the note.
  3. Metripolis_Hastings: Using the Metripolis Hastings Algorithm to judge if the poposal graph accepted or not, if the proposal graph had been refected, the graph at next time point would be the same as the current graph.
  4. plot_graph: ploting out the graph.The edges with weight bigger than 0.5 would be connected by solid line, other edges would be connected by dash lines.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

mcmc's People

Contributors

wenxh0718 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.