**2. Demand Forecasting**
schema - > generation (saket)

(These features need to filled) -> from the above image we can see that we have 18 features -> (3*2*3)
**Fetch features** -> Please share a dummy csv.
```
/entity/retail/store,
/entity/retail/sku,
/context/retail/week_of_year_context,
/feature/retail/store_sku/time_window_type_week/volume,
/feature/retail/store_sku/time_window_type_week/value
```
# Model Schema For Demand Forecasting
```
message ModelDesignInputSchema {
common.ModelInputType input_type = 1;
// instance.ModelFramework model_framework = 3;
ModelDatasetFramework dataset_framework = 2;
oneof input_schema_is_one_of {
ModelDesignMultivariateInputSchema multivariate = 10;
ModelDesignStreamInputSchema time_series = 11;
ModelDesignImageInputSchema image = 12;
ModelDesignRecommendationInputSchema recommendation = 13;
ModelDesignRegressionInputSchema regression = 14;
}
}
message ModelDesignRegressionInputSchema {
map<string, RegressionProfileInputSchema> regression_profile = 1; // key = store_sku.csv
}
message RegressionProfileInputSchema{
repeated telos.core.base.Token token = 1; // KnowledgeTokenType or FeatureTokenType
}
message ModelDesignOutputSchema {
common.ModelOutputType design_output_type = 1;
oneof output_is_one_of {
ModelDesignClassificationOutputSchema classification_schema = 10;
ModelDesignRegressionOutputSchema regression_schema = 11;
ModelDesignProjectionOutputSchema projection_schema = 12;
ModelDesignClusteringOutputSchema clustering_schema = 13;
ModelDesignDensityOutputSchema density_schema = 14;
ModelDesignRecommendationOutputSchema recommendation_schema = 15;
ModelDesignForecastingOutputSchema forecasting_schema = 16;
ModelDesignAnomalyOutputSchema anomaly_schema = 17;
ModelDesignOptimizationOutputSchema optimization_schema = 18;
ModelDesignDetectionOutputSchema detection_schema = 19;
ModelDesignAnnotationOutputSchema annotation_schema = 20;
}
}
message ModelDesignRegressionOutputSchema {
// //core.quantity.QuantitySchema target_variable = 1; // atomic numeric
// string label_schema = 1;
// repeated string inference_schema = 2;
repeated RegressionProfileOutputSchema regression_profile = 1;
}
message RegressionProfileOutputSchema {
telos.core.base.Token regression_profile = 1; // /inference/retail/store_sku_demand_forecast
string file_name = 2; // store_sku_demand_forecast.csv
repeated RegressionProfileColumnSchema column_schema = 3;
}
message RegressionProfileColumnSchema {
string name = 1; // /entity/retail/store, /entity/retail/sku, /quantity/common/demand_forecast
string value = 2; // string, doubleList
}
I/P ::
context=weekly {52}
store*sku.csv
/entity/retail/store,/entity/retail/sku,/context/retail/temporal/week_of_year_context,/feature/retail/store_sku/time_window_type_week/volume/,/feature/retail/store_sku/time_window_type_week/value
2100810247189956780,3073474199897134082,2023-08-22,28,53524
2100810247189956780,3073474199897134082,2023-08-15,21,53524
2100810247189956780,3073474199897134082,2023-08-08,29,53524
2100810247189956780,3073474199897134082,2023-08-01,32,53524
2100810247189956780,2087293461784409367,2023-08-15,55,68409
2100810247189956781,4109935204587939621,2023-08-08,55,60538
2100810247189956780,1502310312024339025,2023-08-01,65,145665
store*brand.csv
entity/retail/store | entity/retail/brand | feature/retail/store_brand/volume | feature/retail/store_brand/value
store*category.csv
entity/retail/store | entity/retail/category | feature/retail/store_category/volume | feature/retail/store_category/value
O/P ::
inference_store_sku.csv
entity/retail/store | entity/retail/sku | forecasted_week_timeStamp |forecasted_value
2100810247189956780 | 3073474199897134082| 2023-08-29 | 58
2100810247189956780 | 3073474199897134082 | 2023-09-06 | 59 // weekly forecasted value
inference_store_brand.csv
entity/retail/store | entity/retail/brand | forecasted_week_timeStamp | forecasted_value
2100810247189956780 | 3073474199897134082| 2023-08-29 | 58
2100810247189956780 | 3073474199897134082 | 2023-09-06 | 59 //
inference_store_category.csv
entity/retail/store | entity/retail/category |forecasted_week_timeStamp |forecasted_value
2100810247189956780 | 3073474199897134082| 2023-08-29 | 58
2100810247189956780 | 3073474199897134082 | 2023-09-06 | 59 //
```
**Model Training (Yashdeep)**
Shortlived background job specifically for model training run as a container. Its primary purpose it to use the ModelDesignSchema and Dataset for training the model (Showcasing the demand). Its assumed that the ModelDesignSchema and Dataset are mounted in the container. Once training is complete it publishes an ModelInferenceEvent event to ‘model-inference-topic’
Input and output Fields specifically used from ModelDesignSchema for Training process -
** It needs to be updated, if we want to accomodate for time series data **
```
"input": {
"demandForecasting": {
"demandForecastingProfile": {
"store*brand.csv": {
"token": [
{
"type": "TELOS_ENTITY_TOKEN",
"id": {
"key": "/entity/retail/store",
"u32": 1763
}
},
{
"type": "TELOS_ENTITY_TOKEN",
"id": {
"key": "/entity/retail/brand",
"u32": 1764
}
},
{
"type": "TELOS_CONTEXT_TOKEN",
"id":{
"key": "/context/retail/temporal/week_of_year_context",
"u32": 1764
}
},
{
"type": "TELOS_FEATURE_TOKEN",
"id": {
"key": "/feature/retail/brand_store/z_value_sum/time_window_type_week",
"u32": 68
}
},
{
"type": "TELOS_FEATURE_TOKEN",
"id": {
"key": "/feature/retail/brand_store/z_quantity_sum/time_window_type_week",
"u32": 65
}
}
]
},
"store*category.csv": {
"token": [
{
"type": "TELOS_ENTITY_TOKEN",
"id": {
"key": "/entity/retail/store",
"u32": 1763
}
},
{
"type": "TELOS_ENTITY_TOKEN",
"id": {
"key": "/entity/retail/category",
"u32": 1761
}
},
{
"type": "TELOS_CONTEXT_TOKEN",
"id":{
"key": "/context/retail/temporal/week_of_year_context",
"u32": 1764
}
},
{
"type": "TELOS_FEATURE_TOKEN",
"id": {
"key": "/feature/retail/category_store/z_value_sum/time_window_type_week",
"u32": 67
}
},
{
"type": "TELOS_FEATURE_TOKEN",
"id": {
"key": "/feature/retail/category_store/z_quantity_sum/time_window_type_week",
"u32": 66
}
}
]
},
"store*sku.csv": {
"token": [
{
"type": "TELOS_ENTITY_TOKEN",
"id": {
"key": "/entity/retail/store",
"u32": 1763
}
},
{
"type": "TELOS_ENTITY_TOKEN",
"id": {
"key": "/entity/retail/sku",
"u32": 1765
}
},
{
"type": "TELOS_CONTEXT_TOKEN",
"id":{
"key": "/context/retail/temporal/week_of_year_context",
"u32": 1764
}
},
{
"type": "TELOS_FEATURE_TOKEN",
"id": {
"key": "/feature/retail/sku_store/z_value_sum/time_window_type_week",
"u32": 69
}
},
{
"type": "TELOS_FEATURE_TOKEN",
"id": {
"key": "/feature/retail/sku_store/z_quantity_sum/time_window_type_week",
"u32": 70
}
}
]
}
}
}
},
output:
"output": {
"design_output_type": "OUTPUT_TYPE_DEMANDFORECASTING",
"demand_forecasting_schema": {
"demand_forecasting_profile":[
{
"demand_forecasting_profile":{
"id":{
"key":" /inference/retail/store_sku_demand",
"u32": 1232
},
"inference":{
"name":{
"path":[
"inference",
"retail",
"store_sku_demand"
]
}
}
},
"file_name":"store_sku_demand.csv",
"column_schema":[
{
"name":"/entity/retail/store/",
"value":"string"
},
{
"name":"/entity/retail/sku/",
"value":"string"
},
{
"name":"/quantity/common/store_sku_demand",
"value":"F64Vector"
}
]
},
```
Rough work
-> (2100810247189956780,3073474199897134082) -> 2023-08-22,28,53524 -> [58,59]
2023-08-15,21,53524
2023-08-08,29,53524
2023-08-01,32,53524
-> 2100810247189956780,3073474199897134082 2023-08-29 58
2100810247189956780,3073474199897134082 2023-09-06 59
-> 2100810247189956781,4109935204587939621 [75,45]
-> 2100810247189956780,1502310312024339025 [71,32]