Upload 4 files
Browse files- README.md +66 -0
- app.py +52 -0
- clicks_predictor_model.pkl +3 -0
- sample_input.json +13 -0
README.md
CHANGED
@@ -1,3 +1,69 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
tags:
|
4 |
+
- regression
|
5 |
+
- marketing
|
6 |
+
- machine-learning
|
7 |
+
- streamlit
|
8 |
+
- randomforest
|
9 |
+
- sklearn
|
10 |
---
|
11 |
+
|
12 |
+
# 📊 Marketing Click Prediction with Machine Learning
|
13 |
+
|
14 |
+
Bu proje, pazarlama kampanyalarının tıklanma sayısını tahmin etmek için makine öğrenmesi (Random Forest) ve Streamlit kullanılarak geliştirilmiştir.
|
15 |
+
|
16 |
+
## 🔍 Kullanılan Veri Seti
|
17 |
+
- Model Tipi: `RandomForestRegressor`
|
18 |
+
- Eğitim Verisi: `marketing_campaign_dataset.csv` (220.000 satırdan örneklenmiş)
|
19 |
+
- Girdi Özellikleri: Şirket adı, kampanya türü, hedef kitle, kanal, süre, maliyet, dil, etkileşim, vb.
|
20 |
+
- Hedef: Tıklama sayısı (Clicks)
|
21 |
+
|
22 |
+
## 🧠 Kullanılan Yöntemler
|
23 |
+
- Veri temizleme ve Label Encoding
|
24 |
+
- Özellik mühendisliği
|
25 |
+
- RandomForestRegressor modeli ile tahmin
|
26 |
+
- Modeli `.pkl` olarak kaydetme
|
27 |
+
- Streamlit ile tahmin arayüzü
|
28 |
+
|
29 |
+
|
30 |
+
Bu modeli kullanarak oluşturulan bir tahmin arayüzü Streamlit ile yapılmıştır. Arayüzde kullanıcı yukarıdaki özellikleri girerek tahmini tıklama sayısını anında alabilir.
|
31 |
+
## 🖼️ Uygulama Arayüzü
|
32 |
+
|
33 |
+
Aşağıda Streamlit arayüzünün bir örneği yer almaktadır:
|
34 |
+
|
35 |
+

