gauravsahu1990 commited on
Commit
1ff2e82
·
verified ·
1 Parent(s): 73544cf

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. FeatureEngineering.py +6 -5
  2. app.py +3 -0
  3. catbooster_model_v1_0.joblib +2 -2
FeatureEngineering.py CHANGED
@@ -1,11 +1,9 @@
1
 
 
2
  from sklearn.base import BaseEstimator, TransformerMixin
3
  import numpy as np
4
- from catboost import CatBoostRegressor
5
  import pandas as pd
6
- # ---------------------------
7
- # Custom Feature Engineering Transformer
8
- # ---------------------------
9
  class FeatureEngineering(BaseEstimator, TransformerMixin):
10
  def __init__(self):
11
  pass
@@ -20,6 +18,9 @@ class FeatureEngineering(BaseEstimator, TransformerMixin):
20
  X_['Year'] = X_['Date'].dt.year
21
  X_['Month'] = X_['Date'].dt.month
22
  X_['Weekday'] = X_['Date'].dt.weekday
23
- X_['IsSpecialEvent'] = X_['SpecialEvent'].apply(lambda x: 0 if x=="" else 1)
24
  X_['SlotHour'] = X_['Slot'].str.split(":").str[0].astype(int)
 
 
 
 
25
  return X_
 
1
 
2
+ # FeatureEngineering.py
3
  from sklearn.base import BaseEstimator, TransformerMixin
4
  import numpy as np
 
5
  import pandas as pd
6
+
 
 
7
  class FeatureEngineering(BaseEstimator, TransformerMixin):
8
  def __init__(self):
9
  pass
 
18
  X_['Year'] = X_['Date'].dt.year
19
  X_['Month'] = X_['Date'].dt.month
20
  X_['Weekday'] = X_['Date'].dt.weekday
 
21
  X_['SlotHour'] = X_['Slot'].str.split(":").str[0].astype(int)
22
+
23
+ # Keep categorical SpecialEvent as-is, and also add an indicator if needed
24
+ X_['IsSpecialEvent'] = X_['SpecialEvent'].apply(lambda x: 0 if pd.isna(x) or x == "" else 1)
25
+
26
  return X_
app.py CHANGED
@@ -91,8 +91,11 @@ def predict_capacity_batch():
91
  logger.info("Batch predictions: %s", clean_predictions)
92
 
93
  output_df = pd.DataFrame({
 
94
  "Date": input_data["Date"],
95
  "Store": input_data["Store"],
 
 
96
  "Predicted_Capacity": clean_predictions
97
  })
98
 
 
91
  logger.info("Batch predictions: %s", clean_predictions)
92
 
93
  output_df = pd.DataFrame({
94
+ "BU": input_data["BU"],
95
  "Date": input_data["Date"],
96
  "Store": input_data["Store"],
97
+ "LocationType": input_data["LocationType"],
98
+ "Slot": input_data["Slot"],
99
  "Predicted_Capacity": clean_predictions
100
  })
101
 
catbooster_model_v1_0.joblib CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d20a6e0fe08874508db62951b496151b06da2b57b78a1b5166e2a2090e067f71
3
- size 1673030
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f32fa4df0f600bd98ca97a9bb80e8c126ec56365d151004af44ee6fb20424ade
3
+ size 1119827