<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="https://shivakumar121.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://shivakumar121.github.io/" rel="alternate" type="text/html" /><updated>2019-12-30T19:36:38+00:00</updated><id>https://shivakumar121.github.io/feed.xml</id><title type="html">ByteSizeWeb</title><subtitle>Unravelling the stories in real-world data.</subtitle><entry><title type="html">Using Data for Better Customer Engagement</title><link href="https://shivakumar121.github.io/better_customer_engagement/" rel="alternate" type="text/html" title="Using Data for Better Customer Engagement" /><published>2018-10-08T00:00:00+00:00</published><updated>2018-10-08T00:00:00+00:00</updated><id>https://shivakumar121.github.io/Using-Data-for-Better-Customer-Engagement</id><content type="html" xml:base="https://shivakumar121.github.io/better_customer_engagement/">&lt;h2 id=&quot;introduction&quot;&gt;Introduction&lt;/h2&gt;

&lt;p&gt;For a company that wants to increase sales, it is far more critical to keep existing customers than to find new ones. There are two reasons for it: 1) it is far cheaper to keep customers than to look for new ones, 2) in most cases, customers with a prior order history have a lower barrier to ordering again than those who have never ordered on the platform before.&lt;/p&gt;

&lt;p&gt;Add to that the additional metrics the company prioritizes, like the sustainability of the products being purchased by the consumers. The problem now gets even more convoluted. So Imagine you are the head of a company that wants to increase sales and wants its customers to order more sustainable products while doing that. For my Insight project, I consulted for a company that faced this very problem. The company cares deeply about the sustainability of the products they sell. Without readjusting their focus on it, they also want, like any other company, to increase sales and grow their profits.&lt;/p&gt;

&lt;h2 id=&quot;exploring-the-data&quot;&gt;Exploring the data&lt;/h2&gt;

&lt;p&gt;The company had accumulated a lot of data over time. The data contained everything from the order history of consumers to metadata for those orders, the products themselves, and their manufacturers. This amounted to a lot of data distributed over 50 different tables interconnect with foreign keys and their respective primary key.
The company’s vision for achieving their goals was to build out a ‘sustainability dashboard’ to provide company-wide, and customer specific, metrics about the sales/expenditure and the associated environmental goals. This would then be used to send out weekly/monthly updates to the consumers to encourage spending on more environmentally friendly products.&lt;/p&gt;

&lt;p&gt;Building a histogram of the company-wide order histories made one thing clear. The company faced a challenge that most other companies face today in our modern online-ordering market that is inundated with options. It can be visualized from this figure below. It is quite evident that some customers order a lot of products, which drives up sales figures. However, the company is missing out on a lot of potential orders from customers who order only a few times but do not return to order again.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/OrderHistory.png&quot; alt=&quot;Order History&quot; /&gt;&lt;/p&gt;

&lt;p&gt;While brainstorming with the company to flesh-out the dashboard, I realized that a great value-addition to it would be a recommendation engine. All the historical data of past purchases by a consumer could be used to make customer-specific recommendations of products that they may like, but did not know existed in the catalog. This recommendation engine could serve two purposes at the same time; introduce consumers to new products they might need, and nudge them towards greener products.&lt;/p&gt;

&lt;h2 id=&quot;implementing-the-dashboard&quot;&gt;Implementing the dashboard&lt;/h2&gt;
&lt;p&gt;Data from all the different tables was wrangled in python. Specifically, pandas, the python data analysis library, and numpy were extensively used to clean and pre-process the data. Sustainability estimates were generated by feature engineering to combine recycled content and the carbon footprint of each item. Pandas functions such as join, merge and other aggregating functions like groupby had to be abundantly deployed to get the required metrics.&lt;/p&gt;

&lt;p&gt;I chose to use Bokeh to visualize these metrics. Bokeh appeared very promising for this task since it is open-source. It offers an ‘interactive visualization library that targets modern web browsers for presentation. Its goal is to provide elegant, concise construction of basic exploratory and advanced custom graphics in the style of D3.js’. To serve these visualizations in the form of an interactive, customizable, and robust web app I decided to integrate it with Flask. Flask is a ‘micro web framework written in Python and is based on Werkzeug, Jinja 2 and good intentions’.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/Dashboard.png&quot; alt=&quot;Dashboard&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;implementing-the-recommender-system&quot;&gt;Implementing the recommender system&lt;/h2&gt;

