Editing
Ai Supply Chain
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''Demand forecasting with LightGBM:''' <syntaxhighlight lang="python"> import pandas as pd import lightgbm as lgb from sklearn.metrics import mean_absolute_percentage_error import numpy as np # Load sales data: item, store, date, sales, price, promotions, weather df = pd.read_csv("sales_data.csv", parse_dates=['date']) df = df.sort_values(['item_id', 'store_id', 'date']) # Feature engineering df['day_of_week'] = df['date'].dt.dayofweek df['month'] = df['date'].dt.month df['week_of_year'] = df['date'].dt.isocalendar().week.astype(int) # Lag features (historical sales) for lag in [7, 14, 28, 56]: df[f'sales_lag_{lag}'] = df.groupby(['item_id','store_id'])['sales'].shift(lag) # Rolling mean features for window in [7, 28]: df[f'sales_rolling_mean_{window}'] = ( df.groupby(['item_id','store_id'])['sales'] .shift(1).rolling(window).mean().values ) features = ['item_id','store_id','day_of_week','month','week_of_year', 'price','is_promotion'] + [c for c in df.columns if 'lag' in c or 'rolling' in c] df = df.dropna() # Chronological train/test split cutoff = df['date'].max() - pd.Timedelta(days=28) train = df[df['date'] <= cutoff] test = df[df['date'] > cutoff] model = lgb.LGBMRegressor(n_estimators=500, learning_rate=0.05, num_leaves=127) model.fit(train[features], train['sales'], eval_set=[(test[features], test['sales'])], callbacks=[lgb.early_stopping(50)]) preds = model.predict(test[features]) print(f"MAPE: {mean_absolute_percentage_error(test['sales'], preds):.2%}") </syntaxhighlight> ; Supply chain AI tools : '''Demand forecasting''' β LightGBM, TFT, Amazon Forecast, Google Cloud Demand Forecasting : '''Route optimization''' β Google OR-Tools, OptaPlanner, Routific; ML-enhanced with pointer networks : '''Warehouse management''' β Locus Robotics, Geek+, Symbotic (robot + AI) : '''Visibility platforms''' β Project44, FourKites β real-time tracking + ETA prediction : '''Risk monitoring''' β Resilinc, Everstream, Riskmethods β NLP on news/supplier signals </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information