Simulate and analyze trajectories of Block Markov Chains.
Project description
This Python package provides tools to simulate and analyze trajectories of Block Markov Chains (BMCs).
Contents
A compiled C++ library is distributed, together with stubs.
Usage
Here is an example on how to use the library:
import random
import numpy as np
import BMCToolkit as BMCToolkit
if __name__ == "__main__":
num_states = 10*30
num_clusters = 2
path_length = 1500
current_state = 0
frequency_matrix = np.zeros((num_states,num_states))
trajectory = []
for t in range(path_length):
past_state = current_state
if t % 2 == 0:
if current_state <= num_states / 3:
current_state = random.randint(num_states/3,num_states-1)
else:
current_state = random.randint(0,num_states/3-1)
else:
current_state = random.randint(0,num_states-1)
trajectory.append(current_state)
frequency_matrix[past_state,current_state] += 1
print("Testing compute_clusters_from_trajectory...")
clustering = BMCToolkit.compute_clusters_from_trajectory( trajectory, num_states, num_clusters )
print(clustering)
Related projects
The compiled C++ library utilizes the following other C++ libraries unmodified:
- the Eigen library, available at https://eigen.tuxfamily.org/;
- the Sparse Eigenvalue Computation Toolkit as a Redesigned ARPACK (SPECTRA) library, available at https://spectralib.org/.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for BMCToolkit-0.6.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8203caf98af0ed6cb79c58ad87de7e7eecd37a7f17ad0e7ba77a97f81512419d |
|
MD5 | 1642fdc5c73e7b7fd577829ffe627628 |
|
BLAKE2b-256 | 53d73674762e656bcc31eca6c656664192bbe3a3cf22be28c39a1778fb8e1dab |