&lt;p&gt;There are several possible methods to implement a recommender system. Every method offers certain advantages and disadvantages. I wanted a method that can be pushed into production rapidly in a scalable manner. I opted for the k-nearest-neighbor (KNN) method. KNN belongs to a sub-category of recommender systems called as ‘collaborative filtering’. Collaborative filtering matches users that like the same items. ‘Liking’ a product can be inferred implicitly by looking at a consumer’s purchase history. This then gives a large user-item matrix, where each row is a customer and each column is all the products that a user can purchase. This user-item matrix can then be filled with 1 if the corresponding item was purchased by its corresponding user, or 0 if it was not. Since a customer can potentially order a lot of products, this user-item matrix was very wide (many more columns than rows). Also, since a consumer only orders a small subset of these thousands of products on offer, this matrix is pretty sparse (has lots of zeros in it). Therefore, reducing the dimensions of this matrix was essential to help KNN find the optimal solution. I used scikit learn to perform principal component analysis (PCA) which reduced the dimensions of the data without much loss of its variation. I then used KNN to find the nearest-neighbors of each consumer in this reduced two-dimensional (first two principal components) space. To make a recommendation, I simply went down the list of most-ordered items by the closest neighbor until I found one that had not been ordered by the original consumer before.&lt;/p&gt;

&lt;p&gt;This gives a good recommendation that is personalized to the customer. But, how do we account for other metrics like sustainability, which are highly prioritized by the company? To factor it in, I first calculated the weighted overall sustainability of all products of the customer. I then made only those recommendations which are at least a little greener than this previous average.  This serves our two purposes. First, it introduces a customer to a personalized product they might like but were probably not aware it existed in the catalog. Additionally, it nudges them towards a greener product.&lt;/p&gt;

&lt;p&gt;In the end, the company received a dashboard with customer-specific metrics. Additionally, the dashboard contained a personalized and environmentally conscious recommendation for each customer that would help improve sales while helping our planet.&lt;/p&gt;

&lt;p&gt;Overall, it was a very valuable experience for me. It exposed me to real-world data, working with a real company to implement a practical and environmentally friendly solution.&lt;/p&gt;</content><author><name></name></author><summary type="html">Introduction</summary></entry><entry><title type="html">US Migrations in Recent Years</title><link href="https://shivakumar121.github.io/us_migrations_in_recent_years/" rel="alternate" type="text/html" title="US Migrations in Recent Years" /><published>2018-02-27T00:00:00+00:00</published><updated>2018-02-27T00:00:00+00:00</updated><id>https://shivakumar121.github.io/US-Migrations-in-Recent-Years</id><content type="html" xml:base="https://shivakumar121.github.io/us_migrations_in_recent_years/">&lt;p&gt;Where people are migrating says a lot about the underlying socio-economic factors that dominate a country. And for a country like USA, with more than 323 million people and an advanced economy that has a sweeping clout, these migrations can hold the key to understanding where the global economy is headed.  Moving across the country is a tough decision for most people. It requires a compelling reason. For most people it is a job, or the lack thereof, that provides a significant push to make a cross-country move. The ever-changing job market, and how quickly states adapt to the turning tides, are some of the main things one can interpret from these migrations.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;interactive plot&lt;/strong&gt; below shows how the population of individual US states has changed, relative to the county’s total population as a whole.&lt;/p&gt;

&lt;iframe src=&quot;https://bytesizeweb.shinyapps.io/USPopApp/&quot; style=&quot;width: 900px; height: 600px&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;Interactive plot to explore these migrations can also be accessed at &lt;a href=&quot;https://bytesizeweb.shinyapps.io/USPopApp/&quot;&gt;this link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Surprising revelation from this interactive plot is the quite drastic progression from low migrations in the early part of the decade to the high migrations of 2016-17. Additionally, overall people have been consistently migrating to the west and the south-east. East and north-east have seen considerable decline for a large part of the last decade.&lt;/p&gt;

&lt;p&gt;The plot also shows vividly the boom and bust of the oil rush in &lt;strong&gt;North Dakota&lt;/strong&gt;. The rapidly reversing fortunes of &lt;strong&gt;Wyoming&lt;/strong&gt; and &lt;strong&gt;Idaho&lt;/strong&gt; in recent years stand out. More context can be gathered from &lt;a href=&quot;https://www.washingtonpost.com/news/wonk/wp/2017/12/26/2017s-fastest-and-slowest-growing-states-are-neighbors-heres-why-their-paths-diverged/?utm_term=.6b3b55f900e1&quot;&gt;this article&lt;/a&gt; in Washington post.&lt;/p&gt;

