关于Amazon Forecast中TARGET_TIME_SERIES额外属性与RELATED_TIME_SERIES属性的差异及重复时间戳处理的技术问询
Great questions about Amazon Forecast — let's break this down clearly, since the difference between target vs related series attributes can be tricky at first!
1. Differences between adding Z as a TARGET_TIME_SERIES attribute vs a RELATED_TIME_SERIES attribute
Let’s break this into key, practical distinctions:
Data Binding & Alignment
- TARGET_TIME_SERIES attribute: Z is directly tied to every individual record in your target series. Each row (timestamp + Y1/Y2/Y3 value) will have its own Z value, and Forecast treats this as a context feature specific to that exact target observation.
- RELATED_TIME_SERIES attribute: Z exists as a standalone time series with its own timestamp sequence. Forecast automatically aligns this series with your target data, pulling Z values from matching or adjacent timestamps to generate features for predictions. You don’t need to attach Z to every target row.
Use Case Fit
- Choose TARGET attributes when: Z is unique to each target record or target series. For example, if Y1/Y2/Y3 are sales for 3 different products, and Z is the individual product's daily price (each product has a different price on the same day), Z belongs in the target series as an attribute.
- Choose RELATED series when: Z is a global, time-based variable shared across all your target series. For example, if Z is daily temperature and Y1/Y2/Y3 are sales at 3 different stores, temperature applies equally to all stores on a given day — storing it as a related series avoids redundant data entry.
Future Data Requirements
- For TARGET attributes: When generating forecasts, you must provide future Z values alongside your future target timestamps. Forecast needs this attribute to predict Y1/Y2/Y3 for those future points (e.g., you can’t predict product sales without knowing the future price you’ll set).
- For RELATED series: You still need to provide future Z values, but as a standalone time series rather than attaching them to every future target row. This is cleaner if Z is shared across all targets.
2. Handling Daily Z Values with Duplicate Target Timestamps
If your target time series has 3 entries with the same timestamp (e.g., 3 product sales records for the same day), here’s how to handle Z:
- If Z is a TARGET attribute: Yes, you must repeat Z's daily value in every duplicate timestamp row. Each target record requires a complete set of attributes, so even if the date is the same, every row needs its own Z entry. This can be tedious if Z is the same across all duplicates, but it’s required for the target series structure.
- If Z is a RELATED series: No repetition needed! Just create a single related series where each date has one Z value. Forecast will automatically map that daily Z value to all target records with matching timestamps, which saves you from redundant data entry.
When to Choose TARGET_TIME_SERIES Extra Attributes
To clear up your confusion about when to use target attributes, focus on these scenarios:
- Z varies per target record (not just per timestamp). For example, if you have multiple orders on the same day (duplicate timestamps) and Z is the order's shipping method (different per order), Z must be a target attribute.
- Z is specific to an individual target series. If Y1/Y2/Y3 are sales for 3 different regions, and Z is the region's local promotion status (varies by region and time), Z belongs in each target series' attributes.
- You need tight, record-level control over how Z is paired with your target values. Target attributes ensure Z is explicitly linked to each Y observation, no automatic alignment required.
内容的提问来源于stack exchange,提问作者Luiz Tauffer
相关产品推荐
相关产品推荐

