timeseries_preprocessing
timeseries_preprocessing
¶
Time series preprocessing utilities for Safe Synthesizer training.
Functions:
| Name | Description |
|---|---|
process_timeseries_data |
Process time series data and validate/infer timestamp parameters. |
process_timeseries_data(training_df, config)
¶
Process time series data and validate/infer timestamp parameters.
Normalizes grouped and ungrouped time series into the same training path.
When no group column is configured, a reserved pseudo-group column
(PSEUDO_GROUP_COLUMN) is added so the whole dataset is treated as one
sequence. Timestamp format and interval metadata inferred here are saved
back into the resolved config for generation.
This function: 1. Creates a timestamp column if one doesn't exist 2. Validates the timestamp column exists and has no missing values 3. Sorts the data by timestamp 4. Infers timestamp_format from the data 5. Validates or infers timestamp_interval_seconds 6. Sets start_timestamp and stop_timestamp
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
training_df
|
DataFrame
|
The training DataFrame. |
required |
config
|
SafeSynthesizerParameters
|
The configuration object with time_series settings |
required |
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, SafeSynthesizerParameters]
|
Tuple of (processed DataFrame, updated config) |
Raises:
| Type | Description |
|---|---|
ParameterError
|
If the timestamp column is missing, if |
DataError
|
If the timestamp column has missing values or intervals are inconsistent. |
Source code in src/nemo_safe_synthesizer/training/timeseries_preprocessing.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |