Spaces:
Sleeping
Sleeping
Deep commited on
Commit ·
376edbc
1
Parent(s): 880d7e9
code fix
Browse files- .dockerignore +6 -0
- Dockerfile +6 -1
- config/settings.py +1 -1
- config/urls.py +2 -1
- customer_score_models/feature_columns.json +1 -0
- customer_score_models/xgb_model.joblib +3 -0
- customer_score_models/xgb_model.json +0 -0
- customer_score_models/xgb_model.model +3 -0
- customer_score_models/xgb_model.onnx +3 -0
- customer_score_models/xgb_model.pkl +3 -0
- requirements.txt +9 -0
- returns_chance_model/final_ridge_weights.pth +3 -0
- returns_chance_model/preprocessor.joblib +3 -0
- returns_chance_model/preprocessor_params.json +26 -0
- returns_chance_model/stack_model.joblib +3 -0
- returns_chance_model/stack_model.json +8 -0
- returns_chance_model/stack_model.pkl +3 -0
- returns_chance_model/stack_model_params.json +91 -0
- returns_chance_model/stacked_model.joblib +3 -0
- returns_chance_model/stacked_model.pkl +3 -0
- returns_chance_model/stacked_model_info.json +15 -0
- returns_chance_model/synthetic_returns.csv +0 -0
- store/gemini_classification_service.py +2 -2
- store/refund_model_service.py +3 -3
- store/views_return_prediction.py +1 -1
.dockerignore
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
myenv/
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.pyc
|
| 4 |
+
*.pyo
|
| 5 |
+
.git/
|
| 6 |
+
*.sqlite3
|
Dockerfile
CHANGED
|
@@ -7,8 +7,13 @@ COPY . .
|
|
| 7 |
RUN pip install --upgrade pip
|
| 8 |
RUN pip install -r requirements.txt
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
RUN python manage.py collectstatic --noinput
|
|
|
|
| 11 |
|
| 12 |
EXPOSE 7860
|
| 13 |
|
| 14 |
-
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:7860"]
|
|
|
|
| 7 |
RUN pip install --upgrade pip
|
| 8 |
RUN pip install -r requirements.txt
|
| 9 |
|
| 10 |
+
# Set a default secret key for collectstatic (overridden by env var at runtime)
|
| 11 |
+
ENV SECRET_KEY=build-time-placeholder
|
| 12 |
+
ENV DJANGO_SETTINGS_MODULE=config.settings
|
| 13 |
+
|
| 14 |
RUN python manage.py collectstatic --noinput
|
| 15 |
+
RUN python manage.py migrate --noinput || true
|
| 16 |
|
| 17 |
EXPOSE 7860
|
| 18 |
|
| 19 |
+
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120"]
|
config/settings.py
CHANGED
|
@@ -29,7 +29,7 @@ DEBUG = True
|
|
| 29 |
|
| 30 |
AUTH_USER_MODEL = 'store.User'
|
| 31 |
|
| 32 |
-
ALLOWED_HOSTS = []
|
| 33 |
|
| 34 |
CORS_ALLOWED_ORIGINS = [
|
| 35 |
"http://localhost:3000",
|
|
|
|
| 29 |
|
| 30 |
AUTH_USER_MODEL = 'store.User'
|
| 31 |
|
| 32 |
+
ALLOWED_HOSTS = ['*']
|
| 33 |
|
| 34 |
CORS_ALLOWED_ORIGINS = [
|
| 35 |
"http://localhost:3000",
|
config/urls.py
CHANGED
|
@@ -20,7 +20,8 @@ import os
|
|
| 20 |
import sys
|
| 21 |
|
| 22 |
# Ensure project root is on sys.path so we can import voice bot modules (voice_urls, voice_service)
|
| 23 |
-
|
|
|
|
| 24 |
if PROJECT_ROOT not in sys.path:
|
| 25 |
sys.path.append(PROJECT_ROOT)
|
| 26 |
|
|
|
|
| 20 |
import sys
|
| 21 |
|
| 22 |
# Ensure project root is on sys.path so we can import voice bot modules (voice_urls, voice_service)
|
| 23 |
+
# Project root is now just one level up (where manage.py sits) since we moved files into backend/
|
| 24 |
+
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 25 |
if PROJECT_ROOT not in sys.path:
|
| 26 |
sys.path.append(PROJECT_ROOT)
|
| 27 |
|
customer_score_models/feature_columns.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
["user_age", "address_pincode", "base_price", "order_quantity", "product_price", "discount_applied", "days_to_return", "is_exchanged", "risk_score", "discount_ratio", "price_inverse", "days_inverse", "product_name_Air Conditioning Product", "product_name_Art Product", "product_name_Arts And Craftmanship Product", "product_name_Audio Product", "product_name_Auto Product", "product_name_Baby Product", "product_name_Bed Bath Table Product", "product_name_Books General Interest Product", "product_name_Books Imported Product", "product_name_Books Technical Product", "product_name_Cds Dvds Musicals Product", "product_name_Christmas Supplies Product", "product_name_Cine Photo Product", "product_name_Computers Accessories Product", "product_name_Computers Product", "product_name_Consoles Games Product", "product_name_Construction Tools Construction Product", "product_name_Construction Tools Lights Product", "product_name_Construction Tools Safety Product", "product_name_Cool Stuff Product", "product_name_Costruction Tools Garden Product", "product_name_Costruction Tools Tools Product", "product_name_Diapers And Hygiene Product", "product_name_Drinks Product", "product_name_Dvds Blu Ray Product", "product_name_Electronics Product", "product_name_Fashio Female Clothing Product", "product_name_Fashion Bags Accessories Product", "product_name_Fashion Childrens Clothes Product", "product_name_Fashion Male Clothing Product", "product_name_Fashion Shoes Product", "product_name_Fashion Sport Product", "product_name_Fashion Underwear Beach Product", "product_name_Fixed Telephony Product", "product_name_Flowers Product", "product_name_Food Drink Product", "product_name_Food Product", "product_name_Furniture Bedroom Product", "product_name_Furniture Decor Product", "product_name_Furniture Living Room Product", "product_name_Furniture Mattress And Upholstery Product", "product_name_Garden Tools Product", "product_name_Health Beauty Product", "product_name_Home Appliances 2 Product", "product_name_Home Appliances Product", "product_name_Home Comfort 2 Product", "product_name_Home Confort Product", "product_name_Home Construction Product", "product_name_Housewares Product", "product_name_Industry Commerce And Business Product", "product_name_Kitchen Dining Laundry Garden Furniture Product", "product_name_La Cuisine Product", "product_name_Luggage Accessories Product", "product_name_Market Place Product", "product_name_Music Product", "product_name_Musical Instruments Product", "product_name_Office Furniture Product", "product_name_Party Supplies Product", "product_name_Perfumery Product", "product_name_Pet Shop Product", "product_name_Product", "product_name_Security And Services Product", "product_name_Signaling And Security Product", "product_name_Small Appliances Home Oven And Coffee Product", "product_name_Small Appliances Product", "product_name_Sports Leisure Product", "product_name_Stationery Product", "product_name_Tablets Printing Image Product", "product_name_Telephony Product", "product_name_Toys Product", "product_name_Watches Gifts Product", "payment_method_Debit Card", "payment_method_Gift Card", "payment_method_PayPal"]
|
customer_score_models/xgb_model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87232fa83b92e49eb7b3e5ecac0edbcddbdcc6e09452f203597324db31012c40
|
| 3 |
+
size 904498
|
customer_score_models/xgb_model.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
customer_score_models/xgb_model.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4af9b26c944408da91c518fc7d1e653f47d006b8d6f1176d669a06a8c2d63d8c
|
| 3 |
+
size 903718
|
customer_score_models/xgb_model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:92f0ec4a7b10b6103e506f74efe8e224878bd11e463a5037b06b0652eb95d33b
|
| 3 |
+
size 11106
|
customer_score_models/xgb_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87232fa83b92e49eb7b3e5ecac0edbcddbdcc6e09452f203597324db31012c40
|
| 3 |
+
size 904498
|
requirements.txt
CHANGED
|
@@ -31,3 +31,12 @@ scipy>=1.10.0
|
|
| 31 |
xgboost>=1.7.0
|
| 32 |
catboost>=1.2.0
|
| 33 |
lightgbm>=4.0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
xgboost>=1.7.0
|
| 32 |
catboost>=1.2.0
|
| 33 |
lightgbm>=4.0.0
|
| 34 |
+
|
| 35 |
+
# Groq AI (vision classification + NLU)
|
| 36 |
+
groq>=0.4.0
|
| 37 |
+
|
| 38 |
+
# Pydantic (structured output parsing)
|
| 39 |
+
pydantic>=2.0.0
|
| 40 |
+
|
| 41 |
+
# Requests (HTTP client for voice service)
|
| 42 |
+
requests>=2.28.0
|
returns_chance_model/final_ridge_weights.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:75786a72a3b950f0a1363a86fd3de2255bbd3805f647177fe24661d14a5f4c9f
|
| 3 |
+
size 1725
|
returns_chance_model/preprocessor.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1de57d5db1c794a5a945a95951e41da41c35167163988f9ecb7e4deff0fd154e
|
| 3 |
+
size 3483
|
returns_chance_model/preprocessor_params.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class": "<class 'sklearn.compose._column_transformer.ColumnTransformer'>",
|
| 3 |
+
"params": {
|
| 4 |
+
"force_int_remainder_cols": true,
|
| 5 |
+
"n_jobs": null,
|
| 6 |
+
"remainder": "drop",
|
| 7 |
+
"sparse_threshold": 0.3,
|
| 8 |
+
"transformer_weights": null,
|
| 9 |
+
"transformers": "[('cat', OneHotEncoder(handle_unknown='ignore', sparse_output=False), ['user_gender', 'payment_method', 'shipping_method']), ('num', StandardScaler(), ['user_age', 'account_age_days', 'base_price', 'stock_quantity', 'quantity', 'discount_percent'])]",
|
| 10 |
+
"verbose": false,
|
| 11 |
+
"verbose_feature_names_out": true,
|
| 12 |
+
"cat": "OneHotEncoder(handle_unknown='ignore', sparse_output=False)",
|
| 13 |
+
"num": "StandardScaler()",
|
| 14 |
+
"cat__categories": "auto",
|
| 15 |
+
"cat__drop": null,
|
| 16 |
+
"cat__dtype": "<class 'numpy.float64'>",
|
| 17 |
+
"cat__feature_name_combiner": "concat",
|
| 18 |
+
"cat__handle_unknown": "ignore",
|
| 19 |
+
"cat__max_categories": null,
|
| 20 |
+
"cat__min_frequency": null,
|
| 21 |
+
"cat__sparse_output": false,
|
| 22 |
+
"num__copy": true,
|
| 23 |
+
"num__with_mean": true,
|
| 24 |
+
"num__with_std": true
|
| 25 |
+
}
|
| 26 |
+
}
|
returns_chance_model/stack_model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c755da373b736fcb30cfa506024170b6dea2752629c75cb998b59095eeec9fb
|
| 3 |
+
size 1937878
|
returns_chance_model/stack_model.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class": "<class 'sklearn.ensemble._stacking.StackingClassifier'>",
|
| 3 |
+
"params": {
|
| 4 |
+
"cv": 5,
|
| 5 |
+
"estimators": [
|
| 6 |
+
[
|
| 7 |
+
"xgb1",
|
| 8 |
+
|
returns_chance_model/stack_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6e7efbf8ee4fba189f64b16e7dcba468384176d6fb095bd1453b6b6f8ff758a5
|
| 3 |
+
size 1937497
|
returns_chance_model/stack_model_params.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"class": "<class 'sklearn.ensemble._stacking.StackingClassifier'>",
|
| 3 |
+
"params": {
|
| 4 |
+
"cv": 5,
|
| 5 |
+
"estimators": "[('xgb1', XGBClassifier(base_score=None, booster=None, callbacks=None,\n colsample_bylevel=None, colsample_bynode=None,\n colsample_bytree=None, device=None, early_stopping_rounds=None,\n enable_categorical=False, eval_metric='logloss',\n feature_types=None, feature_weights=None, gamma=None,\n grow_policy=None, importance_type=None,\n interaction_constraints=None, learning_rate=0.05, max_bin=None,\n max_cat_threshold=None, max_cat_to_onehot=None,\n max_delta_step=None, max_depth=4, max_leaves=None,\n min_child_weight=None, missing=nan, monotone_constraints=None,\n multi_strategy=None, n_estimators=300, n_jobs=None,\n num_parallel_tree=None, ...)), ('cat1', <catboost.core.CatBoostClassifier object at 0x786725b143e0>), ('lgbm1', LGBMClassifier(learning_rate=0.05, n_estimators=300, random_state=42))]",
|
| 6 |
+
"final_estimator__alphas": [
|
| 7 |
+
0.1,
|
| 8 |
+
1.0,
|
| 9 |
+
10.0
|
| 10 |
+
],
|
| 11 |
+
"final_estimator__class_weight": null,
|
| 12 |
+
"final_estimator__cv": null,
|
| 13 |
+
"final_estimator__fit_intercept": true,
|
| 14 |
+
"final_estimator__scoring": "roc_auc",
|
| 15 |
+
"final_estimator__store_cv_results": null,
|
| 16 |
+
"final_estimator__store_cv_values": true,
|
| 17 |
+
"final_estimator": "RidgeClassifierCV(alphas=[0.1, 1.0, 10.0], scoring='roc_auc',\n store_cv_values=True)",
|
| 18 |
+
"n_jobs": -1,
|
| 19 |
+
"passthrough": true,
|
| 20 |
+
"stack_method": "auto",
|
| 21 |
+
"verbose": 0,
|
| 22 |
+
"xgb1": "XGBClassifier(base_score=None, booster=None, callbacks=None,\n colsample_bylevel=None, colsample_bynode=None,\n colsample_bytree=None, device=None, early_stopping_rounds=None,\n enable_categorical=False, eval_metric='logloss',\n feature_types=None, feature_weights=None, gamma=None,\n grow_policy=None, importance_type=None,\n interaction_constraints=None, learning_rate=0.05, max_bin=None,\n max_cat_threshold=None, max_cat_to_onehot=None,\n max_delta_step=None, max_depth=4, max_leaves=None,\n min_child_weight=None, missing=nan, monotone_constraints=None,\n multi_strategy=None, n_estimators=300, n_jobs=None,\n num_parallel_tree=None, ...)",
|
| 23 |
+
"cat1": "<catboost.core.CatBoostClassifier object at 0x786725b143e0>",
|
| 24 |
+
"lgbm1": "LGBMClassifier(learning_rate=0.05, n_estimators=300, random_state=42)",
|
| 25 |
+
"xgb1__objective": "binary:logistic",
|
| 26 |
+
"xgb1__base_score": null,
|
| 27 |
+
"xgb1__booster": null,
|
| 28 |
+
"xgb1__callbacks": null,
|
| 29 |
+
"xgb1__colsample_bylevel": null,
|
| 30 |
+
"xgb1__colsample_bynode": null,
|
| 31 |
+
"xgb1__colsample_bytree": null,
|
| 32 |
+
"xgb1__device": null,
|
| 33 |
+
"xgb1__early_stopping_rounds": null,
|
| 34 |
+
"xgb1__enable_categorical": false,
|
| 35 |
+
"xgb1__eval_metric": "logloss",
|
| 36 |
+
"xgb1__feature_types": null,
|
| 37 |
+
"xgb1__feature_weights": null,
|
| 38 |
+
"xgb1__gamma": null,
|
| 39 |
+
"xgb1__grow_policy": null,
|
| 40 |
+
"xgb1__importance_type": null,
|
| 41 |
+
"xgb1__interaction_constraints": null,
|
| 42 |
+
"xgb1__learning_rate": 0.05,
|
| 43 |
+
"xgb1__max_bin": null,
|
| 44 |
+
"xgb1__max_cat_threshold": null,
|
| 45 |
+
"xgb1__max_cat_to_onehot": null,
|
| 46 |
+
"xgb1__max_delta_step": null,
|
| 47 |
+
"xgb1__max_depth": 4,
|
| 48 |
+
"xgb1__max_leaves": null,
|
| 49 |
+
"xgb1__min_child_weight": null,
|
| 50 |
+
"xgb1__missing": NaN,
|
| 51 |
+
"xgb1__monotone_constraints": null,
|
| 52 |
+
"xgb1__multi_strategy": null,
|
| 53 |
+
"xgb1__n_estimators": 300,
|
| 54 |
+
"xgb1__n_jobs": null,
|
| 55 |
+
"xgb1__num_parallel_tree": null,
|
| 56 |
+
"xgb1__random_state": 42,
|
| 57 |
+
"xgb1__reg_alpha": null,
|
| 58 |
+
"xgb1__reg_lambda": null,
|
| 59 |
+
"xgb1__sampling_method": null,
|
| 60 |
+
"xgb1__scale_pos_weight": null,
|
| 61 |
+
"xgb1__subsample": null,
|
| 62 |
+
"xgb1__tree_method": null,
|
| 63 |
+
"xgb1__validate_parameters": null,
|
| 64 |
+
"xgb1__verbosity": null,
|
| 65 |
+
"xgb1__use_label_encoder": false,
|
| 66 |
+
"cat1__iterations": 300,
|
| 67 |
+
"cat1__learning_rate": 0.05,
|
| 68 |
+
"cat1__depth": 4,
|
| 69 |
+
"cat1__verbose": 0,
|
| 70 |
+
"cat1__random_state": 42,
|
| 71 |
+
"lgbm1__boosting_type": "gbdt",
|
| 72 |
+
"lgbm1__class_weight": null,
|
| 73 |
+
"lgbm1__colsample_bytree": 1.0,
|
| 74 |
+
"lgbm1__importance_type": "split",
|
| 75 |
+
"lgbm1__learning_rate": 0.05,
|
| 76 |
+
"lgbm1__max_depth": -1,
|
| 77 |
+
"lgbm1__min_child_samples": 20,
|
| 78 |
+
"lgbm1__min_child_weight": 0.001,
|
| 79 |
+
"lgbm1__min_split_gain": 0.0,
|
| 80 |
+
"lgbm1__n_estimators": 300,
|
| 81 |
+
"lgbm1__n_jobs": null,
|
| 82 |
+
"lgbm1__num_leaves": 31,
|
| 83 |
+
"lgbm1__objective": null,
|
| 84 |
+
"lgbm1__random_state": 42,
|
| 85 |
+
"lgbm1__reg_alpha": 0.0,
|
| 86 |
+
"lgbm1__reg_lambda": 0.0,
|
| 87 |
+
"lgbm1__subsample": 1.0,
|
| 88 |
+
"lgbm1__subsample_for_bin": 200000,
|
| 89 |
+
"lgbm1__subsample_freq": 0
|
| 90 |
+
}
|
| 91 |
+
}
|
returns_chance_model/stacked_model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:733b1c073eb1cab13f03fe26f09625ba12618191881f2efd4e47c95becff02de
|
| 3 |
+
size 833486
|
returns_chance_model/stacked_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:32c1614fd18975588313d9448e158dc362c86e7ab5129fc1cb4af24756e3895b
|
| 3 |
+
size 832791
|
returns_chance_model/stacked_model_info.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"feature_names": [
|
| 3 |
+
"cat__payment_method_COD",
|
| 4 |
+
"cat__shipping_method_Standard",
|
| 5 |
+
"num__account_age_days",
|
| 6 |
+
"num__base_price",
|
| 7 |
+
"num__quantity",
|
| 8 |
+
"num__discount_percent"
|
| 9 |
+
],
|
| 10 |
+
"base_models": [
|
| 11 |
+
"XGBClassifier",
|
| 12 |
+
"CatBoostClassifier"
|
| 13 |
+
],
|
| 14 |
+
"meta_model": "LogisticRegressionCV"
|
| 15 |
+
}
|
returns_chance_model/synthetic_returns.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
store/gemini_classification_service.py
CHANGED
|
@@ -17,8 +17,8 @@ from io import BytesIO
|
|
| 17 |
|
| 18 |
logger = logging.getLogger(__name__)
|
| 19 |
|
| 20 |
-
# Ensure
|
| 21 |
-
_project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'
|
| 22 |
if _project_root not in sys.path:
|
| 23 |
sys.path.insert(0, _project_root)
|
| 24 |
|
|
|
|
| 17 |
|
| 18 |
logger = logging.getLogger(__name__)
|
| 19 |
|
| 20 |
+
# Ensure backend root is importable so we can read voice_config
|
| 21 |
+
_project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
| 22 |
if _project_root not in sys.path:
|
| 23 |
sys.path.insert(0, _project_root)
|
| 24 |
|
store/refund_model_service.py
CHANGED
|
@@ -28,9 +28,9 @@ class RefundModelService:
|
|
| 28 |
"""Load the XGBoost model and feature columns"""
|
| 29 |
try:
|
| 30 |
# Get the model directory (adjust path based on your Django setup)
|
| 31 |
-
base_dir = Path(__file__).resolve().parent
|
| 32 |
-
model_path = base_dir / '
|
| 33 |
-
features_path = base_dir / '
|
| 34 |
|
| 35 |
# Load model
|
| 36 |
self._model = xgb.Booster()
|
|
|
|
| 28 |
"""Load the XGBoost model and feature columns"""
|
| 29 |
try:
|
| 30 |
# Get the model directory (adjust path based on your Django setup)
|
| 31 |
+
base_dir = Path(__file__).resolve().parent.parent # backend/
|
| 32 |
+
model_path = base_dir / 'customer_score_models' / 'xgb_model.ubj'
|
| 33 |
+
features_path = base_dir / 'customer_score_models' / 'feature_columns.json'
|
| 34 |
|
| 35 |
# Load model
|
| 36 |
self._model = xgb.Booster()
|
store/views_return_prediction.py
CHANGED
|
@@ -12,7 +12,7 @@ import os
|
|
| 12 |
|
| 13 |
|
| 14 |
# Load the model and preprocessor (load once when the module is imported)
|
| 15 |
-
MODEL_DIR = os.path.join(os.path.dirname(__file__), '
|
| 16 |
|
| 17 |
try:
|
| 18 |
# Try loading the stacking model
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
# Load the model and preprocessor (load once when the module is imported)
|
| 15 |
+
MODEL_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'returns_chance_model')
|
| 16 |
|
| 17 |
try:
|
| 18 |
# Try loading the stacking model
|