Phase 4
Phase 4
Introduction
Dynamic pricing is a strategy where businesses adjust prices
based on current market demands to optimize revenue and profit.
By leveraging data analytics and machine learning, companies can
make informed pricing decisions that reflect real-time market
conditions.
Objective
The goal of this project is to develop and evaluate a dynamic
pricing model using machine learning. The model will predict
demand and adjust prices to maximize revenue, covering data
preprocessing, exploratory data analysis (EDA), model training and
validation, price optimization, and performance evaluation.
Steps Involved
2. Accuracy Metrics
3. Customer-Related Metrics
5. Operational Metrics
• Inventory Turnover: Rate of selling and replacing inventory.
• Stockouts and Overstocks: Frequency of running out of or
having excess stock.
6. Strategic Metrics
• Market Share: Company’s sales as a percentage of total
market sales.
• Competitive Positioning: How pricing compares to
competitors.
7. Behavioral Metrics
4. Price optimization
Determine optimal prices to maximize revenue by simulating
various pricing scenarios.
5.Performance evaluation
Evaluate model effectiveness in real-world scenarios by
calculating metrics such as price elasticity and comparing actual
vs. predicted sales.
Conclusion
# Feature Engineering
Data[‘DayOfWeek’] = data[‘Date’].dt.dayofweek
Data[‘Month’] = data[‘Date’].dt.month
Data[‘Day’] = data[‘Date’].dt.day
Data.dropna(inplace=True)
# Correlation heatmap
Plt.figure(figsize=(10, 8))
Sns.heatmap(data.corr(), annot=True, fmt=’.2f’, cmap=’coolwarm’)
Plt.show()
# Train the model
Model = GradientBoostingRegressor(n_estimators=100,
learning_rate=0.1, max_depth=5, random_state=42)
Model.fit(X_train, y_train)
# Predictions
Y_pred_train = model.predict(X_train)
Y_pred_test = model.predict(X_test)
# Evaluation
Mae = mean_absolute_error(y_test, y_pred_test)
Rmse = np.sqrt(mean_squared_error(y_test, y_pred_test))
R2 = r2_score(y_test, y_pred_test)
Print(f’MAE: {mae}’)
Print(f’RMSE: {rmse}’)
Print(f’R2: {r2}’)
# Assuming we want to find the optimal price that maximizes
revenue
Price_range = np.linspace(min(data[‘Price’]), max(data[‘Price’]),
100)
Best_price = None
Max_revenue = -np.inf