BaseMatching

class leuvenmapmatching.matcher.base.BaseMatching(matcher: BaseMatcher, edge_m: Segment, edge_o: Segment, logprob=-inf, logprobema=-inf, logprobe=-inf, logprobne=-inf, dist_obs: float = 0.0, obs: int = 0, obs_ne: int = 0, prev: Set[BaseMatching] | None = None, stop: bool = False, length: int = 1, delayed: int = 0, **_kwargs)[source]

Matching object that represents a node in the Viterbi lattice.

Parameters:
  • matcher – Reference to the Matcher used to generate this matching object.

  • edge_m – Segment in the given graph (thus line between two nodes in the graph).

  • edge_o – Segment in the given observations (thus line in between two observations).

  • logprob – Log probability of this matching.

  • logprobema – Exponential Mean Average of Log probability.

  • logprobe – Emitting

  • logprobne – Non-emitting

  • dist_obs – Distance between map point and observation

  • obs – Reference to path entry index (observation)

  • obs_ne – Number of non-emitting states for this observation

  • prev – Previous best matching objects

  • stop – Stop after this matching (e.g. because probability is too low)

  • length – Lenght of current matching sequence through lattice.

  • delayed – This matching is temporarily stopped if >0 (e.g. to first explore better options).

  • dist_m – Distance over graph

  • dist_o – Distance over observations

  • _kwargs

classmethod first(logprob_init, edge_m, edge_o, matcher, dist_obs)[source]

Create an initial lattice Matching object.

property key

Key that indicates the node or edge, observation and non-emitting step. This is the unique key that is used in the lattice.

next(edge_m: Segment, edge_o: Segment, obs: int = 0, obs_ne: int = 0)[source]

Create a next lattice Matching object with this Matching object as the previous one in the lattice.

property prune_value

Pruning the lattice (e.g. to delay) is based on this key.

property shortkey

Key that indicates the node or edge. Irrespective of the current observation.

update(m_next)[source]

Update the current entry if the new matching object for this state is better.

Parameters:

m_next – The new matching object representing the same node in the lattice.

Returns:

True if the current object is replaced, False otherwise