<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yasin Sarıyıldız on Medium]]></title>
        <description><![CDATA[Stories by Yasin Sarıyıldız on Medium]]></description>
        <link>https://medium.com/@yasinnsariyildiz?source=rss-d74f7e44bb96------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*G65TM78biDq-16KxHwjHtQ.jpeg</url>
            <title>Stories by Yasin Sarıyıldız on Medium</title>
            <link>https://medium.com/@yasinnsariyildiz?source=rss-d74f7e44bb96------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 09:42:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yasinnsariyildiz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Potansiyel Müşteriden Dönüşüm Elde Etme Stratejisi: Session-Based RFM Segmentasyonu]]></title>
            <link>https://medium.com/@yasinnsariyildiz/potansiyel-m%C3%BC%C5%9Fteriden-d%C3%B6n%C3%BC%C5%9F%C3%BCme-session-based-rfm-segmentasyonu-f2e3c9ecbae0?source=rss-d74f7e44bb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2e3c9ecbae0</guid>
            <dc:creator><![CDATA[Yasin Sarıyıldız]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 10:24:51 GMT</pubDate>
            <atom:updated>2026-02-09T10:31:34.492Z</atom:updated>
            <content:encoded><![CDATA[<p>Standart bir RFM segmentasyonu, sipariş gerçekleştirmiş kullanıcıları segmentlere ayırmak için kullanılan yöntemlerin başında geliyor. Peki yine RFM kullanarak henüz sipariş vermemiş kullanıcılar içinden potansiyel müşterileri nasıl bulup kampanyalarda hedefleyebiliriz?</p><p>İşte burada devreye, RFM metriklerini <strong>oturum (session)</strong> verileriyle yeniden dizayn eden <strong>Session-Based RFM</strong> yaklaşımı giriyor. Standart RFM’de sipariş bazlı hesaplanan metrikler Session-Based RFM yönteminde kullanıcıların<strong> </strong>session davranışları baz alınarak hesaplanıyor.</p><p>Session-Based RFM yöntemiyle henüz sipariş gerçekleştirmemiş ancak potansiyeli yüksek olan kullanıcıları tespit edip kampanyalarda hedefleyebiliriz.</p><p><strong>Recency(R):</strong> Son session’dan itibaren geçen süre</p><p><strong>Frequency(F):</strong> Toplam session sayısı</p><p><strong>Monetary(M):</strong> Gerçekleştirilen ecommerce eventlerindeki revenue değeri</p><p>Monetary metriğini hesaplarken spesifik bir ecommerce eventini kullanabileceğimiz gibi birden fazla ecommerce eventini beraber kullanabiliriz. Örneğin, sadece add to cart eventindeki toplam revenue değerini hesaplayabiliriz. Veya add to cart ile birlikte begin checkout eventini de kullanma esnekliğine sahibiz. Segmentasyonun yapılacağı markanın trafik ve event hacmine göre bu durum değişkenlik gösterebilir.</p><p>Her bir kullanıcı için RFM metriklerini ve skorlarını hesapladıktan sonra bu skorlara uygun kurallar tanımlayarak potansiyel müşteriler için segmentler oluşturabiliriz.</p><p>Başka bir yazıda Session Bazlı RFM segmentasyonunun nasıl uygulanacağını SQL kodları ile açıklayıp örnek potansiyel müşteri segmentleri oluşturacağız.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2e3c9ecbae0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Veri Bilimi Projelerinde CRISP-DM Metodolojisi]]></title>
            <link>https://medium.com/@yasinnsariyildiz/veri-bilimi-projelerinde-crisp-dm-d%C3%B6ng%C3%BCs%C3%BC-1bf260dcbeb5?source=rss-d74f7e44bb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bf260dcbeb5</guid>
            <dc:creator><![CDATA[Yasin Sarıyıldız]]></dc:creator>
            <pubDate>Wed, 18 Dec 2024 09:11:01 GMT</pubDate>
            <atom:updated>2024-12-18T10:04:49.349Z</atom:updated>
            <content:encoded><![CDATA[<p>CRISP-DM (Cross-Industry Standard Process for Data Mining), veri odaklı<br>sektörel ve akademik ve çalışmalarda iş hedeflerine ulaşmak için esnek, kolay uyarlanabilen ve döngüsel süreç içeren bir metodolojidir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8BCqnp7QEkDDTezE.png" /><figcaption>CRISP-DM</figcaption></figure><p>CRISP-DM döngüsü altı adımdan oluşmaktadır.</p><p><strong>İşi ve Problemi Anlama(Business Understanding) :</strong> İlk aşamada problemin ne olduğu tespit edilir ve neden bu projenin yapılması gerektiği ile ilgili fikirler tartışılır. Daha sonra proje hedefi belirlenerek bu hedefe nasıl ulaşılacağı, proje için hangi verilerin gerekli olduğu ve hangi yöntemlerin uygulanacağı kararlaştırılır ve raporlanır.</p><p><strong>Veriyi Anlama (Data Understanding):</strong> Projede kullanılacak verilerin toplanması için gerekli olan sistemler hazırlanır. Veriler toplanmaya başlandıktan sonra verinin kalitesi ve doğruluğu kontrol edilir. Veri kalitesinde bir problem gözlemlenmiyorsa toplanan veriler üzerinde keşifsel ve istatistiksel analizler yapılarak veri anlamlandırılır.</p><p><strong>Veriyi Hazırlama (Data Preparation):</strong> Veriler, makine öğrenmesi algoritmalarının daha sağlıklı bir biçimde uygulanabilmesi için bazı dönüşüm ve önişleme süreçlerine dahil edilir. Örneğin, eksik veya aykırı gözlemlerin silinmesi, değişken seçimi, normalizasyon, encoding işlemleri ile veriler modellenmeye hazır hale getirilir.</p><p><strong>Modelleme (Modeling):</strong> Modellemede öncelikle eğitim yöntemine karar verilir. Örneğin, k- fold çapraz doğrulama veya sınama seti yöntemleri modelin eğitim ve testi için kullanılabilir. Daha sonra verisetinin yapısına uygun, modellemede kullanılacak algoritmalar belirlenir ve kullanılan algoritmaların hiperparametreleri de modelleme öncesinde ayarlanabilir. Böylece algoritmalar modellemeye hazır hale getirilir. Son olarak algoritmalar hazırlanan veriseti ile eğitilir.</p><p><strong>Model Değerlendirme (Evaluation):</strong> Model eğitildikten sonra test verisetiyle test edilerek ne kadar başarılı veya başarısız olduğu değerlendirilir. Sınıflandırma, regresyon ve kümeleme yöntemleri için farklı farklı değerlendirme metrikleri bulunmaktadır. Bu aşamada verinin yapısına göre bir tek metrik yerine birçok metriği göz önünde bulundurmak modelin doğru bir şekilde değerlendirilmesi için oldukça önemlidir.</p><p><strong>Modelin Dağıtımı (Deployment):</strong> Değerlendirme aşamasında başarılı olarak belirlenen model veya modeller canlı sistemlere entegre edilir. Örneğin, model bir website veya mobil uygulamaya entegre edilerek anlık model tahmini yapılır. Bu aşamada modeller farklı kullanıcı gruplarına gösterilir ve modellerin canlı ortamdaki başarıları A/B testi ile test edilir.</p><p>Burada elde edilen sonuçlara göre model yeniden değerlendirilir ve sonuçlar başarısız olursa model yeniden eğitilebilir. Böylece birbirini sürekli besleyen bir veri bilimi ve makine öğrenmesi döngüsü elde edilmiş olur.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bf260dcbeb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Ads Data Manager ile BigQuery’den Google Ads’e First Party Data(1PD) Kitlesinin Aktarılması]]></title>
            <link>https://medium.com/@yasinnsariyildiz/google-ads-data-manager-ile-bigqueryden-google-ads-e-first-party-data-1pd-kitlesinin-aktar%C4%B1lmas%C4%B1-c94d5d705a10?source=rss-d74f7e44bb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/c94d5d705a10</guid>
            <dc:creator><![CDATA[Yasin Sarıyıldız]]></dc:creator>
            <pubDate>Mon, 16 Dec 2024 16:29:05 GMT</pubDate>
            <atom:updated>2024-12-16T16:31:37.567Z</atom:updated>
            <content:encoded><![CDATA[<p>Veri analitiği süreçlerinde BigQuery’de yer alan GA4 veya CRM verilerini kullanarak modeller geliştiriyor ve<em> müşteri segmentleri</em> oluşturuyoruz. Günün sonunda daha efektif ve hedef odaklı kampanyalar oluşturabilmek için bu segmentleri yani <em>First Party Data(1PD)</em> kitlelerini Google Ads’e aktarıp kampanyalara import etmemiz gerekiyor. Bu noktada <em>Google Ads Data Manager</em>’da yer alan <em>BigQuery Connection</em> özelliğini kullanmak işimizi oldukça hızlandırıyor.</p><p>Öncelikle Google Ads’de <em>Tools</em> bölümünden <em>Data Manager</em>’a ve sonrasında açılan sayfada <em>Connect Product</em> butonuna tıklıyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-RxurfRHiALxpBUGEuSEIQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*esvxMor9IWKdPRsiQ3MzlQ.png" /></figure><p>Açılan Pop-up’da Google Ads’e bağlanacak product’ların listesi yer alıyor. Bu listeden <em>Google BigQuery</em>’e tıklıyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k6IZKPchXddlHyxBM8Ying.png" /></figure><p>Sonrasında açılan sayfada <em>Data Source</em> kısmında<em> Direct Connection</em>’ı seçiyoruz. <em>Use Case</em> kısmında ise yükleyeceğimiz tablonun formatını seçeceğiz. Ben 1PD kitlesi yükleyeceğim için <em>Audiences</em>’ı seçiyorum ama conversion yüklemeke isteyenler Conversions seçeneğini işaretleyebilir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IbT-ElFsIhINKc1M95sR6w.png" /></figure><p>Oluşturduğumuz kitleleri <em>User ID</em> veya <em>Device ID</em> veya<em> Email/Telefon</em> bilgilerine göre üç farklı şekilde hedefleyebiliriz. Bizim tablomuzda bu bilgilerden hangisi mevcutsa onu seçerek ilerliyoruz. Tablomuzda müşterilerin user id bilgisi yer aldığı için User IDs seçeneğini işaretledik.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KMfKTTOsT40x-esGq2Jltw.png" /></figure><p>1PD kitlemiz ile ilgili genel bilgileri belirttikten sonra BigQuery ve Google Ads bağlantısının yapıldığı aşamaya geçiyoruz. Bu aşamada 1PD kitlemizin yer aldığı <em>BigQuery Projesi, Dataseti ve Tablosu</em> ile ilgili bilgileri ilgili alanlara giriyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7SbyYL_BO28EM4ZqTpMgvQ.png" /></figure><p>Google Ads’in BigQuery tablosundan doğru sütunu seçebilmesi için maping işlemi yapmamız gerekiyor. <em>Google field</em>, Google Ads kampanyasında kullanacağımız kitle formatını belirtiyor. <em>Data source field</em> ise bu formatın bizim tablomuzda hangi sütunda yer aldığı yer alıyor. Biz User ID kullanarak hedefleme yapacağımız için Google field → user_id seçiyoruz. Bizim tablomuzda user id’lerin yer aldığı sütun ise customer_user_id. Bu yüzden Data source field → customer_user_id olarak seçiyoruz.</p><p>Device ID’leri kullanarak hedefleme yapmak istersek; Google field olarak device_id ve Data source field olarak Device ID’lerin yer aldığı sütunu seçecektik.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5RfZLpp4PtkBsn4VQxQRSA.png" /></figure><p>Tüm bilgileri girdikten sonra en son bir overview ekranı açılack. Orada bilgileri kontrol edip istersek düzenlemeler yapabiliriz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*smMiBftEsM82JsWPS_vBRQ.png" /></figure><p>Örneğin; <em>Edit Schedule</em>’a tıklayarak bu kitlelerin <em>günlük veya haftalık</em> olarak ne zaman <em>update</em> edileceğini belirleyebiliriz. Bu ayarlama ile birlikte BigQuery tablosunu güncellediğimizde Google Ads kitlesi de otomatik olarak güncellenmiş olacak. Yeniden bir connection kurmamıza gerek kalmayacak.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oUOHoIsA8sr5YwoxWiebzw.png" /></figure><p>Schedule kısmını ayarlayıp overview sayfasında <em>Finish</em> butonuna tıklayınca <em>Google Ads ve BigQuery connection’ı</em> tamamlanmış olacak.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CNhIWA0-dScNcZ6aVCfaZA.png" /></figure><p>Data Manager sayfasını açtığımızda artık BigQuery ile bağlı olan tablolarımızı görebiliyoruz. Son adımda <em>segment</em> oluşturarak bu kitleleri Google Ads kampanyalarında kullanıma hazır hale getirebiliriz. Bunun için en sağda bulunan <em>‘+Add Audience Segment’</em> butonuna tıklıyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HrNSYyK87lNKl4i75R3W6g.png" /></figure><p>Açılan sayfada <em>Segment Name</em> alanında segmentimize bir isim veriyoruz ve sonrasında <em>‘Save and Continue’</em> butonuna tıklıyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qovB-rKVIXkYnLqVPBmteA.png" /></figure><p>Sonrasında ekranda segmentimizin oluştuğuna dair bir bilgilendirme yazısı çıkıyor. Done butonuna tıkladıktan sonra yeniden Data Manager anasayfasına dönüyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVOUEH5YEQOx-tzvvQXW4A.png" /></figure><p>Ve artık BigQuery’deki 1PD kitlemiz Google Ads kampanyalarında kullanıma hazır 🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WmC5KoxSOuamXeM8XaHFvQ.png" /></figure><p>Sonraki yazılarımda dijital pazarlama metriklerinin BigQuery SQL ile nasıl hesaplanacağını anlatacağım.</p><p>Görüşmek üzere</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*r-aACz2nqjThqr0Qc1p3Nw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c94d5d705a10" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BigQuery’de SQL ve Python’ı Beraber Kullanmak = Python Notebook]]></title>
            <link>https://medium.com/@yasinnsariyildiz/bigqueryde-sql-ve-python-%C4%B1-beraber-kullanmak-python-notebook-89927c764de2?source=rss-d74f7e44bb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/89927c764de2</guid>
            <dc:creator><![CDATA[Yasin Sarıyıldız]]></dc:creator>
            <pubDate>Wed, 11 Dec 2024 10:01:38 GMT</pubDate>
            <atom:updated>2024-12-15T14:32:21.631Z</atom:updated>
            <content:encoded><![CDATA[<p>BigQuery’de SQL ile veri analizi, veri önişleme, ETL gibi süreçleri oldukça hızlı ve efektif bir şekilde yapabiliyoruz. Ancak sonrasında yapılması planlanan projeye bağlı olarak makine öğrenmesi modellerini kullanmamız gerekebiliyor ve SQL dili (doğal olarak) yetersiz kalıyor. Bu noktada BigQuery’de yer alan Python Notebook ile hem SQL’i hem de Python’ı aynı ortamda beraber kullanabiliriz.</p><p>Bunu yapabilmek için BigQuery Studio’da sekmelerde yer alan kulakçığa tıklayarak açılan listeden Python Notebook’u seçiyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XYwijzCzMDQHqonM7gZTqA.png" /></figure><p>Açılan notebook’da sol üstte yer alan Code butonuna tıklayarak kodları yazacağımız hücreleri oluşturuyoruz. Örneğin; BigQuery’de yer alan bir tabloyu notebook’a çekip sonrasında Python ile analiz yapmak istiyoruz. Bunun için ilk olarak gerekli kütüphaneleri notebook’a import etmeliyiz. SQL sorgularını çalıştırabilmek için Google Cloud’dan bigquery ve Client kütüphanelerini import edeceğiz. Python’da ise veri analizi ve makine öğrenmesi çalışmalarını yapabilmek için numpy, pandas, scikit learn, seaborn gibi kütüphaneleri import edebiliriz.</p><pre># Bigquery SQL Bağlantı Kütüphaneleri<br>from google.cloud import bigquery<br>from google.cloud.bigquery import Client<br><br># Python Veri Analizi ve Makine Öğrenmesi Kütüphaneleri<br>import pandas as pd<br>import numpy as np<br>import seaborn as sns<br>import sklearn</pre><p>Kütüphaneleri kurduktan sonra SQL sorgularımızı yazabiliriz. Notebook’da SQL sorgularını çalıştırabilmek için yazmak istediğimiz sorguları üç tırnak içinde yazıp bir değişkene eşitliyoruz. Sonrasında Client aracılığıyla bigquery ile bağlantı kurup verilerin notebook ortamında çekilmesini sağlıyoruz. Sonrasında bu verileri Python’da kullanabilmek için dataframe yapısına çeviriyoruz.</p><pre>query = &quot;&quot;&quot;<br>SELECT<br>        *<br>    FROM<br>         `ecommerce-442714.ecommerce_dataset.sales`<br>&quot;&quot;&quot;<br>query_job = client.query(query)<br>df = query_job.to_dataframe()<br>df</pre><p>Kodun çıktısında oluşan tablo örneği;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A5SzXbahIykArBEkrtXupw.png" /></figure><p>Bu işlemleri hızlandırmak için Python’da kendimizin tanımladığı bir fonksiyon oluşturup bu işlemleri tek bir fonksiyon ile yapabiliriz. Bu fonksiyona SQL query’sini eşitlediğimiz değişken adını input olarak girmemiz gerekiyor. Output olan tabloyu da yine bir değişkene eşitleyerek elde ettiğimiz verileri aynı şekilde dataframe olarak kullanabiliriz.</p><pre>def get_data(query):<br>  query_job = client.query(query)<br>  df = query_job.to_dataframe()<br>  return df<br><br># Fonksiyonun kullanım örneği<br>df = get_data(query)<br>df</pre><p>Artık verileri dataframe formatına dönüştürdüğümüze göre Python’daki veri analiz ve makine öğrenmesi modellerinde kullanabiliriz. Pandas ve numpy kütüphaneleri ile veri analizlerinizi genişletebilir, seaborn ve matplotlib ile görselleştirmeler ekleyebilir scipy ile istatistiksel analizler yapabilir ve scikit learn, tensorflow ile makine öğrenmesi ve AI projeleri geliştirebilirsiniz. Bu konuyla ilgili detaylı örnekleri bir sonraki yazılarımda paylaşacağım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/0*-tnY5ZvsAnxokaJQ.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89927c764de2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dijital Marketing’de Customer Churn Tahmini Vol.1]]></title>
            <link>https://medium.com/@yasinnsariyildiz/dijital-marketingde-customer-churn-tahmini-vol-1-bd964ffabb0f?source=rss-d74f7e44bb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd964ffabb0f</guid>
            <dc:creator><![CDATA[Yasin Sarıyıldız]]></dc:creator>
            <pubDate>Fri, 13 Sep 2024 14:21:33 GMT</pubDate>
            <atom:updated>2024-09-13T14:21:33.069Z</atom:updated>
            <content:encoded><![CDATA[<p>E-ticaretin büyümesiyle birlikte sektördeki rekabet ortamı da artmış ve bu durum bazı şirketlerin müşteri kaybına neden olmuştur. Ürün, hizmet ve fiyatlardan memnun olmayan müşteriler alışveriş yaptıkları mevcut e-ticaret şirketlerinden alışveriş yapmayı bırakarak rakip şirketlerden alışveriş yapmaya başlamışlardır. Bu durum şirketler için müşteri kaybı (customer loss) anlamına gelmektedir.</p><p>Müşteri kaybı, aynı zamanda müşteri terki (customer churn) olarak da adlandırılmaktadır. Müşteri kaybının artması sadık (loyal) müşteri sayısının da azalmasına neden olmaktadır. Kaybedilen bir müşterinin yerini doldurmak amacıyla yeni bir müşteri kazanmaya çalışmanın maliyeti, mevcut bir müşteriyi elde tutmanın maliyetinden 5- 10 kat daha fazladır. Çünkü şirketler yeni müşteri kazanımı için yapılacak olan reklam ve dijital pazarlama çalışmalarına ciddi bir bütçe ayırmak zorunda kalmaktadır.</p><p>Aynı zamanda yüksek sepet tutarına sahip kullanıcıların kaybedilmesi şirketlere ciddi bir ciro ve kar kaybı yaşatmaktadır. Müşteri kaybının artması ve bu müşterilerin rakip şirketlerden alışveriş yapmaya başlaması şirketlerin kendi sektörlerindeki pazar paylarında düşüşe neden olabilir. Müşteri kaybının şirketlere negatif etkisi sadece maddi durumlar ile sınırlı değildir. Kayıplardan dolayı oluşan direkt maddi zararların haricinde yeni müşterilerin kazanımı için ekstra olarak yapılan çalışmalarda zaman ve işgücü harcanması şirketlere dolaylı yoldan maliyet oluşturmaktadır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3U-pwU1gUrn_BLYY__1YA.png" /></figure><p>Kaybedilen müşterilerin çevresindeki kişilere şirket ile yaşadıkları olumsuz deneyimleri aktarması veya dijital mecralarda bu konu ile ilgili paylaşımlar yapması şirketin imajına ve marka değerine zarar verebilir. Bu durum müşteri kayıplarını artmasına ve aynı zamanda kazanılma potansiyeli olan müşterilerin de şirkete önyargıyla yaklaşmasına neden olabilir. Bu durumda potansiyel müşterilerin gelecekte şirkete kazandırılma ihtimalleri de oldukça azalmış olur.</p><p>Şirketler müşteri kaybındaki artış ve azalışları belirli bir dönemdeki müşteri kayıp oranını ölçerek takip etmektedir. Müşteri kayıp oranı (customer churn rate), dönem boyunca kaybedilen müşteri sayısının dönem başındaki müşteri sayısına oranlanması ile hesaplanır. Elde edilen müşteri kayıp oranı firmaların müşteri kaybı konusunda bulunduğu durumu gösteren önemli bir metriktir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*44lXUyp-AKi4dSCD8Eu1sg.png" /></figure><p>E-ticaret sektöründe telekomünikasyon sektöründe olduğu gibi müşterilerle belirli bir süreyi kapsayan kontrat veya üyelik durumu bulunmamaktadır. Şirketler, kendi belirledikleri zaman aralıklarını baz alarak o müşterilerin kaybedilip kaybedilmediğine karar verirler. Bu zaman aralıkları 1 hafta ile birkaç yıl arasında değişebilir. Bu periyot içerisinde alışveriş yapmayan müşteriler kaybedilen müşteri olarak sınıflandırılır.</p><p>Müşteri kayıp oranının az olması müşterilerin o şirkete olan yüksek sadakatini ve memnuniyetini göstermektedir. Şirketlerin değeri aktif müşteri sayısı ile ölçülmektedir. Müşteri kayıp oranı düşük olan şirketler, sürekli alışveriş yapan sadık bir müşteri kitlesine sahip oldukları için yatırımcılar tarafından daha çok yatırım alabilir ve marka değerlerini daha çok artırabilirler. Böylelikle bulundukları sektördeki rekabet avantajını ve üstünlüğünü ellerinde tutabilirler. Müşteri kayıp oranı yüksek olan şirketlerde ise müşteri ilişkileri ve memnuniyeti ile ilgili sorunlar olduğu ve bunlara çözüm üretilemediği söylenebilmektedir.</p><p>Düşük hizmet kalitesi, ürün fiyatı, ürün çeşitliliğinin azlığı, yavaş ve hatalı ürün teslimi, yetersiz müşteri hizmetleri, sipariş sürecindeki zorluklar, güncel olmayan ürün gamı, kötü website tasarımı ve yazılım hataları gibi sebepler müşteri kaybına neden olabilir. Müşteri kaybının nedenlerini anlamak, şirketlerin etkili elde tutma stratejileri geliştirmesi ve müşterilerle uzun vadeli ilişkiler sürdürmesi için oldukça önemlidir.</p><p>Şirketler tarafından müşteri kaybını en aza indirebilmek için bazı yöntemler uygulanmaktadır. Örneğin, müşterilerin website ve mobil uygulamadaki dijital davranışlarını analiz ederek bir satın alma hunisi oluşturmak ve müşterilerin bu huniyi terk ettiği adımları görmek müşteri kaybının sebeplerinin tespit edilip önlenmesi için bir içgörü oluşturabilir. Bunlara ek olarak; müşteri deneyimini artırmak, müşteri geri bildirimlerini dikkate almak, doğru fiyatlandırma politikası uygulamak da müşteri kaybını azaltabilir.</p><p>Tüm bunlara rağmen müşteriler şirketten ürün ve hizmet almaktan vazgeçebilir ve şirketi terk etmek isteyebilir. Bu yüzden, kaybedilme ihtimali yüksek olan müşterilerin önceden tahmin edilmesi ve bu müşterilerin kaybedilmemesi için elde tutma stratejileri geliştirilmesi şirketlerin karlılığı açısından büyük bir önem taşımaktadır.</p><p>Kaybedilme ihtimali yüksek olan müşterilerin önceden tahmin edilmesi için veri bilimi ve makine öğrenmesi algoritmaları kullanılarak modeller geliştirilebilir ve bu sayede müşteri kayıpları en aza indirilebilir. Bir sonraki yazımda bunun için nasıl bir yol izleneceğinden ve nasıl customer churn modellerinin geliştirileceğinden bahsedeceğim.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd964ffabb0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Science Projects in Digital Marketing]]></title>
            <link>https://medium.com/@yasinnsariyildiz/data-science-projects-in-digital-marketing-4d88ee336673?source=rss-d74f7e44bb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d88ee336673</guid>
            <dc:creator><![CDATA[Yasin Sarıyıldız]]></dc:creator>
            <pubDate>Wed, 11 Sep 2024 12:12:53 GMT</pubDate>
            <atom:updated>2024-09-11T12:12:53.201Z</atom:updated>
            <content:encoded><![CDATA[<p>The rapid development of artificial intelligence, data science, machine learning and big data has enabled the use of these fields in digital marketing. Using machine learning models, many future digital and transaction-based behaviors of customers can be predicted and audiences can be created according to these predictions. The growth of brands can be accelerated by using these audiences in digital marketing campaigns and targeting. At the same time, a more efficient and profitable digital marketing process can be managed by optimizing ROI and ROAS metrics.</p><p>In this article, I will briefly talk about the most important projects that can be used in the field of digital marketing: Customer Churn Prediction Model, Purchase Propensity Model, LTV Prediction Model, Customer segmentation, Recommendation Systems and Market Basket Analysis. Since it is a general introduction article, I did not include technical details. In the next articles of this article series, I will explain each model in technical and analytical detail. In addition to these projects, I will also touch upon the Marketing Response Model and Uplift Model projects where direct ads data is used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wTtxskDmSUn7rqMX" /></figure><p><strong>Customer Churn Prediction Model</strong></p><p>When a customer stops purchasing from a brand, it is called customer churn. Since acquisition cost &gt; retention cost, brands want to avoid losing customers as much as possible. Therefore, a machine learning model is developed using past event, session and transaction data and it is predicted whether customers will churn in the next period. Customers who are likely to be churned are targeted on ads platforms and are ensured to be retained. As a result, the churn rate decreases and the retention rate increases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J-R0VESNCJPTDnQt" /></figure><p><strong>Purchase Propensity Model</strong></p><p>One of the most important problems of companies is that the number of first time purchasers does not increase. Lack of new shoppers means the company’s growth has stopped. Purchase Propensity Model is used to increase the growth of the company and the number of first time purchasers. This model is basically a model that predicts the probability of users making purchases in the second session based on event data on web and app platforms in their first session. By targeting users who are most likely to purchase, the number of first-time purchasers and the company’s growth can be increased.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*YL3EZY73UpTC1vK5x9T_3Q.png" /><figcaption>Image source: jelwix.com</figcaption></figure><p><strong>LTV Prediction Model</strong></p><p>Customers’ past LTV values can be used in analysis and segmentation, but the most important thing is to predict future LTV values and develop strategies based on these estimates. For this project, clean transaction data in GA4 or brand CRM/Database systems is needed. A dataset is created based on user id, using the user id, transaction id, product id, product quantity and product price information in each transaction performed by customers, and a regression model is established using this dataset. In order to prevent the model from being affected by a specific seasonal effect, at least a 1-year lookback and a 1-year lookahead window are used and the model is trained with the sliding windows method. As a result of model predictions, users’ LTV values in the next period are obtained. New strategies can be developed by using the results of LTV prediction and Churn prediction models together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1PMiXZH_01pTA75wHbKbg.png" /></figure><p><strong>Customer Segmentation</strong></p><p>In addition to directly creating audiences for a specific purpose, we can create audiences by dividing our customers into general segments using RFM analysis and machine learning clustering methods. With RFM analysis, segments can be created using customers’ recency, monetary and frequency information. For a more advanced customer segmentation, a dataset is created by adding customers’ transaction, event, session and CRM information to these RFM metrics. Customer segments are created by training this dataset with machine learning clustering algorithms such as k-means. Separate campaigns can be created for each segment based on information such as average order value (AOV), RFM, gender and age of each segment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1Jvq4f3W4uNi6CsD" /></figure><p><strong>Recommendation Systems</strong></p><p>Recommendation systems are systems that specifically offer products or content that users are likely to like and buy. Many large technology companies in the world increase their revenues significantly thanks to recommendation systems. When creating recommendation systems models, methods such as content filtering, collaborative filtering or matrix factorization are used. As a result of these models, products that the user is most likely to like are obtained. These products will be presented to users on certain pages on the website, on the cart page, and can also be used in digital advertisements to encourage users to shop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ua1-yTzDrA81jNo5" /><figcaption>Image source: <a href="https://www.mdpi.com/2076-3417/10/16/5510">https://www.mdpi.com/2076-3417/10/16/5510</a></figcaption></figure><p><strong>Market Basket Analysis</strong></p><p>With market basket analysis, the purchased products in each transaction are analyzed to determine which product pairs have an association relationship. If it is known which products are frequently purchased together during shopping, digital marketing activities can be carried out for these products and sales / income can be increased. With market basket analysis, product associations that no one would notice can be detected. One of the most important examples of this is provided by Walmart. They found that diapers and beer were purchased together at a very high rate during shopping, and by encouraging those who bought one of these products to buy the other product, they increased their sales considerably. Product pairs obtained as a result of market basket analysis can be sold together as a product bundle on e-commerce sites or can also be used in digital advertisements.</p><p>With the projects mentioned above, you can use your customers’ past data to predict their future preferences and shopping habits. According to these predictions, you can target your customers on platforms such as Google Ads, Meta Ads, Tiktok Ads. You can also communicate your digital marketing campaigns and strategies to your customers with SMS and e-mail marketing, pop-ups or push notifications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*65zI-i4pUJr4w0Kx" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d88ee336673" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Veri Bilimi ve Makine Öğrenmesinde Dengesiz Veriseti Problemi Vol.1]]></title>
            <link>https://medium.com/@yasinnsariyildiz/veri-bilimi-ve-makine-%C3%B6%C4%9Frenmesinde-dengesiz-veriseti-problemi-vol-1-8f3023e33e48?source=rss-d74f7e44bb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f3023e33e48</guid>
            <dc:creator><![CDATA[Yasin Sarıyıldız]]></dc:creator>
            <pubDate>Thu, 15 Aug 2024 17:54:01 GMT</pubDate>
            <atom:updated>2024-08-15T18:09:06.749Z</atom:updated>
            <content:encoded><![CDATA[<p>Dengesiz veriseti(Imbalanced Dataset) problemi, sınıflandırma modellemesi için kullanılan bir verisetinde hedef değişkene ait sınıf frekanslarının dengesiz bir oranda dağılması ile oluşmaktadır. Örneğin; hedef değişkenin sahip olduğu sınıf dağılım oranlarının 99:1, 90:10, 80:20, 85:15 olması gibi durumlar dengesiz verisetlerine örnek olarak gösterilebilir. Müşteri kayıp tahmini, spam e-posta tahmini, dolandırıcılık tahmini ve kanser tahmini gibi modellerde dengesiz veriseti problemine oldukça sık rastlanır.</p><p>Dengesiz verisetlerinde yüksek frekansa sahip olan sınıf çoğunluk(majority) sınıfı, düşük frekansa sahip olan sınıf ise azınlık(minority) sınıfı olarak adlandırılır. Azınlık sınıfı daha düşük sayıda gözleme sahip olduğu için oluşturulan model azınlık sınıfının özniteliklerindeki örüntüyü yakalamakta zorlanır. Bu da tahmin modelinin azınlık sınıfına ait verileri yanlış sınıflandırmasına yol açabilir. Model azınlık sınıfı verilerini yüksek oranda doğru tahmin edemese bile çoğunluk sınıfının hem öğrenme performansı hem de frekansı yüksek olduğu için modelin accuracy oranı da yüksek olacaktır. Bu yüzden dengesiz verisetleri ile kurulan modellerde yalnızca Accuracy oranına göre değerlendirme yapmak oldukça yanıltıcı olabilir. Bu sorundan kaçınmak için Recall, F1 ve AUC oranlarını da göz önünde bulundurmak modeli daha objektif bir şekilde değerlendirme imkânı sunacaktır.</p><p>Veri biliminde dengesiz veriseti problemini çözmek için önerilen bazı yöntemler vardır. Bunlardan bazıları; oversampling, undersampling ve maliyet duyarlı öğrenmedir. Bu yazıda bu yöntemlere giriş yapacağız ve bir sonraki yazıda her birini daha detaylı olarak ele alacağız.</p><p><strong>Oversampling</strong></p><p>Oversampling, sınıf dengesizliği sorununu ortadan kaldırmak için azınlık sınıf verilerini kullanarak sentetik verilerin üretildiği bir yöntemdir. Verisetindeki azınlık sınıfı ve çoğunluk sınıfı oranları dengeli bir hale gelene kadar yeni azınlık sınıfı verileri üretilir.</p><p>Böylece modelin azınlık sınıfı verileri için de başarılı tahminler yapması amaçlanır. Bu yöntemde, verisetindeki diğer verilere benzer veriler üretildiği için makine öğrenmesi modelleri uygulandığında overfitting riski yaşanabilir, bu konuda dikkatli olunması gerekmektedir. En popüler Oversampling yöntemleri şunlardır: Random Oversampling, SMOTE, BorderLine SMOTE, ADASYN</p><p>Aşağıdaki şekilde bir verisetinde Oversampling yöntemi uygulanmadan önceki ve sonraki durumlar gösterilmiştir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3voOaEGQPKm-v_-8AqJ3mA.png" /><figcaption>Oversampling Yöntemi</figcaption></figure><p><strong>Undersampling</strong></p><p>Undersampling, Oversampling yönteminin aksine çoğunluk sınıfının verilerini azaltarak verisetindeki sınıf dengesizliği sorununu çözer. Böylece makine öğrenmesi modelinin her iki sınıfı da eşit derecede öğrenmesini ve başarılı tahminler üretmesini sağlar. En önemlı Undersampling yöntemleri şunlardır: Random Undersampling, Tomek Links</p><p>Küçük verisetlerinde Undersampling yöntemini kullanmak risklidir. Çünkü Undersampling sonrasında verisetinde her iki sınıfın da verileri az bulunacağından dolayı modelin genel performansının düşme ihtimali de bulunuyor. O yüzden undersampling uygulanacak verisetinin büyük bir veriseti olması gerekmektedir. Çoğu zaman Undersampling yöntemi tek başına kullanılmaz ve Oversampling ile birleştirilerek uygulanır. Bunun en önemli örneklerinden biri SMOTE-Tomek Links algoritmasıdır. Bir sonraki yazıda bu algoritmanın çalışma sistemini detaylı olarak anlatacağım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/0*uMesV-jnoIex90sC" /></figure><p><strong>Maliyet duyarlı Öğrenme</strong></p><p>Maliyet duyarlı öğrenme, farklı sınıflandırma hatalarının farklı maliyetlere sahip olduğu durumlarda hatalı tahminlere farklı ağırlıklar(maliyetler) vererek en düşük toplam maliyetle yani en düşük hata ile sınıflandırma yapmayı amaçlayan bir öğrenme türüdür. Maliyet duyarlı öğrenme, oversampling ve undersampling yöntemlerinden farklı olarak veriseti üzerinde bir değişikliğe neden olmaz, veriseti aynı boyutunda kalmaya devam ederken yanlış sınıflandırma maliyetleri değiştirilir.</p><p>Dengesiz verisetlerinin genelinde pozitif sınıf, azınlık sınıfını; negatif sınıf ise çoğunluk sınıfını temsil etmektedir ve çoğunluk sınıf frekansının azınlık sınıf frekansına oranı, dengesizlik yeniden ölçeklendirme oranı (imbalance rescale ratio) (ri+,-) olarak adlandırılmaktadır (Liu ve Zhou, 2006).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*om9LfSFGNOvAg9VObiIRyQ.png" /><figcaption>imbalance rescale ratio</figcaption></figure><p>Dengesiz bir veriseti ile kurulan maliyet duyarlı öğrenme modellerinde çoğunluk sınıfının yanlış sınıflandırılma maliyetine (ağırlığına) 1 (bir) olarak sabit bir değer atanırken; azınlık sınıfının yanlış sınıflandırılma maliyetine (ağırlığına) ise dengesizlik yeniden ölçeklendirme oranına (ri +,-) karşılık gelen değer atanır.</p><p>Bu ağırlıklandırmalar ile her bir sınıfın yanlış sınıflandırılma maliyeti, sınıf frekansları ile ters orantılı olur ve modelde azınlık sınıfının yanlış tahmin edilmesine çoğunluk sınıfının yanlış tahmin edilmesinden daha yüksek maliyet(hata değeri) verilir. Böylece model azınlık sınıfını da çoğunluk sınıfına yakın seviyede öğrenmeye çalışacağı için algoritmik olarak dengeli bir öğrenme modeli oluşacaktır.</p><p>Günümüzde sıklıkla kullanılan Scikit-learn ve Xgboost vb. makine öğrenmesi kütüphaneleri maliyet duyarlı öğrenme yönteminin uygulanmasını kolaylaştırmıştır. Bu kütüphanelerdeki class_weight veya scale_pos_weight gibi hiperparametreler ile sınıfların yanlış sınıflandırılma maliyetleri için farklı ağırlıklar tanımlanabilmektedir.</p><p>Bu yazımda dengesiz veriseti sorununun çözümü konusuna bir giriş yaptık. Bir sonraki yazımda SMOTE, SMOTE-Tomek Links ve Maliyet Duyarlı Öğrenme yöntemlerini detaylı bir şekilde ele alarak dengesiz veriseti problemini daha farklı bakış açıları ile çözmeyi öğreneceğiz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LjQp0X8IH3BabKhT.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f3023e33e48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[E-Commerce Customer Churn Prediction With Boosting And Oversampling]]></title>
            <link>https://medium.com/@yasinnsariyildiz/e-commerce-customer-churn-prediction-with-boosting-and-oversampling-9bd4c52a6b44?source=rss-d74f7e44bb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bd4c52a6b44</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[churn-prediction]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[churn]]></category>
            <category><![CDATA[digital-marketing]]></category>
            <dc:creator><![CDATA[Yasin Sarıyıldız]]></dc:creator>
            <pubDate>Fri, 12 Apr 2024 23:05:48 GMT</pubDate>
            <atom:updated>2024-04-12T23:58:34.621Z</atom:updated>
            <content:encoded><![CDATA[<h3>E-Commerce Customer Churn Prediction With Boosting And Oversampling | Symposium Paper</h3><p>In order to graduate from the Data Science Thesis Master’s Program, I had to publish a paper at a symposium after completing the thesis. Therefore, I published a paper regarding my thesis topic at the ‘2nd International Symposium Series On Graduate Researches’ organized by Dokuz Eylul University, the university where I studied.</p><p>In the paper I published, I developed customer churn prediction models using Boosting and Oversampling methods and I achieved quite good results in these models. The citation and full text of the paper I published are available below.</p><blockquote><strong>My Paper Citation:</strong> Sarıyıldız, Y., &amp; Tezel, B. T., (2023). E-Commerce Customer Churn Prediction With Boosting And Oversampling . 2nd INTERNATIONAL SYMPOSIUM SERIES ON GRADUATE RESEARCHES (pp.172–176). Izmir, Turkey. <a href="https://drive.google.com/file/d/1i4rKvLMX8x5b4SMFliBluXzOI3T5gWUd/view">Click Here For Full Proceeding Book</a></blockquote><p><strong>ABSTRACT</strong></p><p>Customer churn is an undesirable situation for e-commerce companies as it causes decreases in their revenues. Additionally, the money spent on acquiring new customers instead of lost ones is more costly than retaining existing customers. Therefore, it was aimed to develop a machine learning model to predict customers who will churn. A dataset containing users’ transaction, online and demographic information was used to develop this model. Before modeling, missing value removal, outlier removal, standard scaling and one hot encoding were applied to the dataset to clean it and make it suitable for modeling. With the hold out method, the dataset was splitted into 70% train and 30% test set. Since the ratio of the churn class in this dataset was 16.8%, that is, the dataset was unbalanced, the ratio of the churn class in the dataset was increased by using the SMOTE oversampling method. Using SMOTE, 4 different datasets were obtained by increasing the ratio of the churn class in the dataset to 30%, 40%, 50% and 60%, respectively.</p><p>A total of 5 customer churn prediction models were created using the GBM algorithm with four oversampling datasets and one non oversampling dataset. Among these models, the model established with a 60% oversampled dataset was chosen as the model that best predicts the customers who will churn. This model has approximately 91% accuracy, 74% F1-score and 72% Recall rates. By using this developed customer churn prediction model, users who are likely to churn are determined and retention campaigns can be developed to retain these customers. These customers can be encouraged to shop by offering discounts through channels such as advertising platforms, SMS, e-mail and push notification. Thus, the churn rate of customers decreases and the retention rate increases.</p><p><strong>1.INTRODUCTION</strong></p><p>With the growth of e-commerce, the competitive environment has increased and this has led to an increase in customer churns for some companies. Customer churn is when a customer stops buying from a company. Companies assess customer churn by looking at the churn rate. Customer acquisition costs more than customer retention(Morgan, 2009). Therefore, the aim of this study is to develop machine learning that predicts customers who will churn and to suggest retention strategies to retain these customers.</p><p>Raeisi and Sajedi (2020), made customer churn prediction with a dataset containing data such as location, order and seller information related to the e-commerce sector. They used algorithms such as knn, naive bayes, decision tree, gbm and random forests in these predictions and the best accuracy percentage was obtained in the gradient boosted trees algorithm with 86.90%.</p><p>Fridrich and Dostal (2022), created a dataset containing recency, monetary, frequency, product and session information of customers and developed an e-commerce churn prediction model. They used linear regression, support vector machines and gradient boosted trees algorithms in this model and the GBM model was the most successful model according to accuracy and f1 score metrics.</p><p>Wu and Meng (2016), balanced the dataset, which had an imbalance of 7.5:1, using SMOTE. Then they trained the model with Adaboost, one of the boosting methods. This model exceeded 80% in each of the accuracy, f1 score and auc metrics. It was more successful than other models that did not use boosting and SMOTE.</p><p><strong>2. DATA AND METHODS</strong></p><p><strong>2.1 Customer Churn Dataset</strong></p><p>In this study, e-commerce data available on the Kaggle platform is used for the customer churn prediction model. This dataset contains 948 “churn” and 4682 “non-churn” users and the churn rate is approximately % 16.8. The variables in this dataset and their descriptions are shown in Table 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ko89J-6PprKygymM8urAUw.png" /><figcaption>Table 1. Variables of Customer Churn Dataset</figcaption></figure><p><strong>2.2 SMOTE</strong></p><p>Since the dataset used for the Customer prediction model is unbalanced, the SMOTE method is used as the dataset balancing method. SMOTE(Chawla et al., 2002) is an oversampling method that balances minority class and majority class proportions by generating synthetic data from the minority class. The working step of SMOTE starts by randomly selecting data from the minorty class. Then k nearest neighbors of this data are determined and one of them is randomly selected. The difference between the selected random neighbor and the minority class observation is taken and this difference is added to the minority class observation to obtain a new synthetic minority class observation. This process repeats until the minority and majority class ratios are equalized.</p><p><strong>2.3 Gradient Boosted Classifier</strong></p><p>Boosting is based on weak learners coming together to form a strong learner. In Boosting, a new model is built with the residuals of the previous model and these models are connected to each other sequentially. Thus, the model error is reduced by giving more importance to errors/residuals. The Gradient Boosting Machines (GBM) (Friedman, 2001) algorithm is a combination of Gradient Descent and Boosting methods. Gradient Descent allows finding the local minimum value of the loss function, thus reducing the error rate of the model and increasing the success rate. Gradient descent performs this optimization with the learning rate. The learning rate is the step size required to find the optimal model parameters. If the learning rate is too high, the local minimum point is missed and if it is too low, the local minimum point is reached in a very long time.</p><p><strong>3. DATA PREPROCESSING AND MODELING</strong></p><p>Before starting modeling, data preprocessing must be applied to the dataset in order to train the model with cleaner and more accurate data. Firstly, observations with missing values were removed from the dataset. Outliers in each variable were detected and the rows containing that outlier values were removed from the dataset. The gradient descent method in the GBM algorithm is sensitive to numerical variables in different ranges. Therefore, the numerical variables in the dataset were transformed to have a mean of 0 and a standard deviation of 1 using standard scaling. Since the algorithms could not process categorical variables containing textual expressions, these variables were converted into binary variables using one hot encoding method.</p><p>With the hold out method, the dataset was splitted into 70% train and 30% test set. In order to objectively evaluate all models, the churn rates in both train and test sets are set to be the same as the original dataset. While only 1 model was trained without oversampling, the other 4 models were trained with SMOTE applied data. According to the sampling strategy parameter of the SMOTE method, the churn rates in the training datasets were increased at different rates and the models were trained with the resulting new oversampled datasets. Synthetic data produced in the oversampling process was not used in the test set to avoid data leakage. Synthetic data is only available in the train set. All models were trained on the GBM algorithm. All developed model variations and their descriptions are shown in Table 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mqxDgKExRpe4H5E3aYuDPQ.png" /><figcaption>Table 2. Customer Churn Prediction Models</figcaption></figure><p><strong>4. RESULTS AND DISCUSSION</strong></p><p>The models were tested with a 33% test set and Accuracy, Precision, Recall, F1 score and AUC metrics were obtained for model evaluation. Test results of the developed models are shown in Table 3. Misclassifying churn customers as non-churn means not being able to identify customers who will churn and therefore not being able to retain those customers. This is a very costly situation for companies. On the other hand, misclassifying customers who will not be churn as those who will be churn creates a much lower cost for companies than failing to identify customers who will churn. For all these reasons, when evaluating customer churn forecast models, first care should be taken to ensure that the Recall and F1-score metrics are high.</p><figure><img alt="Table 3. Results of Customer Churn Prediction Models" src="https://cdn-images-1.medium.com/max/960/1*HDJ-sg_0_mjrird-rHtAFQ.png" /><figcaption>Table 3. Results of Customer Churn Prediction Models</figcaption></figure><p>According to the results in Table 3, when all models are evaluated, it is seen that in general, the models perform better as the proportion of the minority class is increased through sampling. The model without oversampling has the highest accuracy value, but the Recall metric in this model is lower than other models. The model with 60% oversampling was the model with the best performance based on Recall metric. Although the Precision rate of this model is lower than other models, it is the model with the best F1-score due to the Recall metric.</p><p><strong>5. CONCLUSIONS</strong></p><p>Considering the previously mentioned costs, the model with the best performance among all models is the model with 60% oversampling, and this model was chosen to be used in customer churn prediction With this developed customer churn prediction model, it is periodically predicted whether customers will churn or not. As a result of this prediction, an audience is created with the users estimated as churn and new retention strategies are developed to retain these users.</p><p>Different strategies can be developed to retain users who will churn. For example, customers can be offered discounts that they can use on their next purchases, or they can be encouraged to shop by recommending products from their favorite categories. Another strategy is to sell another product to customers for free or at a discount when they purchase one product.</p><p>It can be used through different channels to show these retention strategies to customers who will churn. Special retention campaigns can be implemented for these customers using digital advertising platforms, email and SMS management tools. In addition, these campaigns can be presented to customers by pop-ups for customers using the website and push notifications for customers using the mobile application.</p><p><strong>REFERENCES</strong></p><p>Chawla, N. V., Bowyer, K. W., Hall, L. O., &amp; Kegelmeyer, W. P. (2002). SMOTE: synthetic minority over- sampling technique. Journal of artificial intelligence research, 16, 321–357.</p><p>Fridrich, M., &amp; Dostál, P. (2022). User Churn Model in E-Commerce Retail. Scientific Papers of the University of Pardubice, Series D: Faculty of Economics and Administration, 30(1).</p><p>Friedman, J. H. (2001). Greedy function approximation: a gradient boosting machine. Annals of statistics, 1189- 1232.</p><p>Morgan, J. (2009). Customer information management (CIM): The key to successful CRM in financial services. Journal of performance management, 22(1), 36.</p><p>Raeisi, S., &amp; Sajedi, H. (2020, October). E-Commerce Customer Churn Prediction By Gradient Boosted Trees. In 2020 10th International Conference on Computer and Knowledge Engineering (ICCKE) (pp. 055 059). IEEE.</p><p>Wu, X., &amp; Meng, S. (2016, June). E-commerce customer churn prediction based on improved SMOTE and AdaBoost. In 2016 13th International conference on service systems and service management (ICSSSM) (pp. 1–5). IEEE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*I7NZ_0DmZx4Iklqb.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bd4c52a6b44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Customer Churn Prediction With Vertex AI and BigQuery ML]]></title>
            <link>https://medium.com/@yasinnsariyildiz/customer-churn-prediction-with-vertex-ai-and-bigquery-ml-7b9ab97c7342?source=rss-d74f7e44bb96------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b9ab97c7342</guid>
            <dc:creator><![CDATA[Yasin Sarıyıldız]]></dc:creator>
            <pubDate>Fri, 14 Jul 2023 11:35:11 GMT</pubDate>
            <atom:updated>2023-07-14T11:44:22.521Z</atom:updated>
            <content:encoded><![CDATA[<p>Customer churn has become a serious problem for many companies in an increasingly competitive environment. Many studies show that the cost of acquiring a new customer is 5 to 10 times more than retaining existing customers. Therefore, companies want to predict users who are likely to be churners in the future with machine learning models. They want to retain customers who are estimated to be <strong><em>“churn”</em></strong> by targeting them with digital marketing campaigns.</p><p>Based on my data science master’s thesis topic, I applied “customer churn prediction with machine learning” using Vertex AI and BigQuery ML. While implementing this, I also used web and app analytics data as well as crm data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0Z6rxRHAEZ2vr3fj.png" /></figure><p>The dataset used in customer churn prediction are taken from a dataset published on the Kaggle platform. This dataset includes the digital behavior of users of an e-commerce brand on app and web platforms, location, crm and whether they are churn. The dataset consists of 3333 observations and 20 variables and there are no missing values. Of the 20 variables, 15 are numeric, 4 are categorical, and one is user id. The table containing the names of the variables is given below.</p><pre>SELECT<br>  column_name<br>FROM<br>  `data_science.churn.INFORMATION_SCHEMA.COLUMNS`<br>WHERE table_name = &#39;churn_data&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*yGfP0KOCY26JHSQ4A0jH6Q.png" /><figcaption>Churn Dataset Variables</figcaption></figure><p>I trained the customer churn model with <strong><em>“BOOSTED TREE CLASSIFIER”.</em></strong> This model basically works with the boosting method and the XGBoost algorithm.</p><p>Boosting is an ensemble learning method that aims to combine many weak classifiers in the decision tree structure to form a strong classifier. This learning process takes place by sequential training of weak classifiers, and each classifier increases the accuracy of the model by giving weight to the errors of the previous one.</p><p>The target variable to be estimated is added to as <em>“</em><strong><em>INPUT_LABEL_COLS” =[&#39;churn&#39;]</em></strong><em> </em>parameter. The <strong><em>“EARLY_STOP” = TRUE</em></strong> parameter is used to stop the model to prevent overfitting when there is no decrease in the loss values of the model. The expression <strong><em>MODEL_REGISTRY = ’VERTEX_AI’</em></strong><em> </em>saves the model to the Vertex AI platform and then allows creation of endpoints for online predictions. The variable <strong><em>user_id is excluded</em></strong> because it will not be used for prediction in the model.</p><pre>CREATE OR REPLACE MODEL `data_science.churn_model_xgboost`<br><br>OPTIONS(model_type=&#39;BOOSTED_TREE_CLASSIFIER&#39;,<br>        INPUT_LABEL_COLS=[&#39;churn&#39;],<br>        EARLY_STOP = TRUE,<br>        MODEL_REGISTRY=&#39;VERTEX_AI&#39;,<br><br>  AS SELECT * except(user_id)<br>FROM `data_science.churn.churn_data`</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*9zUaqDD7JWeIwbLtS-Ad4w.png" /><figcaption>Training &amp; Validation Loss of Churn Model</figcaption></figure><p>When we examine the training and validation loss graph of the model, we see that there is no overfitting. After training the customer churn model with the Boosted Tree Classifier, we evaluate the classification model with the following codes.</p><pre>SELECT<br>  *<br>FROM<br>  ML.EVALUATE(MODEL `data_science.churn.churn_model_xgboost`)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F4Kw9owo-Nx6ahKkBbAoNg.png" /></figure><p>When we examine the evaluation metrics of the model, accuracy and auc reached very high values of approximately 96% and 94%, respectively.</p><p>F1 score as the harmonic mean of precision and recall is very important for unbalanced datasets. The F1 score of about 0.84 also has a good value.</p><p>As a result of estimating the churners as not churn, this means a huge cost for us as we cannot retain the churners. The recall score is also very important, as our aim is to predict the churn ones correctly. According to Accuracy, the recall score may seem lower, but 78% recall is a good score for an unbalanced ecommerce dataset .</p><pre>SELECT<br>  *<br>FROM<br>  ML.CONFUSION_MATRIX(MODEL `data_science.churn.churn_model_xgboost`)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*FguBiQ_5QwipQSjeopnzSw.png" /></figure><p>When we examine the conufison matrix of the model, we can say that it predicts non-churn users more accurately than churn ones. However, its success in predicting customers who are churn is also quite good.</p><pre>SELECT<br> feature, importance_gain<br>FROM<br>  ML.FEATURE_IMPORTANCE(MODEL `data_science.churn.churn_model_xgboost`)<br>ORDER BY importance_gain DESC</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*FktJUQpV3OpyhdFfhgNPHQ.png" /></figure><p>When we examine the variable importance levels of the model, we see that the number of calls to customer service is very important in estimating users with churn. In addition, the information about the number of sessions and durations of the customers, the number of transactions and whether they save their credit cards in the system is also very important.</p><p>When we examine all these model evaluations, we see that the boosted tree classifier model prepared with BigQuery ML and Vertex AI is successful and can be used for customer churn prediction.</p><p>In the next article, I will explain how to develop a model with Vertex AI AutoML.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b9ab97c7342" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>