<?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 Nishant Gupta on Medium]]></title>
        <description><![CDATA[Stories by Nishant Gupta on Medium]]></description>
        <link>https://medium.com/@nishantthewriter?source=rss-391ef8623e79------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ZDxI_qiCjIGT00QU</url>
            <title>Stories by Nishant Gupta on Medium</title>
            <link>https://medium.com/@nishantthewriter?source=rss-391ef8623e79------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 13:13:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nishantthewriter/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[NPS Score Modelling]]></title>
            <link>https://medium.com/@nishantthewriter/nps-score-modelling-bc914b5d5b57?source=rss-391ef8623e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc914b5d5b57</guid>
            <dc:creator><![CDATA[Nishant Gupta]]></dc:creator>
            <pubDate>Thu, 31 Jan 2019 11:01:10 GMT</pubDate>
            <atom:updated>2019-01-31T11:01:10.608Z</atom:updated>
            <content:encoded><![CDATA[<p>Net Promoter Score (NPS) is a popular method of satisfaction and loyalty measurement at most large and medium-sized firms .</p><p>Essentially, NPS is a relationship measure that gauges a customer’s willingness to recommend a given firm.</p><p>The question is administered on an 11-point scale, with each survey respondent answering the question with a score of from 0 to 10. Those who respond with a value of 0 through 6 are designated as Detractors; those responding with a 7 or an 8 are designated as Passives; and those responding with a 9 or a 10 are Promoters. From the survey data collected, NPS is a simple calculation: the percent of promoters minus the percent of detractors.</p><p>As all the users never end up filling the survey form,therefore a machine learning method to predict NPS Score and finding out the significant drivers is an important area to solve.</p><p>The below article focuses on building a model for NPS by utilizing some chat interaction details and utilizing Logistic Regression machine learning technique.</p><p>Features used are listed below:</p><p>ART → Average Response Time is the time taken by the agent in resolving the query.</p><p>Transfer Count → The number of Transfers happened before the Chat landed up in the right queue.</p><p>Wait Time → The amount of time that customer has to wait before the chat gets connected</p><p>OS/Device/Isp →</p><p>Agent Name → As every agent might be handling the chat in a different way and to call out if any of the Agent is performing that well.</p><p>Intent Of the Chat → Initial two Customer lines are used for driving the intent. Chat with different intents are likely to have different NPS Score as for some particular queues belonging to service related queries would likely to have lower customer satisfactions.</p><p>Complete Chat was divided into four parts equally so as to understand the impact of independent portion of the chat and TFIDF vocabulary (till trig-ram) is generated for each of the portion of the chat which helps in <strong>how usage of words</strong> is effecting NPS Score.</p><p>Sentiment Scores → Sentiment Scores for each quantile of the Chat is also taken into picture which helps in understanding how the sentiment of the user is effecting NPS Score.It is calculated at each line level and then aggregated for a quantile , as well as <strong>certain flags were taken using Transition of Sentiment form negative to positive and positive to negative</strong> as if Agents are able to transit the Chat ?</p><p>Though Deep Learning model can also be used for it but to come up with significant variables is of primary importance here so I preferred to use LR .</p><p>We will use finally p value significance testing at 95% confidence interval for rejection and acceptance of features.</p><p>Data Size → 80K Chats Interaction</p><p>Multi Col linearity is addressed here otherwise the comparison of coefficients could not be done.</p><p>Updating the results soon ….</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc914b5d5b57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Click Stream Analysis]]></title>
            <link>https://medium.com/@nishantthewriter/click-stream-analysis-8d08e683be78?source=rss-391ef8623e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d08e683be78</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Nishant Gupta]]></dc:creator>
            <pubDate>Tue, 29 Jan 2019 20:23:23 GMT</pubDate>
            <atom:updated>2019-01-29T20:23:23.598Z</atom:updated>
            <content:encoded><![CDATA[<p>By utilizing click stream data a banner is shown which helps in driving incremental conversion.</p><p><strong>Propensity To Purchase Model</strong> → These kind of models determine the likelihood that user can buy an item.</p><p>Steps To Build Propensity to Purchase Model : →</p><blockquote>Static Features(Static here means the features value will remain same in one session)</blockquote><blockquote>Device,Isp,OS,Region,Total Number Of IP Addresses</blockquote><blockquote>Dynamic Features</blockquote><blockquote>Active Session Number , Average Time On Page, Booking Currency,External Search Term, MaximumTimeOnPage ,Minimum Time On Page, firstPageTitle , Number of Pages for each Segment and other</blockquote><blockquote>Bouncers → People who only visits the homepage and go away, so removing them while building model is good.</blockquote><blockquote>Response Variable → It is generally a window of time frame in which user buys could also be optimized as per the model performance AUC or given already as per the business requirement .</blockquote><p>Logistic Regression was used to build model.</p><p>Forward Feature selection strategy for addressing Multi collinearity</p><p>→<em> </em><a href="https://github.com/nishantgupta08/ReferenceCodesPythonAndR/blob/master/LogisticRegressionMultiCollinearityCode.R"><em>Code for reference</em></a></p><p><strong>Uplift Model </strong>→ Net Lift Modelling</p><p>So in case of building Propensity to Purchase model the problem is if user already has some given intent of buying still we are showing him a banner and in turn adding to cost of targeting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/309/1*kc-uqPDywkDjmRqLBCeeyQ.png" /></figure><p>Do-Not-Disturb → Counterproductive cases , the user behavior is opposite in this case.</p><p>Lost Cause → Never going to buy whatever you do.</p><p>Sure Thing → Already have an intent to buy whether you show banner or not .</p><p>Persuadable → Banner may influence their behaviors .</p><blockquote><strong>In order to build Uplift models several techniques could be utilized, Ideally speaking for every user there should be two sets of examples in the training data one with the treatment given and other not.</strong></blockquote><p>But practically its not possible so either of the below methods could be used .</p><p>→ Run P2P model for a month and generate the training data using it for Uplift modelling , here we will include treatment variable as one of the feature and will find out finally the difference in probability value by making treatment value as 1 and 0 alternatively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/0*ffuEJPLoJW9_2FVZ" /></figure><p>The better way would be to split the population into two halves, display banner to one half and not to another , as some other user might be having a very similar user vector so in a way both the information would be captured(w/o banner and with banner for a particular user).</p><p>For above approaches page url categorization needs to be done which is again a manual label task after clustering of urls one has to manually labels the clusters .</p><p>Deep Learning basically URLNet a similar approach just like word2vec could play a pivotal role here for building high performing models.</p><p>A user journey i.e sequence of urls could also be represented by a high dimensional vector of any choice which will carry some information about its context.Utilizing gensim package I tried to learn semantic relationship b/w urls.</p><p>model.most_similar(‘<a href="http://www.three.co.uk/samsung/galaxy_s9">http://www.three.co.uk/samsung/galaxy_s9</a>&#39;)<br> [(‘<a href="http://www.three.co.uk/samsung/galaxy_s9/plans">http://www.three.co.uk/samsung/galaxy_s9/plans</a>&#39;, 0.8190791606903076), <br> (‘<a href="http://www.three.co.uk/samsung/galaxy_s9_plus">http://www.three.co.uk/samsung/galaxy_s9_plus</a>&#39;, 0.6062688827514648), <br> (‘<a href="http://www.three.co.uk/samsung/galaxy_s8">http://www.three.co.uk/samsung/galaxy_s8</a>&#39;, 0.5951138734817505), <br> (‘<a href="http://www.three.co.uk/samsung/galaxy_s9_plus/plans">http://www.three.co.uk/samsung/galaxy_s9_plus/plans</a>&#39;, 0.5898675918579102), <br> <strong>(‘http://www.three.co.uk/terms_conditions/netflix&#39;, 0.5723433494567871)</strong></p><p>Here one can see Netflix pages have some similarity with <a href="http://www.three.co.uk/samsung/galaxy_s9">galaxy S9</a> , this was because ThreeUk offered some free Netflix subscriptions to Samsung users, and it also resulted in better AUC’s.</p><p>Moreover even Sequential Deep Learning like LSTM based methods could also be utilized by building seq2class kind of architectures, would be slightly computationally expensive to train .</p><p><strong>Going further about Measuring Performance of the Model :</strong></p><p>Steps →</p><p><strong>A/A Testing →</strong> This is done just to check Data discrepancies , here control and test are identical to each other . So it should result in same scores.Any mismatch is an issue.</p><p><strong>A/B Testing →</strong>In test environment users are shown banner and results are recorded and hypothesis testing is done .</p><p>Null Hypothesis → Their is no significant difference between two populations any seen difference is mere an expected chance .</p><p>H0: µ1 — µ2 = 0</p><p>Alternative Hypothesis →Reverse their is a significant difference.</p><p>H1: µ1 — µ2 !=0</p><p>Which type of Test ?</p><ul><li><strong>Test statistic.</strong> The test statistic is a z-score (z) defined by the following equation.</li><li>z = (p1 — p2) / SE</li><li>where Standard Error is the standard deviation of the sampling distribution of the sampling mean .</li><li><strong>Pooled sample proportion.</strong> Since the null hypothesis states that P1=P2, we use a pooled sample proportion (p) to compute the <a href="https://stattrek.com/Help/Glossary.aspx?Target=standard%20error">standard error</a> of the sampling distribution.</li><li>p = (p1 * n1 + p2 * n2) / (n1 + n2)</li><li>SE = sqrt{ p * ( 1 — p ) * [ (1/n1) + (1/n2) ] }</li><li>xyz = (p1 — p2) / SE</li><li>P(z &lt; xyz) → P value that Z score is less than xyz.</li><li>If P value comes greater then significance levels then we cannot reject null hypothesis.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d08e683be78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Time Series Forecasting]]></title>
            <link>https://medium.com/@nishantthewriter/time-series-forecasting-12a15dd0c64c?source=rss-391ef8623e79------2</link>
            <guid isPermaLink="false">https://medium.com/p/12a15dd0c64c</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[timeseries]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Nishant Gupta]]></dc:creator>
            <pubDate>Sat, 01 Dec 2018 08:47:18 GMT</pubDate>
            <atom:updated>2018-12-01T15:08:48.562Z</atom:updated>
            <content:encoded><![CDATA[<p>Time Series Forecasting(Univariate vs Multivariate)</p><blockquote>Univariate: Only one variable varying over time.</blockquote><blockquote>Multivariate: Multiple Variable varying over time</blockquote><p>Time Series Analysis Methods:</p><ul><li>Random Walk</li><li>Exponential Smoothing</li><li>ARIMA(SARIMAX- Seasonal ARIMA with exogenous variables)</li><li>XgBoost(using Temporal Features like mean,median and standard deviation over a rolling window)</li><li>FbProphet</li><li>Deep Learning</li></ul><p><strong>Steps To Build ARIMA Model</strong></p><p><strong>Stationarity of Process </strong><br>Statistical Properties such as mean , variance and auto correlation are constant over time) is a stationary process and it is evaluated using Augmented Dickey–Fuller (Unit root test).</p><p>Link for ADF</p><p><a href="http://www.insightsbot.com/blog/1MH61d/augmented-dickey-fuller-test-in-python">http://www.insightsbot.com/blog/1MH61d/augmented-dickey-fuller-test-in-python</a></p><p><strong>Data Preprocessing Steps</strong></p><p>Seasonal Decomposition is done and outliers are removed from residual component.(statsmodels.tsa.seasonal library in python)</p><p>X(t)= Cycle(Seasonality)+Trend(Shift In Mean)+Residual</p><p><strong>Outlier Removal:</strong>Replace values lower then 95% quantile and higher then 95% quantile with upper and lower quantile value.</p><p><strong>Holiday Factor Adjustment :</strong> The ratio of value at that holiday to the mean of the values form neighbor window(dynamic) is taken and all values belonging to same holiday in the future time frame is multiplied by the same ratio.</p><p><strong>Building ARIMA Model Steps</strong></p><ul><li>Stationarize the series, if necessary, by differencing (&amp; perhaps also logging, deflating, etc.)</li></ul><blockquote>Components of ARIMA : AR+I+MA</blockquote><blockquote>Auto Regressive x(t) = alpha * x(t — 1) + error (t)</blockquote><blockquote>Moving Average x(t) = beta * error(t-1) + error (t)</blockquote><blockquote>Identification of an AR model is often best done with the PACF.(AR has lasting effect)</blockquote><blockquote>Identification of an MA model is often best done with the ACF rather than the PACF.</blockquote><ul><li>Find the optimal values of p,d,q by using grid search method (Package Auto pyramid python) using <strong>akaike information criterion</strong>.</li><li>Why not RMSE and MAPE ?</li></ul><p>AIC penalizes the performance for more number of parameters.A model that fits the data very well while using lots of features will be assigned a larger AIC score than a model that uses fewer features to achieve the same goodness-of-fit. Multicollinearity problem will also be slightly handled by it and a parsimonious model will be built .</p><p><strong>Measurement of Performance of Final ARIMA Model</strong></p><ul><li>By plotting ACF,PACF plots of <strong>residual </strong>one can analyse <strong>if further addition of AR,MA component is required.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*fwz4W5UFQ7LVlFRwpynFRg.png" /></figure><p><strong>Extension of ARIMA to Seasonal ARIMA(p,d,q)(P,D,Q)@m model with Exogenous Variables</strong></p><p>Addition of new P,D,Q here stands for Auto Regressive, Differencing and Moving Average component required for <strong>seasonality part of time series</strong> (could be extracted using seasonal decomposition) and <strong>m stands for the period of seasonality</strong>.</p><p><strong>How to Calculate Period Of Seasonality (*Power Spectrum)?</strong></p><p>It could be determined by plotting power spectrum plots which are only valid once you have made the process stationary. PSD’s not applicable for non stationary.</p><p><strong>Model-fitting steps</strong></p><ul><li>Start by trying various combinations of one seasonal difference and/or one non-seasonal difference to stationarize the series and remove gross features of seasonal pattern.</li><li>If the seasonal pattern is strong and stable, you MUST use a seasonal difference (otherwise it will “die out” in long-term forecasts)</li><li>After differencing, inspect the ACF and PACF at multiples of the seasonal period (s)</li></ul><blockquote><strong>SAR= </strong>1 Positive spikes in ACF at lag s, 2s, 3s…, single positive spike in PACF at lag s</blockquote><blockquote><strong>SMA=1 </strong>Negative spike in ACF at lag s, negative spikes in PACF at lags s, 2s, 3s,…</blockquote><p><strong>Exogenous variables like Day of the week, Week of the Month , Week of the Year , Month of The Year could be added as other regressors and greater performance could be achieved.</strong></p><p>Will soon come up with an illustrative example……………………..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12a15dd0c64c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>