&lt;p&gt;A lot of these highly contrasting migrations in the recent years also coincided with politically important times in the US. Players who better positioned themselves to ride the wake were benefitted, while others got left behind.&lt;/p&gt;</content><author><name></name></author><summary type="html">Where people are migrating says a lot about the underlying socio-economic factors that dominate a country. And for a country like USA, with more than 323 million people and an advanced economy that has a sweeping clout, these migrations can hold the key to understanding where the global economy is headed. Moving across the country is a tough decision for most people. It requires a compelling reason. For most people it is a job, or the lack thereof, that provides a significant push to make a cross-country move. The ever-changing job market, and how quickly states adapt to the turning tides, are some of the main things one can interpret from these migrations.</summary></entry><entry><title type="html">Countries with the best Science and Technology sector</title><link href="https://shivakumar121.github.io/countries_with_the_best_Science_and_Technology_sector/" rel="alternate" type="text/html" title="Countries with the best Science and Technology sector" /><published>2017-10-02T00:00:00+00:00</published><updated>2017-10-02T00:00:00+00:00</updated><id>https://shivakumar121.github.io/Countries-with-the-best-Science-and-Technology-sector</id><content type="html" xml:base="https://shivakumar121.github.io/countries_with_the_best_Science_and_Technology_sector/">&lt;p&gt;Scientific and technological development is everywhere around us. To say that it has completely transformed our way of life would be an understatement. Majority of people are eager to adopt any new technology if it is useful in one way or another. Others who resist in the beginning, eventually give in to the slowly rising tide and go with the flow. Technological advances have a snowball effect as well. More advanced a country becomes the faster it can advance itself.&lt;/p&gt;

&lt;p&gt;That said, there is a lot of disparity between different countries and technologies they are good at. If we use certain indicators as measures of scientific advancement, then it is possible to divide these countries into separate groups. These groups accurately reflect the perceived scientific and technological development of these countries. The indicators used for these analysis are: 1) Charges for the use of intellectual property, 2) Research and development expenditure, 3) Patent applications (non-residents), 4) Patent applications (residents), 5) Trademark applications (direct residents), 6) Researchers in R&amp;amp;D, 7) Technicians in R&amp;amp;D, and 8) High-technology exports.&lt;/p&gt;

&lt;p&gt;Explore the &lt;strong&gt;interactive ‘&lt;em&gt;Principal Component Analysis&lt;/em&gt;’ plots&lt;/strong&gt; below to visualize these groups by yourself.&lt;/p&gt;

&lt;iframe src=&quot;https://bytesizeweb.shinyapps.io/SandT_PCA/&quot; style=&quot;width: 700px; height: 850px&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;You can also use &lt;a href=&quot;https://bytesizeweb.shinyapps.io/SandT_PCA/&quot;&gt;this link&lt;/a&gt; to connect to the interactive plot.&lt;/p&gt;</content><author><name></name></author><summary type="html">Scientific and technological development is everywhere around us. To say that it has completely transformed our way of life would be an understatement. Majority of people are eager to adopt any new technology if it is useful in one way or another. Others who resist in the beginning, eventually give in to the slowly rising tide and go with the flow. Technological advances have a snowball effect as well. More advanced a country becomes the faster it can advance itself.</summary></entry><entry><title type="html">Malaria – Number of Confirmed Cases by Country</title><link href="https://shivakumar121.github.io/malaria_number_of_cases_by_country/" rel="alternate" type="text/html" title="Malaria – Number of Confirmed Cases by Country" /><published>2017-09-27T00:00:00+00:00</published><updated>2017-09-27T00:00:00+00:00</updated><id>https://shivakumar121.github.io/Malaria-%E2%80%93-Number-of-Confirmed-Cases-by-Country</id><content type="html" xml:base="https://shivakumar121.github.io/malaria_number_of_cases_by_country/">&lt;p&gt;Malaria is a fatal disease that is transmitted by certain types of infected mosquitoes. The parasite that causes it has been around for several thousands of years. In fact, the very first Humans that lived in Africa were already dying from the disease. As the early Humans migrated to new land, they carried Malaria with them. Today, Malaria causes nearly half a million deaths worldwide. We have come a long way since the time of our early ancestors, but have we made any progress in eradicating this fatal disease?&lt;/p&gt;

&lt;p&gt;Use the &lt;strong&gt;interactive app&lt;/strong&gt; below to track Malaria cases by country over a 12 year period. This data was obtained from &lt;a href=&quot;http://data.un.org/&quot;&gt;UN&lt;/a&gt;.&lt;/p&gt;

&lt;iframe src=&quot;https://bytesizeweb.shinyapps.io/malaria_cases_plots/&quot; style=&quot;width: 800px; height: 500px&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;You can also use &lt;a href=&quot;https://bytesizeweb.shinyapps.io/malaria_cases_plots/&quot;&gt;this link&lt;/a&gt; to connect to the interactive plot.&lt;/p&gt;</content><author><name></name></author><summary type="html">Malaria is a fatal disease that is transmitted by certain types of infected mosquitoes. The parasite that causes it has been around for several thousands of years. In fact, the very first Humans that lived in Africa were already dying from the disease. As the early Humans migrated to new land, they carried Malaria with them. Today, Malaria causes nearly half a million deaths worldwide. We have come a long way since the time of our early ancestors, but have we made any progress in eradicating this fatal disease?</summary></entry></feed>