<?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 Jinchao Chen on Medium]]></title>
        <description><![CDATA[Stories by Jinchao Chen on Medium]]></description>
        <link>https://medium.com/@jinchaochen?source=rss-6c32f9b47f85------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VDVzilkqEVxpObANcAFpsA@2x.jpeg</url>
            <title>Stories by Jinchao Chen on Medium</title>
            <link>https://medium.com/@jinchaochen?source=rss-6c32f9b47f85------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 22:52:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jinchaochen/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[Customer Segmentation for Arvato Financial Services]]></title>
            <link>https://jinchaochen.medium.com/customer-segmentation-for-arvato-financial-services-e4fb73cb11de?source=rss-6c32f9b47f85------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4fb73cb11de</guid>
            <dc:creator><![CDATA[Jinchao Chen]]></dc:creator>
            <pubDate>Tue, 08 Dec 2020 17:52:57 GMT</pubDate>
            <atom:updated>2020-12-10T11:27:45.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*baUfC2c6o0e0rIN3KbD-9w.png" /><figcaption>ref. <a href="https://finance.arvato.com/en/">https://finance.arvato.com/en/</a></figcaption></figure><h3>Project Definition</h3><h4>project overview</h4><p>This blog post is part of the Capstone Project for the Udacity Data Scientist nano degree program. In this project, the demographics data was utilized, to identify the potential customers for the mail-order company, a client of Arvato Financial Services. The supervised machine learning model, the outcome of this project, predicts whether or not individuals will respond to the campaign.</p><p>The blog post is composed of three parts:</p><ul><li>Data Exploration: Understanding the data and data cleaning</li><li>Unsupervised learning: a customer segmentation report</li><li>Supervised learning: a classifier that predicts whether an individual will respond</li></ul><h4>project statement</h4><p>In the first part, the main focus is on cleaning the data and exploring feature engineering options. With it completed, the data is then used to build an unsupervised machine learning model that performs segmentation for the customers and the general population. This model works to group individuals based on their features. By comparing to the general population, we could identify features that best describe the customers. Lastly, a prediction model was created to identify individuals who are more likely to respond to the campaign.</p><h4>metrics</h4><p>The prediction model is a binary classifier that separates the target group (who will respond) from the non-target group. As the dataset is highly imbalanced with a very low positive rate (1.2%), accuracy alone won’t be the appropriate evaluation metric to measure how well the model classifies the minority group. Instead, we will use the ROC AUC score to evaluate model performance. When evaluating this binary classifier, we like to capture all the positive groups while minimizing the false positive rate. ROC AUC score is, therefore, an appropriate metric, since it summarizes the trade-off between the true-positive rate and false-positive rate.</p><h3>PART I: Data preparation</h3><p>There are four data files associated with this project:</p><ul><li>Udacity_AZDIAS_052018.csv: Demographics data for the general population of Germany; 891 211 persons (rows) x 366 features (columns).</li><li>Udacity_CUSTOMERS_052018.csv: Demographics data for customers of a mail-order company; 191 652 persons (rows) x 369 features (columns).</li><li>Udacity_MAILOUT_052018_TRAIN.csv: Demographics data for individuals who were targets of a marketing campaign; 42 982 persons (rows) x 367 (columns).</li><li>Udacity_MAILOUT_052018_TEST.csv: Demographics data for individuals who were targets of a marketing campaign; 42 833 persons (rows) x 366 (columns).</li></ul><p>In addition to the above, Arvato provides two information files that describe attributes depicted in the data file.</p><ul><li>DIAS Information Levels — Attributes 2017.xlsx: is a top-level list of attributes and descriptions, organized by informational category.</li><li>DIAS Attributes — Values 2017.xlsx: is a detailed mapping of data values for each feature in alphabetical order.</li></ul><h4>Feature summary — data exploration</h4><p>As the first step, I created a feature summary file that summarizes the names of the attributes, the datatype, and missing or unknown representation. This summary file forms the basis of data preprocessing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*FgHgPdjdlYWu3eA_DiOSZw.png" /><figcaption>Screenshot of feature summary</figcaption></figure><p>A quick scan shows that the data in the file is mostly ordinal. For example, “D19_BANKEN_ANZ_12” describes the frequency of transaction activity. The values range from least frequent (0 = very low activity) to the most frequent (6 = very high activity). Since it is ranking based, the datatype “D19_BANKEN_ANZ_12” is ordinal. As most of the features are ordinal, I will pre-assign the feature type as ‘ordinal’. If further analysis shows otherwise, I will update the summary table.</p><p>In addition, it is noticed that the naming of most features follows a fixed structure. For example, in “D19_NAHRUNGSERGAENZUNG_RZ”, the first part “D19” presents the data source, while the rest describe the content of the feature (NAHRUNGSERGAENZUN = FOOD SUPPLEMENT). As data from the same source tend to be encoded in a similar manner, I decided to split the attribute names and use the first part (prefix) to investigate feature encoding in groups. By grouping the features, I was able to create a summary table for 276 features in a structured way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/202/1*h0O2qcZZ8hFabAnq1K_FYA.png" /><figcaption>top-ranked prefixes used in naming</figcaption></figure><p>Furthermore, it is noticed from the analysis that:</p><ul><li>Non-numeric values are assigned to a number of columns: “OST_WEST_KZ”, “CAMEO_DEUG_2015”, “CAMEO_DEU_2015”, <br> “CAMEO_INTL_2015”, “D19_LETZTER_KAUF_BRANCHE”. I will therefore use LabelEncoder to transform it, and replace the abnormal values (“X”, “XX”) as unknowns.</li><li>‘EINGEFUEGT_AM’ uses date and time as feature values. I extracted the year from the string, which will be treated as numerical data.</li><li>As presented in the bar chart below, most of the features are ordinal, with few features are numerical. The rest, 73 features, is treated as categorical.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*Mc97Q7UDIpzJHYt4UBvA1Q.png" /><figcaption>Distribution of datatypes among the features</figcaption></figure><h4>Data cleaning, transformation, and feature engineering</h4><p>The data cleaning involves multiple steps:</p><ul><li>Convert missing values to NaNs.</li><li>Drop rows and columns where a large portion are NaN’s</li><li>Replacing Missing values with the most frequent.</li><li>Outlier detection using Z-score</li><li>One Hot Encoding for Categorical Data.</li><li>Min-max scaling for ordinal and numerical data</li><li>Create a data cleaning pipeline, to be used later for later analysis</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/014380abcd7e442b54dec9fc7748a38a/href">https://medium.com/media/014380abcd7e442b54dec9fc7748a38a/href</a></iframe><p>The data pre-processing pipeline includes two steps:</p><ul><li>the first step ‘reduce dimension’ includes mapping the unknowns, selecting columns of interests, remove</li><li>the second step ‘combined pipe’ applies different data transformation strategies according to the datatypes.</li></ul><p>At the first step, I decided to keep all the features in the analysis: the nan-threshold appears to cause data drain, which hampers the performance of the supervised machine learning model.</p><p>At the second step, the nan’s were replaced with either the median or the most frequent value. Afterward, the numerical values were scaled using MinMax scaler while the categorical values were transformed using OneHotEncoder.</p><h3>PART II: Customer segmentation report</h3><p>In this section, unsupervised learning techniques are utilized to compare the demographic data of the customers and the general population.</p><h4>Principal Component Analysis</h4><p>To start with, I used Principal Component Analysis (PCA) to summarize the information contained in the data files. This is an efficient way to combine similar features while maintaining the variance of the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*otng9WBDz54Rqf72MMZFnA.png" /></figure><p>The accumulated explained variance increases, with the increase in the number of principal components included in the model. It was decided to include the first 216 PCA’s, which captures more than 80% of the accumulated variance.</p><h3>Clustering</h3><p>The clustering is based on the elbow method. I decided to include 10 clusters in total since additional clusters only slightly reduce the inertia of KNMeans.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*azo3fUerlDvSAifB_GCGeA.png" /></figure><p>Using the clustering model, I compared the difference between the customers and the general population. The figure below presents the distribution of the data over the 10 clusters. From the figures, it is concluded that customers tend to belong to cluster #2 and cluster #7, while the general population is evenly distributed among the clusters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*wDGOAbEOd95LqenU8Y2Pjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ZX9pcrvZMXmRK2-gh3Mv8g.png" /></figure><p>The bar chart above presents the difference between the general population and the customers, in terms of the proportion of each cluster. It is noticed that differences are the largest in cluster 5 and cluster 7.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ZjDeEKzoW3wXHwiyAJeoqg.png" /></figure><p>The heatmap above presents the relevance of each PCA to each cluster. Combined with the comparison between the general population and customer, we could infer that potential customers tend to live in a neighborhood with a higher number of car ownership, and they are older than the general population.</p><h3>PART III: Prediction</h3><p>With segmentation completed, a supervised machine learning model was built to predict whether the individuals in the dataset will convert to be a customer. The analysis is based on demographics contained Udacity_MAILOUT_052018_TRAIN.csv (trainig data)and Udacity_MAILOUT_052018_TEST (test dta).csv. The training data contains one additional column named ‘response’ while we need to predict it for the testing dataset.</p><pre>Training set:<br>total records: 42962<br>who responded to mail out campain: 532<br>who did not respond: 42430<br>na&#39;s in the RESPONSE column: 0<br>portion of response: 1.24%</pre><p>A further examination shows that only 1.24% of people responded to the campaign in the training set, which results in a highly imbalanced data set. To deal with the imbalance dataset in this binary classification, I used the ROC AUC score to evaluate model performance that measures both the true positive and false-positive rates.</p><p>In modeling, I used Ensembling classifiers as it shows improved performances over a single learner. Besides, I made use of the balanced ensemble methods provided in <a href="https://imbalanced-learn.readthedocs.io/en/stable/index.html"><em>imbalanced-learn</em></a>, which internally samples the data. As concluded in ref.[1], the balanced Ensembling classifier greatly enhances model performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*Kp83HbZF9ucafDF2ZgW0VQ.png" /><figcaption>Confusion matrixes, using different classifiers</figcaption></figure><p>From the estimators that I compared, <em>EasyEnsemble </em>was<em> </em>selected as it yielded the highest ROC AUC score. It yielded a ROC AUC score of 0.78, even without hyperparameter tuning. The non-balanced models (Bagging, AdaBoost) have a score of 0.5, which indicates the models failed to provide a prediction and all were predicted to be negative. In comparison, the balanced models show significantly improved performance, thanks to the balancing techniques internally implemented in <em>imbalanced-learn</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*REXQ9LyzJBsqwcBvA81lBQ.png" /><figcaption>Feature importance</figcaption></figure><p>Figure about shows the feature importance. ‘D19_SOZIALES’ has the highest weight in the prediction model. A potential customer tends to have a value of ‘1.0 ’ in ‘D19_SOZIALES’. Unfortunately, the meaning of this feature was not provided in the information file. We were unable to further interpret the feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*wrG3_eH6fAyene4Fz4NmoQ.png" /><figcaption>Influence of the total number of features in ROC AUC score.</figcaption></figure><p>It however strikes me that the performance of the model is not highly dependent on the number of features used to create in the model. It already yields a ROC AUC score of 0.78, when including the top three of the most important features.</p><p>Further efforts were spared in fine-tuning the model, as provided below. From the parameters compared, it is decided to include 30 estimators for the base model and 30 estimators for the <em>EasyEnsembleClassifier. </em>The ROC AUC score is slightly increased to 0.80.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8895c7bc4d3668a62350f0eeeaaab199/href">https://medium.com/media/8895c7bc4d3668a62350f0eeeaaab199/href</a></iframe><h3>Conclusions</h3><p>From the confusion matrix for EasyEnsemble, it is noted that the model has a true positive rate of 0.88. The classifier manages to identify the majority of the individuals who will respond. Even if we limit the campaign to the individuals who are predicted to be positive, we could still reach 88% of the target group (true positives). If adopting this strategy in the campaign, we could effectively reduce the campaign to 33% of its original size. In conclusion, the machine learning model works to predict whether or not each individual will respond to the campaign. The has the potential to help the mail-order company to better target the customers.</p><p>This is the first machine learning model that I created using real-world data. It is quite challenging a project in tow aspects:</p><ul><li>The large dimension of the data set requires extensive efforts in understanding the data and establishing a strategy to process the data</li><li>It is also highly imbalanced, which requires proper sampling to be suitable for classification analysis.</li></ul><p>The deeper that I dived into the data, the more I realized the importance of proper feature engineering. To enhance the performance of the data, I would refine the feature engineering strategies, to better select and extract information from the data set. Besides, I would also like to explore more advanced classifiers with enhanced performances in dealing with an imbalanced data set.</p><h3>Reference:</h3><p>[1].Comparison of ensembling classifiers internally using sampling: <a href="https://imbalanced-learn.readthedocs.io/en/stable/auto_examples/ensemble/plot_comparison_ensemble_classifier.html#sphx-glr-auto-examples-ensemble-plot-comparison-ensemble-classifier-py">https://imbalanced-learn.readthedocs.io/en/stable/auto_examples/ensemble/plot_comparison_ensemble_classifier.html#sphx-glr-auto-examples-ensemble-plot-comparison-ensemble-classifier-py</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4fb73cb11de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Did Road Freight Transport Develop in the Netherlands?]]></title>
            <link>https://medium.com/swlh/how-did-road-freight-transport-develop-in-the-netherlands-f42502a48047?source=rss-6c32f9b47f85------2</link>
            <guid isPermaLink="false">https://medium.com/p/f42502a48047</guid>
            <category><![CDATA[exploratory-data-analysis]]></category>
            <category><![CDATA[transportation]]></category>
            <category><![CDATA[economy]]></category>
            <category><![CDATA[vehicles]]></category>
            <dc:creator><![CDATA[Jinchao Chen]]></dc:creator>
            <pubDate>Wed, 26 Aug 2020 19:46:58 GMT</pubDate>
            <atom:updated>2020-08-31T23:10:23.036Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJ_autN_6gJYxNpuQ14aMg.png" /><figcaption>Credit: <a href="https://dribbble.com/shots/10878682-Emoji-transport-2">Aleksey Chizhikov</a></figcaption></figure><p>I spent hours daily driving on one of the busiest motorways in the Netherlands when commuting was still a norm. When I first came across with the goods vehicle data on CBS website, it immediately attracted my attention: it could answer those <em>not so important</em> questions that I have always had, when stuck in a traffic jam after a long day of work, alongside the lorries.</p><p>In this article, we will explore several aspects of goods vehicles transportation in particular,</p><ul><li>What are the types of common goods vehicles? How can we tell them apart using data?</li><li>What is the lifespan of a goods vehicle?</li><li>Why is there such a high volume of goods vehicles on the motorways nowadays?</li></ul><h3>General information</h3><p>As described on CBS website, the data provides information</p><p><em>… on total vehicle kilometres of goods vehicles in the Netherlands (broken down by Dutch and foreign vehicles) and data of total kilometres and average annual kilometres of Dutch goods vehicles (broken down by Dutch and foreign territory). All figures are further broken down by lorries and road tractors, by age of the vehicle and by load capacity.</em></p><p>In the analysis, we will answer the question using mainly the following:</p><ul><li>country of origin: Dutch or foreign vehicles</li><li>vehicle type: lorries or road tractors</li><li>vehicle age: deducted from the year of construction</li><li>vehicle km territory: abroad or in the Netherlands</li></ul><h3>Goods vehicle type</h3><p>The original dataset breaks the goods vehicle into several groups and subgroups. For simplicity concerns, we will treat them as either lorry or road tractor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6OtAtIaswnG-9r2S7oNxEw.png" /><figcaption>Amount of Dutch goods vehicles in use, from 2001 to 2018</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*70EefWQMoEqv0HD4pJqQKw.png" /><figcaption>Kilometres by different vehicles types, from 2001 to 2018</figcaption></figure><p>From the charts above, it can be concluded that road tractor is gradually gaining popularity as of 2001. Road tractor total kilometres outnumber lorries in 2002. The registered amount of road tractor outnumbered lorries in 2008. In 2018, road tractor kilometres was already more than twice that of the lorry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*rqsr55ECyv3G6F1GCXSrlQ.png" /></figure><p>What about the annual average? The figure above compares the average annual kilometres in and outside the Netherlands, for lorries and road tractors. From the figure above, it is observed that:</p><ul><li>Road tractors are more involved in extra-territory transportation than lorries;</li><li>Road tractors tend to have larger annual kilometres than the lorries, both in and outside the Netherlands.</li></ul><h3>The lifespan of goods vehicle</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*AcAduNJgcZ2ftLhCWEtQ3g.png" /></figure><p>What is the service life of goods vehicles? Instead of directly answering it, we will tweak this question slightly and investigate how long it takes for half of the newly constructed to become de-registered.</p><p>The figure above presents the percentage of the goods vehicle that remains in use, to the number of years in service. A clear distinction is present between the analyzed vehicle types: 50% of the newly constructed road tractors become de-registered after being in use for 9 years; for lorries, that occurs 3 years later when they are in use for 12 years.</p><h3>Why so many goods vehicles nowadays?</h3><p>I always hear “it is a sign of booming economy” when talking to my Dutch fellows about the over crowded motorways. With this in mind, I looked into CBS data, in combination with GDP records from the World Bank.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*ZheCS6s781BwHwuUf6cSIQ.png" /></figure><p>The chart above presents GPD (current USD)and goods vehicle km over the period from 2001 to 2018. A few observations can be made:</p><ul><li>Vehicle km is highly correlated to economic growth: it increases during the economic boom and shrinks in the bust.</li><li>Road transport seems to lead the cycle. While freight transport recovery started in 2014, the economy entered the growth cycle one year later in 2015. Similarly, the traffic kilometers reached its peak one year earlier in 2017 while the economy peaked in 2018.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*riynx59lNcWDH7nyr6vORQ.png" /></figure><p>A similar trend can also be observed in the number of newly constructed or registered vehicles. During the years of 2009 and 2010, there is a significant reduction in the number of near construction. Investment in new vehicles started to recover from 2011 and returned to the pre-crisis level in 2015.</p><h3>What I learned from the data</h3><p>A few items can be learned from the exploratory data analysis,</p><ul><li>The data contains information about two types of goods vehicle: lorries and road tractors;</li><li>Road tractor is gradually gaining popularity in recent years, with more road tractor entering the market than lorries;</li><li>Road tractors are more involved in extra-territory transportation than lorries while lorries tend to travel more often within the country.</li><li>Road tractors have larger annual kilometres than the lorries, both in and outside the Netherlands;</li><li>With regards to the life span, 50% of road tractors becomes de-registered after 9 years while for lorries that occurs after being in service for 12 years;</li><li>It is concluded that freight transport is highly dependent on the economy. The variation of the vehicle kilometers closely follows the economic cycle.</li></ul><p>That is it for now. Next step: build a regression model to classify vehicle types.</p><p>All the used scripts are available in the <a href="https://github.com/jinchao-chen/goods_vehicle_analysis">git repo</a>.</p><h3>Reference</h3><p>Vehicle kilometres of lorries and road tractors (Dutch and foreign vehicles) by territory, vehicle construction years, gross vehicle weight, <a href="https://opendata.cbs.nl/statline/portal.html?_la=en&amp;_catalog=CBS&amp;tableId=84651ENG&amp;_theme=1111">CBS</a></p><p>GDP data: <a href="https://data.worldbank.org/country/netherlands">https://data.worldbank.org/country/netherlands</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f42502a48047" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/how-did-road-freight-transport-develop-in-the-netherlands-f42502a48047">How Did Road Freight Transport Develop in the Netherlands?</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>