tdfs4ds.genai.operators.ts_compress¶
tdfs4ds.genai.operators.ts_compress
¶
The td-ts-compressor ts_compress_to table operator: see operator_context.
The operator (https://github.com/denismolin/td-ts-compressor) keeps, per series, the
points that matter geometrically: the endpoints, then repeatedly the point farthest (in
perpendicular distance) from its active segment, in a scaled coordinate system. Its
output keeps the selected input rows plus compression_importance (selection order)
and compression_distance. A process view usually wraps it in the aggregation that
feature_sql of the package generates (compression_ratio, distance_rank_N ...).
Detected by the mapping / function name (any qualifier, any case) or, for a renamed
mapping, by its USING signature. TD_SYSFNLIB.ts_compress is an unrelated Teradata
system function (a time-series compression of its own, no USING names of this operator),
so the bare name ts_compress is accepted only with the signature.
KNOWN_NAMES
module-attribute
¶
_SIGNATURE_REQUIRED
module-attribute
¶
FEATURE_NAMES
module-attribute
¶
FEATURE_NAMES = ('original_points', 'remaining_points', 'compressed_points', 'retained_ratio', 'retained_pct', 'compression_ratio', 'reduction_pct', 'max_selected_distance', 'avg_selected_distance', 'std_selected_distance')
_FEATURE_TEXT
module-attribute
¶
_FEATURE_TEXT = {'original_points': 'number of observations of the series before compression', 'remaining_points': 'number of points kept by the compressor', 'compressed_points': 'number of points kept by the compressor (same as remaining_points)', 'retained_ratio': 'kept points / original points (0 to 1)', 'retained_pct': '100 * retained_ratio', 'compression_ratio': 'original points / kept points (higher = stronger compression, a series that is simple geometrically compresses more)', 'reduction_pct': '100 * (1 - retained_ratio), the share of observations removed', 'max_selected_distance': 'largest compression_distance among kept points (in practice the most prominent departure from a straight line between the endpoints)', 'avg_selected_distance': 'mean compression_distance of the kept points (endpoints count as 0)', 'std_selected_distance': 'sample standard deviation of compression_distance of the kept points'}
_DEFAULTS
module-attribute
¶
_DEFAULTS = {'distance_max': '1.0', 'n_max': '-1', 'tol_x': 'auto', 'tol_y': 'auto', 'plot_width_px': '1600', 'plot_height_px': '900', 'plot_x_fraction': '0.95', 'auto_log_drop': '1.5', 'time_unit': 'second', 'time_type': 'auto'}
_NAME_RE
module-attribute
¶
_USING_PAIR_RE
module-attribute
¶
_LABEL_RE
module-attribute
¶
_PARAM_ORDER
module-attribute
¶
_PARAM_ORDER = ('distance_max', 'n_max', 'auto_log_drop', 'min_relative_gain', 'min_absolute_gain', 'tol_x', 'tol_y', 'plot_width_px', 'plot_height_px', 'plot_x_fraction')
_balanced
¶
End index (of the closing parenthesis) of the group opened at open_at, or None.
_top_level
¶
Index of the first match of keyword_re outside parentheses and strings, -1 if none.
_clauses
¶
ON / PARTITION BY / ORDER BY / USING parts of a table-operator call body.
collect
¶
Whether the mapping exists, and where. Best effort, one DBC read per distinct name.
The operator is configured entirely by the SQL (nothing is stored in a model table), so the database adds only one fact: is the mapping installed, and in which database. That is cheap, and tells the reader a renamed or unqualified mapping resolves to something.