<?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 Syed Umair Hassan on Medium]]></title>
        <description><![CDATA[Stories by Syed Umair Hassan on Medium]]></description>
        <link>https://medium.com/@usyed20?source=rss-ad529b13c467------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*BdyNnvG4FXLaykM5YmVYXA.jpeg</url>
            <title>Stories by Syed Umair Hassan on Medium</title>
            <link>https://medium.com/@usyed20?source=rss-ad529b13c467------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:28:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@usyed20/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[Analysis of Insurance Unit Price data with FbProphet package using Python]]></title>
            <link>https://medium.com/@usyed20/analysis-of-insurance-unit-price-data-with-fbprophet-package-using-python-cb3bde21b314?source=rss-ad529b13c467------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb3bde21b314</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[fbprophet]]></category>
            <category><![CDATA[insurance]]></category>
            <category><![CDATA[datascience-training]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Syed Umair Hassan]]></dc:creator>
            <pubDate>Sun, 10 May 2020 21:53:55 GMT</pubDate>
            <atom:updated>2020-05-10T21:53:55.141Z</atom:updated>
            <content:encoded><![CDATA[<p>Fbprophet is an open source library by Facebook to provide some useful information on how to produce forecasting. Using fbprophet we can convert a time series data into trend and seasonality which may lead to further data analysis such as weekly, monthly and yearly and it has this capability by default. However, it has the option of defining your own seasonality so analysts can use this option as well.</p><p>Prophet uses a time series model with three main model components: trend, seasonality and holidays. They are represented with the following equations:</p><p>y(t)= g(t) + s(t) + h(t) + εt</p><ul><li>g(t): piece wise linear or logistic growth curve for modelling non-periodic changes in time series</li><li>s(t): periodic changes (e.g. weekly/yearly seasonality)</li><li>h(t): effects of holidays (user provided) with irregular schedules</li><li>εt: error term accounts for any unusual changes not accommodated by the model</li></ul><p>Here we are trying to read the Funds data over the last past 4 years. First of all we will import all the necessary libraries which can help us in visualisation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*Iw6TK_7_FRIrTjtIDN-QTw.png" /><figcaption>Importing Libraries</figcaption></figure><p>After importing all the necessary libraries, now its time to load the CSV file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*3B_Trz9BWv1rrQz0unAjjA.png" /><figcaption>Loading CSV file in data Frame Format</figcaption></figure><p>After that make sure to set the date time column into index</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*0m-ej96acJo18LZpItIyFA.png" /></figure><p>Now plotting the raw data just to see our data behaviour:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*unLAx7xYVWj3JJAcFgrL5g.png" /><figcaption>Buying &amp; Selling Price variations</figcaption></figure><p>We will only focus on the Buying Price data since both Selling Price and Buying Price follows the same pattern i.e they can be called mirror images of each other.</p><p>After that we will convert our columns into Prophet library format where datetime column should be renamed with <strong>ds </strong>and other columns with <strong>y </strong>as shown in picture below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*MiTmuye70yxJsVb8TRR3Kw.png" /></figure><p>This is how your data should look like before being passed on to the Prophet library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*zkmTYIiKRUDtGejpUeA2pw.png" /></figure><h3>Using Prophet library</h3><p>Prophet recommends of using 80% of confidence interval but you can use more than that for higher accuracy of your model, here we have used 95% of confidence interval in my model</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*bFVgz0QfhjonRCyFezHUnA.png" /></figure><h3>Making future predictions</h3><p>It is up to us to decide how many days or years of prediction you want from your model, here we have selected 365 days of future prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*qAzprMgy1be8bcq4vlX1Ug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*pFZrv0NWp1SjZr0EFZSRsw.png" /></figure><p>Here the black dots actually represent the data from our data set and blue line shows the prediction values.</p><h3>Change in trend</h3><p>If you would like to see the change in trend of the data, where it actually changes and what is its behaviour then you should use this like I have done;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*bU7Idoukg9I4apLyzrO9lA.png" /><figcaption>Change in trend</figcaption></figure><p>Above the red dotted line represents the value where the actual change in trend took place whether it’s downwards or upwards.</p><h3><strong>Predicting Future Buying Price</strong></h3><p>For this we will use the following code where ds= date, trend=predicted trend yhat=predicted forecast, yhat_lower=lower bound for our predictions yhat_upper=upper bound for our predictions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*HgiqlPKVxVPh7-BvPgbIaw.png" /></figure><p>The above chart shows the future buying price with respect to its future dates along with their lower and upper bound predictions.</p><h3><strong>Finding Trend and Estimate of Buying Price</strong></h3><p>To find trend we have use trend variable and then plotted it on plotly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*K_204FFv2H9jIxJgTZ8TVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*vgt86j3J_u_QI939AIlpRQ.png" /><figcaption>Buying Price Trend</figcaption></figure><p>For estimation in buying price we used yhat variable where it shows how the buying units will change and what will be their value in future given dates of ours.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*nEfoqyiPpnxj1bbfjdpK9Q.png" /></figure><h3>Seasonality Prediction</h3><p>Prophet has the by default ability to predict the seasonality of your data in trends, weekly, yearly, monthly. Here we have shown the seasonality prediction of our data in weekly and yearly and portraying its trend too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*fqeNxuyU9VxD31fO26FXPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*rFhc6WGZPuXItS0VhTm-0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*Kg13hMH1nl7X7v3g3jV_fQ.png" /></figure><p>The above graph shows that buying price is the highest at the start of every month and it gradually goes down to the bottom at the month of July and than again it starts to rise, whereas, it’s highest on Sunday and lowest on Monday.</p><h3>Interactive Plotting</h3><p>If you are interested in more interactive plotting and wants to see changes along the mouse cursor then use the below code;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*Duf3lq8Xz4nfYSVYk7DxNw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*cjZRLEavdZvbX1f71MJVhQ.png" /><figcaption>Interactive Plotting</figcaption></figure><h3>Conclusion</h3><p>Here we have shown how Prophet library works and how you can use it in your time series data because of its innate function and by default seasonality function its much more convenient and easy to use than ARIMA.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb3bde21b314" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>