stoclust

Logo

Clustering algorithms using stochastic analysis and ensemble techniques.

regulators

  ↳ stoclust

Contains some pre-defined regulators and halting conditions for use in the markov_random_walk method.

A regulator is any function which receives the following arguments…

Arguments Type Description
time int The timestep of the random walk.
probs np.ndarray The original transition probabilities of the walk.
at_node int The index of the current node.
node_data np.ndarray An array in which “node data” may be stored, to make the random walk memoryful.

…and returns the following outputs…

Returns Type Description
is_report bool Whether a report is to be logged.
report object The report, if is_report == True, or NoneType if is_report == False.
new_probs np.ndarray The modified transition probabilities.

…and, optionally, which modifies the node_data array in-place in order to update the memory of the walk.

A halting condition is similar but also simpler. It is any function which receives the following arguments…

Arguments Type Description
time int The timestep of the random walk.
at_node int The index of the current node.
node_data np.ndarray An array in which “node data” may be stored, to make the random walk memoryful.

…and returns a single boolean output, which if True will result in the halting of the random walk.

Functions

  • halt_after_time

    halt_after_time(time,at_node,node_data,max_time=100)
    Halts after a fixed duration of time.
  • halt_when_explored

    halt_when_explored(time,at_node,node_data)
    Modifies transition probabilities by making it impossible to transition to any node which has been visited already at least max_visits times; when a node is removed in this way, reports the ID of the removed node.
  • node_removal_regulator

    node_removal_regulator(time, probs, at_node, node_data, max_visits=5)
    Modifies transition probabilities by making it impossible to transition to any node which has been visited already at least max_visits times; when a node is removed in this way, reports the ID of the removed node.