Pricing AI
AI Pricing Optimization: Dinamik Fiyatlandırma
Yapay zeka ile fiyat optimizasyonu. Dynamic pricing, competitor monitoring, elasticity analysis. Amazon, Uber tarzı real-time price adjustment.
💰Pricing Stratejileri
AI Pricing Optimization, talep, rakip fiyatları ve stok durumuna göre fiyatları otomatik ayarlar. %15-30 kâr marjı artışı sağlar.
Dynamic Pricing
• Talebe göre fiyat
• Real-time ayarlama
• Surge pricing (Uber)
• Revenue optimization
Competitor-Based
• Rakip fiyat izleme
• Auto price matching
• Market positioning
• Price wars management
Personalized
• Müşteri segmenti bazlı
• Willingness to pay
• Loyalty discounts
• Time-based offers
Price Elasticity Analysis
# Price Elasticity (Fiyat Esnekliği) Hesaplama
import pandas as pd
import numpy as np
from scipy import stats
# Veri: Farklı fiyatlarda satış miktarları
df = pd.DataFrame({
'price': [100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200],
'quantity_sold': [1000, 950, 880, 800, 710, 620, 530, 440, 360, 290, 230]
})
# Log-log regression ile elasticity
df['log_price'] = np.log(df['price'])
df['log_quantity'] = np.log(df['quantity_sold'])
slope, intercept, r_value, p_value, std_err = stats.linregress(
df['log_price'],
df['log_quantity']
)
elasticity = slope
print(f"Price Elasticity: {elasticity:.2f}")
# Output: -2.15 (elastic: %1 fiyat artışı → %2.15 talep azalışı)
# Elasticity yorumlama
if abs(elasticity) > 1:
print("Elastic (fiyata duyarlı) - fiyat düşür, ciro artar")
elif abs(elasticity) < 1:
print("Inelastic (fiyata duyarsız) - fiyat artır, kâr artar")
else:
print("Unit elastic")
# Optimal fiyat hesaplama (Revenue Maximization)
def calculate_optimal_price(elasticity, cost):
"""
Optimal fiyat = Maliyet / (1 + 1/Elasticity)
"""
optimal_price = cost / (1 + 1/elasticity)
return optimal_price
cost = 50 # Ürün maliyeti
optimal_price = calculate_optimal_price(elasticity, cost)
print(f"Optimal Price: {optimal_price:.2f} TL")
# Revenue prediction
def predict_revenue(price):
# Log-log modelinden quantity tahmin et
log_price = np.log(price)
log_quantity = intercept + slope * log_price
quantity = np.exp(log_quantity)
revenue = price * quantity
profit = (price - cost) * quantity
return {
'price': price,
'quantity': quantity,
'revenue': revenue,
'profit': profit
}
# Test farklı fiyatlar
prices = range(80, 220, 10)
results = [predict_revenue(p) for p in prices]
# En yüksek kârlı fiyatı bul
best = max(results, key=lambda x: x['profit'])
print(f"\nBest Price for Max Profit: {best['price']} TL")
print(f"Expected Quantity: {best['quantity']:.0f}")
print(f"Expected Profit: {best['profit']:,.0f} TL")Dynamic Pricing Algorithm
# Multi-factor dynamic pricing
import datetime
from sklearn.ensemble import RandomForestRegressor
class DynamicPricer:
def __init__(self, base_price, cost, elasticity):
self.base_price = base_price
self.cost = cost
self.elasticity = elasticity
self.model = None
def train(self, historical_data):
"""Geçmiş satış verileriyle ML modeli eğit"""
# Features: day_of_week, hour, inventory, competitor_price, ...
X = historical_data[['day_of_week', 'hour', 'inventory_level',
'competitor_avg_price', 'is_holiday', 'weather_score']]
y = historical_data['optimal_price']
self.model = RandomForestRegressor(n_estimators=100, random_state=42)
self.model.fit(X, y)
def calculate_price(self, current_conditions):
"""Real-time fiyat hesaplama"""
# 1. Base modifiers
demand_multiplier = self._calculate_demand_multiplier(current_conditions)
inventory_multiplier = self._calculate_inventory_multiplier(current_conditions)
competition_multiplier = self._calculate_competition_multiplier(current_conditions)
time_multiplier = self._calculate_time_multiplier(current_conditions)
# 2. ML prediction (varsa)
if self.model:
features = [[
current_conditions['day_of_week'],
current_conditions['hour'],
current_conditions['inventory_level'],
current_conditions['competitor_avg_price'],
current_conditions['is_holiday'],
current_conditions['weather_score']
]]
ml_price = self.model.predict(features)[0]
ml_multiplier = ml_price / self.base_price
else:
ml_multiplier = 1.0
# 3. Combine all factors
final_multiplier = (
demand_multiplier * 0.35 +
inventory_multiplier * 0.25 +
competition_multiplier * 0.25 +
time_multiplier * 0.10 +
ml_multiplier * 0.05
)
price = self.base_price * final_multiplier
# 4. Constraints
min_price = self.cost * 1.15 # Min %15 kâr marjı
max_price = self.base_price * 1.5 # Max %50 artış
price = max(min_price, min(price, max_price))
return round(price, 2)
def _calculate_demand_multiplier(self, conditions):
"""Talebe göre çarpan"""
demand_score = conditions.get('demand_score', 0.5) # 0-1 arası
if demand_score > 0.8: # Yüksek talep
return 1.20 # %20 artış
elif demand_score > 0.6:
return 1.10
elif demand_score < 0.3: # Düşük talep
return 0.90 # %10 indirim
else:
return 1.0
def _calculate_inventory_multiplier(self, conditions):
"""Stok durumuna göre"""
inventory_level = conditions.get('inventory_level', 50)
if inventory_level < 10: # Kritik stok
return 1.15 # Fiyat artır (stok bitmesin)
elif inventory_level > 100: # Fazla stok
return 0.90 # İndirim yap (stok erit)
else:
return 1.0
def _calculate_competition_multiplier(self, conditions):
"""Rakip fiyatlarına göre"""
competitor_avg = conditions.get('competitor_avg_price', self.base_price)
price_diff = (competitor_avg - self.base_price) / self.base_price
if price_diff > 0.10: # Rakipler %10+ pahalı
return 1.05 # Fiyatı artır (ama hâlâ ucuz)
elif price_diff < -0.10: # Rakipler %10+ ucuz
return 0.95 # Fiyatı düşür (rekabetçi kal)
else:
return 1.0
def _calculate_time_multiplier(self, conditions):
"""Zaman bazlı (gün, saat)"""
hour = conditions.get('hour', 12)
day_of_week = conditions.get('day_of_week', 3) # 0=Monday
# Peak hours (18-22)
if 18 <= hour <= 22:
return 1.05
# Off-peak (2-6)
elif 2 <= hour <= 6:
return 0.95
# Weekend
elif day_of_week >= 5: # Cumartesi, Pazar
return 1.03
else:
return 1.0
# Kullanım
pricer = DynamicPricer(base_price=1000, cost=700, elasticity=-1.8)
# Real-time koşullar
conditions = {
'demand_score': 0.85, # Yüksek talep
'inventory_level': 15, # Düşük stok
'competitor_avg_price': 1050, # Rakipler biraz pahalı
'hour': 20, # Peak hour
'day_of_week': 6, # Pazar
'is_holiday': 0,
'weather_score': 0.8
}
optimal_price = pricer.calculate_price(conditions)
print(f"Optimal Price: {optimal_price} TL")
# Output: 1,142 TL (base: 1000 → %14.2 artış)Competitor Price Monitoring
# Web scraping ile rakip fiyat izleme
from selenium import webdriver
from selenium.webdriver.common.by import By
from bs4 import BeautifulSoup
import requests
import time
class CompetitorMonitor:
def __init__(self):
self.competitors = [
{
'name': 'Competitor A',
'url': 'https://competitora.com/product/laptop-xyz',
'price_selector': '.product-price'
},
{
'name': 'Competitor B',
'url': 'https://competitorb.com/laptop-xyz',
'price_selector': '#price'
}
]
def scrape_price(self, competitor):
"""Tek bir rakipten fiyat çek"""
try:
# Basit siteler için requests
response = requests.get(competitor['url'], timeout=10)
soup = BeautifulSoup(response.content, 'html.parser')
price_element = soup.select_one(competitor['price_selector'])
if price_element:
price_text = price_element.text.strip()
# "1.299,99 TL" → 1299.99
price = float(price_text.replace('.', '').replace(',', '.').replace(' TL', ''))
return price
except Exception as e:
print(f"Error scraping {competitor['name']}: {e}")
return None
def scrape_all(self):
"""Tüm rakiplerden fiyat çek"""
prices = {}
for competitor in self.competitors:
price = self.scrape_price(competitor)
if price:
prices[competitor['name']] = price
time.sleep(2) # Rate limiting (nazik ol)
return prices
def get_average_price(self):
prices = self.scrape_all()
if prices:
avg = sum(prices.values()) / len(prices)
return {
'average': avg,
'min': min(prices.values()),
'max': max(prices.values()),
'prices': prices
}
return None
# Kullanım
monitor = CompetitorMonitor()
competitor_data = monitor.get_average_price()
print(f"Competitor Avg: {competitor_data['average']:.2f} TL")
print(f"Range: {competitor_data['min']:.2f} - {competitor_data['max']:.2f} TL")
# Fiyat ayarlama kararı
my_price = 1250
avg_price = competitor_data['average']
if my_price > avg_price * 1.10:
print("⚠️ Fiyatınız rakiplerden %10+ pahalı! Fiyat düşürmeyi düşünün.")
elif my_price < avg_price * 0.90:
print("💡 Fiyatınız rakiplerden çok ucuz. Fiyat artırabilirsiniz.")
else:
print("✅ Fiyatınız rekabetçi aralıkta.")
# Automated price adjustment
def auto_adjust_price(my_price, competitor_avg, strategy='match'):
if strategy == 'match':
# Rakip ortalamasına eşitle
return competitor_avg
elif strategy == 'undercut':
# %5 daha ucuz
return competitor_avg * 0.95
elif strategy == 'premium':
# %5 daha pahalı (premium positioning)
return competitor_avg * 1.05
new_price = auto_adjust_price(my_price, avg_price, strategy='undercut')
print(f"Suggested Price: {new_price:.2f} TL")A/B Testing for Pricing
# A/B test: Hangi fiyat daha kârlı?
import scipy.stats as stats
# Test A: Mevcut fiyat (1000 TL)
conversions_a = 120
visitors_a = 5000
revenue_a = 120 * 1000
# Test B: Yeni fiyat (1100 TL)
conversions_b = 105
visitors_b = 5000
revenue_b = 105 * 1100
# Conversion rate
cr_a = conversions_a / visitors_a
cr_b = conversions_b / visitors_b
print(f"Test A CR: {cr_a:.2%} | Revenue: {revenue_a:,} TL")
print(f"Test B CR: {cr_b:.2%} | Revenue: {revenue_b:,} TL")
# İstatistiksel anlamlılık (Chi-square test)
chi2, p_value = stats.chi2_contingency([
[conversions_a, visitors_a - conversions_a],
[conversions_b, visitors_b - conversions_b]
])[:2]
print(f"\nP-value: {p_value:.4f}")
if p_value < 0.05:
if revenue_b > revenue_a:
print("✅ Test B kazandı! Fiyatı 1100 TL yap.")
else:
print("✅ Test A kazandı! Mevcut fiyatı koru.")
else:
print("⚠️ Fark istatistiksel olarak anlamlı değil. Daha uzun test et.")
# Revenue lift
lift = ((revenue_b - revenue_a) / revenue_a) * 100
print(f"Revenue Lift: {lift:+.1f}%")Surge Pricing (Uber Model)
# Real-time surge pricing (talep/arz dengesi)
class SurgePricer:
def __init__(self, base_price):
self.base_price = base_price
def calculate_surge(self, demand, supply):
"""
demand: Talep (örn: aktif kullanıcı sayısı)
supply: Arz (örn: müsait ürün/hizmet)
"""
# Talep/Arz oranı
if supply == 0:
return self.base_price * 2.0 # Max surge
demand_supply_ratio = demand / supply
# Surge multiplier
if demand_supply_ratio > 5: # Çok yüksek talep
surge = 2.0 # 2x fiyat
elif demand_supply_ratio > 3:
surge = 1.75
elif demand_supply_ratio > 2:
surge = 1.5
elif demand_supply_ratio > 1.5:
surge = 1.25
elif demand_supply_ratio < 0.5: # Çok düşük talep
surge = 0.80 # %20 indirim
else:
surge = 1.0
return self.base_price * surge
# Örnek: Havaalanı transferi
pricer = SurgePricer(base_price=200)
# Normal durum
price = pricer.calculate_surge(demand=50, supply=100)
print(f"Normal: {price} TL") # 160 TL (0.8x)
# Yağmurlu akşam
price = pricer.calculate_surge(demand=500, supply=100)
print(f"Surge: {price} TL") # 400 TL (2x)
# New Year's Eve
price = pricer.calculate_surge(demand=1000, supply=80)
print(f"NYE Surge: {price} TL") # 400 TL (2x)İş Etkileri ve ROI
Pricing Optimization ROI
+25%
Kâr Marjı Artışı
+18%
Revenue Growth
-12%
Inventory Cost
Örnek ROI: E-Ticaret (1000 SKU)
• Öncesi: Sabit fiyat → 100M TL ciro, %20 marj = 20M TL kâr
• AI pricing sonrası: Dinamik fiyat
• Yüksek talep ürünler: +%15 fiyat → +18M TL gelir
• Düşük talep ürünler: -%10 fiyat → +8M TL gelir (miktar artışı)
• Yeni ciro: 126M TL (+%26)
• Yeni kâr: 25M TL (+%25, marj iyileşmesi)
• AI sistem maliyeti: 120K TL/yıl
• Net kazanç: 4.88M TL/yıl
AI Pricing Optimization Çözümünüzü Kuralım
Dynamic pricing, competitor monitoring, elasticity analysis ile kâr marjınızı %25'e kadar artırın.
Demo İste→