- Example 1
-
此示例对西雅图商店的所有项目应用 10% 的折扣。请注意,“城市”是一个预测维度。
TimeSeriesTransformations=[
{
"Action": {
"AttributeName": "price",
"Operation": "MULTIPLY",
"Value": 0.90
},
"TimeSeriesConditions": [
{
"AttributeName": "city",
"AttributeValue": "seattle",
"Condition": "EQUALS"
}
]
}
]
- Example 2
-
此示例对“电子产品”类别中的所有项目应用 10% 的折扣。请注意,“product_category”是一个项目元数据。
TimeSeriesTransformations=[
{
"Action": {
"AttributeName": "price",
"Operation": "MULTIPLY",
"Value": 0.90
},
"TimeSeriesConditions": [
{
"AttributeName": "product_category",
"AttributeValue": "electronics",
"Condition": "EQUALS"
}
]
}
]
- Example 3
-
此示例对特定 item BOA21314K _id 应用了 20% 的加价。
TimeSeriesTransformations=[
{
"Action": {
"AttributeName": "price",
"Operation": "MULTIPLY",
"Value": 1.20
},
"TimeSeriesConditions": [
{
"AttributeName": "item_id",
"AttributeValue": "BOA21314K",
"Condition": "EQUALS"
}
]
}
]
- Example 4
-
此示例为西雅图和贝尔维尤商店的所有项目增加 1 美元。
TimeSeriesTransformations=[
{
"Action": {
"AttributeName": "price",
"Operation": "ADD",
"Value": 1.0
},
"TimeSeriesConditions": [
{
"AttributeName": "city",
"AttributeValue": "seattle",
"Condition": "EQUALS"
}
]
},
{
"Action": {
"AttributeName": "price",
"Operation": "ADD",
"Value": 1.0
},
"TimeSeriesConditions": [
{
"AttributeName": "city",
"AttributeValue": "bellevue",
"Condition": "EQUALS"
}
]
}
]
- Example 5
-
此示例为 2022 年 9 月西雅图商店的所有项目减去 1 美元。
TimeSeriesTransformations=[
{
"Action": {
"AttributeName": "price",
"Operation": "SUBTRACT",
"Value": 1.0
},
"TimeSeriesConditions": [
{
"AttributeName": "city",
"AttributeValue": "seattle",
"Condition": "EQUALS"
},
{
"AttributeName": "timestamp",
"AttributeValue": "2022-08-31 00:00:00",
"Condition": "GREATER_THAN"
},
{
"AttributeName": "timestamp",
"AttributeValue": "2022-10-01 00:00:00",
"Condition": "LESS_THAN"
}
]
}
]
- Example 6
-
在此示例中,价格先乘以 10,然后再减去 5 美元。请注意,此类操作是按照声明的顺序应用的。
TimeSeriesTransformations=[
{
"Action": {
"AttributeName": "price",
"Operation": "MULTIPLY",
"Value": 10.0
},
"TimeSeriesConditions": [
{
"AttributeName": "city",
"AttributeValue": "seattle",
"Condition": "EQUALS"
}
]
},
{
"Action": {
"AttributeName": "price",
"Operation": "SUBTRACT",
"Value": 5.0
},
"TimeSeriesConditions": [
{
"AttributeName": "city",
"AttributeValue": "seattle",
"Condition": "EQUALS"
}
]
}
]
- Example 7
-
因为此示例创建了一个空集,所以此操作不适用于任何时间序列。此代码试图修改西雅图和贝尔维尤商店中所有项目的价格。由于条件与AND操作相结合,并且商店只能存在于一个城市中,因此结果为空集。因此,此操作不适用。
TimeSeriesTransformations=[
{
"Action": {
"AttributeName": "price",
"Operation": "MULTIPLY",
"Value": 10.0
},
"TimeSeriesConditions": [
{
"AttributeName": "city",
"AttributeValue": "seattle",
"Condition": "EQUALS"
},
{
"AttributeName": "city",
"AttributeValue": "bellevue",
"Condition": "EQUALS"
},
]
}
]
有关如何将一个条件应用于多个属性的示例,请参阅示例 4。
- Example 8
-
使用时间戳的转换条件适用于边界对齐的数据,而不适用于原始数据。例如,您每小时输入一次数据,然后每天进行预测。在本用例中,Forecast 会将时间戳与当天对齐,因此将 2020-12-31 01:00:00
与 2020-12-31 00:00:00
对齐。此代码将创建一个空集,因为它没有在边界对齐的时间戳处指定时间戳。
TimeSeriesTransformations=[
{
"Action": {
"AttributeName": "price",
"Operation": "MULTIPLY",
"Value": 10.0
},
"TimeSeriesConditions": [
{
"AttributeName": "timestamp",
"AttributeValue": "2020-12-31 01:00:00",
"Condition": "EQUALS"
},
]
}
]