Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.analytics.signal_similarity.match

Module Contents

Match

class roboto.analytics.signal_similarity.match.Match#View Source

A subsequence of a target signal that is similar to a query signal.

Attributes

Match.context

context MatchContext #

Correlate a matched subsequence back to its source.

Match.distance

distance float #

Measure of similarity between a query signal and the subsequence of the target signal this Match represents. A smaller distance indicates a closer match.

In single-scale search (scale=None) this is the raw z-normalised Euclidean distance produced by MASS, with range [0, 2·√N] where N is the query length.

In multi-scale search (scale provided) this is multiplied by √N / √M (where N is the original needle length and M is the resampled length at that scale step), projecting onto the same [0, 2·√N] range as single-scale search. This means a max_distance threshold calibrated on single-scale search transfers directly to multi-scale search without adjustment.

Match.end_idx

end_idx int #

The end index in the target signal of this match.

Match.end_time

end_time pandas.Timestamp #

The end time in the target signal of this match.

Match.scale

scale float = 1.0 #

The time-scale factor at which this match was found.

A value of 1.0 means the matched subsequence has the same length as the query. Values greater than 1.0 mean the matched subsequence is proportionally longer (the action occurred more slowly in the target than in the query). Values less than 1.0 mean the matched subsequence is proportionally shorter (the action occurred more quickly).

This field is only meaningful when scale is passed to find_similar_signals().

Match.start_idx

start_idx int #

The start index in the target signal of this match.

Match.start_time

start_time pandas.Timestamp #

The start time in the target signal of this match.

Match.subsequence

subsequence pandas.DataFrame #

The subsequence of the target signal this Match represents. It is equivalent to target[start_idx:end_idx].

Match.to_event()

to_event(name='Signal Similarity Match Result', caller_org_id=None, roboto_client=None)#View Source

Create a Roboto Platform event out of this similarity match result.

Parameters

name str
caller_org_id Optional[str]
roboto_client Optional[roboto.http.RobotoClient]

MatchContext

class roboto.analytics.signal_similarity.match.MatchContext#View Source

Correlate a matched subsequence back to its source.

Attributes

MatchContext.dataset_id

dataset_id str | None = None #

MatchContext.file_id

file_id str | None = None #

MatchContext.message_paths

message_paths collections.abc.Sequence[str] #

MatchContext.topic_id

topic_id str #

MatchContext.topic_name

topic_name str #

Scale

class roboto.analytics.signal_similarity.match.Scale#View Source

Configuration for rate-invariant (multi-scale) signal similarity search.

Searching across multiple scales finds a query pattern regardless of how quickly or slowly it unfolds in the target. For example, a robot lifting a cup in 1 second and the same robot lifting a cup in 3 seconds would both be found.

min and max are positive scale factors relative to the original query length. A scale of 1.0 corresponds to the original query length; 2.0 searches for target subsequences twice as long (action happened at half speed); 0.5 searches for subsequences half as long (action happened at double speed).

While Scale.any() provides a convenient wide-range preset, providing domain-informed bounds (e.g. Scale(min=0.5, max=3.0) for a motion that can happen between half and triple speed) will both improve match quality — by concentrating the search grid where matches are physically plausible — and reduce compute by avoiding unnecessary scale steps.

Scale.any()

classmethod any()#View Source

Well-known preset covering a wide range of speed ratios (0.1x to 10x).

Return type

Scale.factors()

factors()#View Source

Return a list of scale factors spanning the configured range.

Return type

list[float]

Attributes

Scale.max

max float #

Maximum scale factor (must be >= min).

Scale.min

min float #

Minimum scale factor (must be positive).

Scale.spacing

spacing Literal['log', 'linear'] = 'log' #

How to distribute scale values across the range.

  • "log" (default) — geometrically spaced; equal ratio between adjacent steps, which is more natural for speed ratios (e.g. 0.5x, 1x, 2x are equally spaced on a log scale).
  • "linear" — linearly spaced.

Scale.steps

steps int = 10 #

Number of scale values to sample across the range.

Was this page helpful?