wepy.resampling.distances.randomwalk module¶
This module here is part of the RandomWalk object that implements the distance metric for the RandomWalk walk system. This distance metric is a scaled version of the Manhattan Norm.
- class wepy.resampling.distances.randomwalk.RandomWalkDistance[source]¶
Bases:
Distance
A class to implement the RandomWalkDistance metric for measuring differences between walker states. This is a normalized Manhattan distance measured between the difference in positions of the walkers.
Construct a RandomWalkDistance metric.
- image(state)[source]¶
Transform a state into a random walk image.
A random walk image is just the position of a walker in the N-dimensional space.
- Parameters:
state (object implementing WalkerState) – A walker state object with positions in a numpy array of shape (N), where N is the the dimension of the random walk system.
- Returns:
randomwalk_image – The positions of a walker in the N-dimensional space.
- Return type:
array of floats of shape (N)
- image_distance(image_a, image_b)[source]¶
Compute the distance between the image of the two walkers.
- image_aarray of float of shape (1, N)
Position of the first walker’s state.
- image_b: array of float of shape (1, N)
Position of the second walker’s state.
- Returns
- distance: float
The normalized Manhattan distance.