cbp.builder¶
cbp.builder.base_builder¶
cbp.builder.hmm_builder¶
cbp.builder.hmm_zero_builder¶
cbp.builder.hmm_sim_builder¶
-
class
cbp.builder.hmm_sim_builder.
HMMSimBuilder
(length, simulator, policy, random_seed=1)[source]¶
cbp.builder.hmm_simulator¶
-
class
cbp.builder.hmm_simulator.
HMMSimDate
(time_step, state_num, obser_num, *args, **kwargs)[source]¶ Bases:
dict
-
property
sensor
¶
-
property
traj
¶
-
property
-
class
cbp.builder.hmm_simulator.
HMMSimulator
(time_step, dim_states, dim_observations, random_seed, is_theorem=False)[source]¶ Bases:
object
-
get_fix_margin
(time_step=None)[source]¶ return observation marginal
- Parameters
time_step – if int then return a specific time distribution
otherwise all distributions as matrxi, defaults to None :type time_step: int, optional :return: array for single time_step or a matrix :rtype: ndarray
return ground truth marginal
- Parameters
time_step – if int then return a specific time distribution
otherwise all distributions as matrix, defaults to None :type time_step: int, optional :return: array for single time_step or a matrix :rtype: ndarray
-
get_precious
(time_step=None, verbose=False)[source]¶ return precious marginal
- Parameters
time_step – if int then return a specific time distribution
otherwise all distributions as matrix, defaults to None :type time_step: int, optional :param verbose: whether or not ouput difference between simulation and
theorical margin
- Returns
array for single time_step or a matrix
- Return type
ndarray
-
classmethod
load
(sim_name: str)[source]¶ load a simulator from pkl file
- Parameters
sim_name (str) – name for the simulator
- Returns
simulator
- Return type
simulator
-
property
name
¶
-
register_potential
(ptype, potential)[source]¶ register potential for simulation
- Parameters
ptype (PotentialType) – potential type
potential (ndarray) – [description]
-
cbp.builder.line_builder¶
cbp.builder.migr_simulator¶
cbp.builder.migr_visualizer¶
-
class
cbp.builder.migr_visualizer.
MigrVisualizer
(d_row, d_col)[source]¶ Bases:
object
-
migration
(data, **kwargs)[source]¶ draw migration figure, heat map distribution 3 reservered key in kwargs: *
fig_name
: savefig *xlabel
: xlabel *ylabel
- Parameters
data – [i,j] record i-th particle position at j timestamp
-
potential_heatmap
(data, **kwargs)[source]¶ plot potential heatmap and save png. 2 reserved keys:
title
figure titlepath
figure path prefix
- Parameters
data (ndarray) – i-th row represents the potential of d state
-
visualize_location
(xx, yy, xy_size, **kwargs)[source]¶ plot grid location distribution. Origin point is in DownLeft. 3 reservered key in kwargs: *
fig_name
: savefig *xlabel
: xlabel *ylabel
- Parameters
xx (ndarray) – scatter plot x
yy (ndarray) – scatter plot y
xy_size (ndarray) – at position (x,y) the number of particles
-
cbp.builder.potential_utils¶
-
cbp.builder.potential_utils.
diagonal_potential
(d_1: int, d_2: int, rng: numpy.random.mtrand.RandomState) → numpy.ndarray[source]¶
-
cbp.builder.potential_utils.
diagonal_potential_conv
(d_1: int, d_2: int, rng: numpy.random.mtrand.RandomState) → numpy.ndarray[source]¶
cbp.builder.star_builder¶
cbp.builder.tree_builder¶
cbp.builder.wifi_hmm_builder¶
-
class
cbp.builder.wifi_hmm_builder.
WifiHMMBuilder
(length, grid_d, policy, rand_seed=1, num_sensor=16, time_step=60)[source]¶ Bases:
cbp.builder.hmm_sim_builder.HMMSimBuilder
builder with wifi-type simulator. Sparse observation. pass the wifi-simulator to the cbp.builder.HMMSimBuilder
cbp.builder.wifi_simulator¶
-
class
cbp.builder.wifi_simulator.
WifiSimulator
(time_step, d_col, d_row, random_seed)[source]¶ Bases:
cbp.builder.migr_simulator.MigrSimulator
simulate ensemble move, sensor is sparse - place sensors in some place - draw various data