Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pricing Optimization ML

A machine learning system that predicts optimal markup percentages for product pricing based on order characteristics and customer attributes.

Overview

This project demonstrates how to build a pricing optimization model using historical order data. The model predicts the appropriate markup percentage for each order based on:

  • Order features: delivery distance, quantity, unit cost, packaging type
  • Customer features: industry, credit limit, payment terms

Dataset

The dataset contains ~12,800 orders and ~735 customers with the following key columns:

Order Data (order_df.csv):

Column Description
delivery_distance Distance in miles
order_quantity_lbs Order quantity in pounds
average_unit_cost_lbs Unit cost in USD/lb
packaging Packaging type (BULK, -MDRM)
markup_percentage Target variable
customer_id Link to customer data

Customer Data (customer_df.csv):

Column Description
industry_name Customer industry (Pharma, Food, etc.)
credit_limit Customer credit limit
term_code Payment terms

Models

Model Test RΒ² Notes
Linear Regression 0.63 Baseline model
Decision Tree 0.75 Depth limited to 5
Random Forest 0.87 100 estimators, depth 10
XGBoost 0.88 Best performance with customer features

Quick Start

# Install dependencies
pip install -r requirements.txt

# Run the notebook
jupyter notebook pricing_optimization.ipynb

Project Structure

β”œβ”€β”€ notebooks/
β”‚   └── pricing_optimization.ipynb  # Main analysis notebook
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ customer_df.csv             # Customer attributes
β”‚   β”œβ”€β”€ order_df.csv                # Historical orders
β”‚   └── inference/
β”‚       β”œβ”€β”€ inference_df.csv        # New orders for prediction
β”‚       └── inference_predicted.csv # Predictions output
β”œβ”€β”€ requirements.txt
└── README.md

Key Findings

  1. Customer industry matters: Chemical Processing and Pharma customers typically receive different markup rates
  2. Order quantity impacts pricing: Larger bulk orders tend to have different markup strategies
  3. Delivery distance affects costs: Longer distances increase delivery costs which impacts optimal markup

Usage

The trained model can be used to predict markup percentages for new orders:

# Load the model and predict
import joblib
model = joblib.load('xgboost_model.pkl')
predicted_markup = model.predict(new_order_features)

# Calculate selling price
selling_price = unit_cost * (1 + predicted_markup)

License

MIT License

About

πŸ’° Pricing optimization with XGBoost β€” predicting optimal markup on 12.8K orders

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages