<?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 Nafisa Bulsara on Medium]]></title>
        <description><![CDATA[Stories by Nafisa Bulsara on Medium]]></description>
        <link>https://medium.com/@nafisabulsara?source=rss-fb1a102bb0e4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*E-eKKWvgvw3IWdMJxjMsAg.jpeg</url>
            <title>Stories by Nafisa Bulsara on Medium</title>
            <link>https://medium.com/@nafisabulsara?source=rss-fb1a102bb0e4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:45:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nafisabulsara/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[Identify customer churn on Sparkify — a music streaming application.]]></title>
            <link>https://medium.com/@nafisabulsara/identify-customer-churn-on-sparkify-a-music-streaming-application-6f4b0a7da96e?source=rss-fb1a102bb0e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f4b0a7da96e</guid>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Nafisa Bulsara]]></dc:creator>
            <pubDate>Fri, 27 Sep 2019 01:18:08 GMT</pubDate>
            <atom:updated>2019-09-27T01:18:08.368Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5R9QwZ-CtC2X9-CrRA1-qQ.png" /></figure><h3>Identify customer churn on Sparkify — a music streaming application.</h3><p><strong>Business Understanding</strong></p><p>Sparkify is a music streaming service similar to spotify or pandora. Users use the service fall in one of the two categories — free tier, where they stream the service along with advertisements between songs, or paid subscription which includes a monthly fee to use the service without advertisements.</p><p>Users can downgrade or cancel their subscriptions at any time.</p><p>If we can identify potential cancels to subscriptions, we can potentially reduce the future cancellations by providing them discounts on subscriptions and Sparkify can focus its retention efforts on a targeted group of individuals who are more likely to leave the platform.</p><p><strong>Data Understanding</strong></p><p>The dataset I used for this churn analysis is a subset of the original data which is 12 GB. The dataset contains demographic information, their activity based on the music they listen to and if the customers pay for a subscription or use the free tier of the application.</p><p>A basic schematic representation of the dataset —</p><pre>root<br> | — artist: string (nullable = true)<br> | — auth: string (nullable = true)<br> | — firstName: string (nullable = true)<br> | — gender: string (nullable = true)<br> | — itemInSession: long (nullable = true)<br> | — lastName: string (nullable = true)<br> | — length: double (nullable = true)<br> | — level: string (nullable = true)<br> | — location: string (nullable = true)<br> | — method: string (nullable = true)<br> | — page: string (nullable = true)<br> | — registration: long (nullable = true)<br> | — sessionId: long (nullable = true)<br> | — song: string (nullable = true)<br> | — status: long (nullable = true)<br> | — ts: long (nullable = true)<br> | — userAgent: string (nullable = true)<br> | — userId: string (nullable = true)</pre><p><strong>Exploratory Data Analysis</strong></p><p>In order to visualize activity of paying and free customers, we first need to define churn activity. I used the page column to define this. Based on if the customer has confirmed their cancellation, we define the customers as churned.</p><pre>churned_customers = udf(lambda x: 1 if x == &quot;Cancellation Confirmation&quot; else 0, IntegerType())<br>df = df.withColumn(&quot;Churn&quot;, churned_customers(&quot;page&quot;))</pre><p>Out of the total customers, 23.11% were churned in the reduced dataset.</p><p>The gender distribution of the subscribers were:</p><pre>+------+------+<br>|Gender| count|<br>+------+------+<br>|     M|123576|<br>|     F|154578|<br>+------+------+</pre><p>The distribution of paid vs free customers can also help us understand how many subscribers or full paying customers tend to leave the platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*biZv286bLRQYrEff50Wjeg.png" /><figcaption>Page (paid vs free) distribution for churned customers</figcaption></figure><p><strong>Feature Engineering</strong></p><p>With string type columns, I dropped all null rows from the following columns:</p><pre>&#39;gender’, ‘level’, ‘location’, ‘method’, ‘page’, ‘status&#39;</pre><p>I used spark-ml’s String Indexer and One-Hot Encoders to convert categorical data types to numeric. Also, I used VectorAssembler to combine features into one feature column.</p><p>I created a spark-ml pipeline to complete these steps along with MinMax Scaler normalization. MinMax Scaler normalization will preserves the shape of the original distribution of the dataset.</p><p><strong>Modeling</strong></p><p>Since our target variable is binary- churn vs not churned, Logistic Regression is a simpler solution. I used Parameter Regularization to play with some of the elastic net parameters to chose what fits best for the data and combined these models using spark’s in-built CrossValidator method.</p><pre>lr =  LogisticRegression()<br>paramGrid = ParamGridBuilder() \<br>    .addGrid(lr.elasticNetParam,[0.0, 0.1]) \<br>    .addGrid(lr.regParam,[0.0, 0.1]) \<br>    .build()</pre><pre>crossval = CrossValidator(estimator=lr,<br>                          estimatorParamMaps=paramGrid,<br>                          evaluator=BinaryClassificationEvaluator(),<br>                          numFolds=3)</pre><pre>crossval.setSeed(42)</pre><p><strong>Evaluation</strong></p><p>I evaluated the model built using BinaryClassificationEvaluator.</p><p>The training process took ~2 minutes</p><pre>Logistic Regression Metrics:<br>Accuracy: 0.9998635247020289<br>F-1 Score:0.999840783476364</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f4b0a7da96e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seattle versus Boston — Where would you rather AirBnB?]]></title>
            <link>https://medium.com/@nafisabulsara/seattle-versus-boston-where-would-you-rather-airbnb-bdb9dff466ce?source=rss-fb1a102bb0e4------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdb9dff466ce</guid>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Nafisa Bulsara]]></dc:creator>
            <pubDate>Thu, 26 Sep 2019 08:39:24 GMT</pubDate>
            <atom:updated>2019-09-26T22:30:18.403Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*6umBw0o1pVuoGJbXE-lB4Q.jpeg" /></figure><h3>Seattle versus Boston — Where would you rather AirBnB?</h3><p>AirBnB is rapidly becoming one of the most chosen ways to stay for travelers. It can be nerve wrecking picking the right AirBnB in the right area. Through this article, I’ll be discussing my attempt to visualize the differences in ratings and costs for airbnb in Seattle and Boston. This article is a part of my analyses for Udacity Nanodegree in Data Science. The data for airbnb was obtained through Udacity.</p><p>The Data:</p><p>I’ve obtained the data from Udacity’s resources. We first check for nulls and categorical data types. I converted the categorical data type price to numeric so it’s easier to perform analysis on.</p><p>Some of the business questions I’m addressing are —</p><ol><li>What are the average prices for different localities in Boston and Seattle?</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*aBWdQK68VgXQDh44Nz6_pg.png" /><figcaption>Average prices for AirBnb in Seattle</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*5W2D27PRO-TJHTWz49bigA.png" /><figcaption>Average prices for AirBnB in Boston</figcaption></figure><p>Based on these plots, we see the average prices for airbnb in Boston are much higher than those in Seattle. The average cost of an airbnb in Boston is about 173$ whereas that of Seattle is 127$.</p><p>2. Which areas are most expensive?</p><p>The most expensive places in Boston are South Boston Waterfront, Bay Village, Leather District, Back Bay and Downtown with average prices ranging from $200 to $300. The most expensive places in Seattle are Southeast Magnolia, Portage Bay, Westlake, West Queen Anne and Montlake with average prices in the range of $180 to $230. Clearly, Boston has a more expensive cost of renting an airbnb.</p><p>3. How do the ratings differ in the most expensive areas in Boston vs Seattle?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*dcwssOmQvo0GvZl2XASS1Q.png" /><figcaption>Seattle ratings for location</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*Xl-OrMLDgW-hx_aYqSV-aQ.png" /><figcaption>Boston ratings for location</figcaption></figure><p>On average, expensive areas in Boston have a higher rating compared to Seattle. Neighborhoods with high overall reviews in Boston are Roslindale, Jamaica Plain, East Boston, North End and Longwood Medical Area whereas neighborhoods with high overall reviews in Seattle are Riverview, Whittier Heights, South Delridge, Harrison/Denny-Blaine and International District.</p><p>For a detailed analysis, please refer to the github page: <a href="https://github.com/nafisabulsara/DS_airbnb_analysis">https://github.com/nafisabulsara/DS_airbnb_analysis</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdb9dff466ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>