|
36 |
+
|
37 |
+
|
38 |
+
🔗 Diğer Platformlar
|
39 |
+
✅ GitHub Repo (Tüm Kodlar ve Streamlit)
|
40 |
+
|
41 |
+
✅ Streamlit App
|
42 |
+
|
43 |
+
## 🚀 Nasıl Kullanılır?
|
44 |
+
1. Gereksinimleri yükleyin:
|
45 |
+
```bash
|
46 |
+
pip install -r requirements.txt
|
47 |
+
|
48 |
+
|
49 |
+
Modeli çalıştırmak için:
|
50 |
+
python model.py
|
51 |
+
|
52 |
+
Streamlit uygulamasını başlatın:
|
53 |
+
streamlit run app.py
|
54 |
+
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
💡 Geliştirilebilir Noktalar
|
59 |
+
Daha fazla model karşılaştırması yapılabilir.
|
60 |
+
|
61 |
+
Kullanıcı girdilerinde LabelEncoder yerine eğitim sırasında kaydedilen encoder kullanılabilir.
|
62 |
+
|
63 |
+
Model Hugging Face' model olarak yüklendi
|
64 |
+
|
65 |
+
📝 Lisans
|
66 |
+
Bu proje eğitim amaçlıdır.
|
67 |
+
|
68 |
+
|
69 |
+
|
app.py
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import joblib
|
4 |
+
from sklearn.preprocessing import LabelEncoder
|
5 |
+
|
6 |
+
# Modeli yükle
|
7 |
+
model = joblib.load("clicks_predictor_model.pkl")
|
8 |
+
|
9 |
+
st.title("📊 Marketing Campaign Click Predictor")
|
10 |
+
st.markdown("Kampanya özelliklerine göre tahmini tıklama sayısını öğrenin.")
|
11 |
+
|
12 |
+
# Kullanıcı girdileri
|
13 |
+
company = st.selectbox("Şirket", ["Innovate Industries", "NexGen Systems", "Alpha", "TechCorp", "DataTech Solutions"])
|
14 |
+
campaign_type = st.selectbox("Kampanya Türü", ["Email", "Influencer", "Search", "Social Media"])
|
15 |
+
target_audience = st.selectbox("Hedef Kitle", ["Men 18-24", "Women 35-44", "All Ages", "Men 25-34"])
|
16 |
+
duration = st.selectbox("Süre", ["15 days", "30 days", "45 days", "60 days"])
|
17 |
+
channel = st.selectbox("Kanal", ["Google Ads", "YouTube", "Facebook", "Instagram", "Website", "Email"])
|
18 |
+
acquisition_cost = st.number_input("Müşteri Kazanım Maliyeti ($)", value=1000.0)
|
19 |
+
location = st.selectbox("Konum", ["Chicago", "New York", "Los Angeles", "Miami", "Houston"])
|
20 |
+
language = st.selectbox("Dil", ["Spanish", "German", "French", "Mandarin", "English"])
|
21 |
+
impressions = st.number_input("İzlenim Sayısı", value=1000)
|
22 |
+
engagement = st.slider("Etkileşim Skoru", 0, 10, 5)
|
23 |
+
customer_segment = st.selectbox("Müşteri Segmenti", ["Health & Wellness", "Fashionistas", "Outdoor Adventurers", "Tech Enthusiasts", "Foodies"])
|
24 |
+
|
25 |
+
# Girdileri DataFrame'e çevir
|
26 |
+
input_df = pd.DataFrame({
|
27 |
+
"Company": [company],
|
28 |
+
"Campaign_Type": [campaign_type],
|
29 |
+
"Target_Audience": [target_audience],
|
30 |
+
"Duration": [duration],
|
31 |
+
"Channel_Used": [channel],
|
32 |
+
"Acquisition_Cost": [acquisition_cost],
|
33 |
+
"Location": [location],
|
34 |
+
"Language": [language],
|
35 |
+
"Impressions": [impressions],
|
36 |
+
"Engagement_Score": [engagement],
|
37 |
+
"Customer_Segment": [customer_segment]
|
38 |
+
})
|
39 |
+
|
40 |
+
# Aynı şekilde encode et
|
41 |
+
def encode_input(df):
|
42 |
+
for col in df.columns:
|
43 |
+
if df[col].dtype == 'object':
|
44 |
+
df[col] = LabelEncoder().fit_transform(df[col])
|
45 |
+
return df
|
46 |
+
|
47 |
+
input_encoded = encode_input(input_df)
|
48 |
+
|
49 |
+
# Tahmin yap
|
50 |
+
if st.button("Tahmin Et"):
|
51 |
+
prediction = model.predict(input_encoded)[0]
|
52 |
+
st.success(f"📈 Tahmini Tıklama Sayısı: {int(prediction)}")
|
clicks_predictor_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8f4cf1613c7fa5ea6a2ed5b2755ecfd6d97a2b01ff538446807caa999269b120
|
3 |
+
size 1450442193
|
sample_input.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Company": "Innovate Industries",
|
3 |
+
"Campaign_Type": "Email",
|
4 |
+
"Target_Audience": "Men 18-24",
|
5 |
+
"Duration": "30 days",
|
6 |
+
"Channel_Used": "Google Ads",
|
7 |
+
"Acquisition_Cost": 10000,
|
8 |
+
"Location": "Chicago",
|
9 |
+
"Language": "Spanish",
|
10 |
+
"Impressions": 5000,
|
11 |
+
"Engagement_Score": 6,
|
12 |
+
"Customer_Segment": "Health & Wellness"
|
13 |
+
}
|