<?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 Nikolaus Herjuno Sapto Dwi Atmojo on Medium]]></title>
        <description><![CDATA[Stories by Nikolaus Herjuno Sapto Dwi Atmojo on Medium]]></description>
        <link>https://medium.com/@nikolaus.atmojo?source=rss-efedb1d56be8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OtOy23qnU8RFB-Mt</url>
            <title>Stories by Nikolaus Herjuno Sapto Dwi Atmojo on Medium</title>
            <link>https://medium.com/@nikolaus.atmojo?source=rss-efedb1d56be8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:41:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nikolaus.atmojo/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[Hacking Time-Series Forecasting Like a Pro with FBProphet]]></title>
            <link>https://medium.com/tokopedia-data/hacking-time-series-forecasting-like-a-pro-with-fbprophet-76f276f0a058?source=rss-efedb1d56be8------2</link>
            <guid isPermaLink="false">https://medium.com/p/76f276f0a058</guid>
            <category><![CDATA[tokopedia-data]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[forecasting]]></category>
            <category><![CDATA[timeseries]]></category>
            <category><![CDATA[tokopedia]]></category>
            <dc:creator><![CDATA[Nikolaus Herjuno Sapto Dwi Atmojo]]></dc:creator>
            <pubDate>Wed, 24 Jul 2019 01:58:19 GMT</pubDate>
            <atom:updated>2019-07-24T02:02:13.832Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DPiqMKMxIzfR-WxwOa4q9Q.jpeg" /></figure><p>Time-series Forecasting is widely known for its difficulty due to its inherent uncertainty. It seems very difficult to tell whether a series is categorized as stochastic or deterministic chaotic or even combination from both states. As Stephen Fry once said,</p><blockquote>“How can we understand the present or glimpse of our future if we cannot understand our past?”</blockquote><p>That applies to time-series forecast; if we cannot determine which method we can use, we cannot foresee the future.</p><h3>Time-Series Forecasting</h3><p>Before going to the time-series forecast, we should know what kind of data a time-series data is. Time-series data is a kind of data that has data points indexed or sequenced in time-based order. Examples of time-series data are the height of the ocean tides, the number of sunspots or even daily closing time of stock trade.</p><p>At Tokopedia, sometimes we use time-series forecasting to predict the number of customer service complaint tickets. Doing this allows us to establish monthly, quarterly, or annual capacity planning for our Customer Service Agent to answer the demand, or in this case, the number of complaint tickets.</p><p>Time-series forecast itself is one of the methods to create a model for predicting future values based on current and historical time series data. There are four components of time-series:</p><ol><li><strong>Trend</strong>: an increase or decrease of data; could be linear or nonlinear (logistics growth)</li><li><strong>Seasonality</strong>: a characteristic of time-series data when it experiences regular and predictable movement after a fixed period of time</li><li><strong>Cyclic</strong>: a cyclic pattern exists when the data experience rises or falls (regular or periodic fluctuation in data)</li><li><strong>Irregularity</strong>: the residual of time series after the trend-cycle and seasonal component are removed</li></ol><h3>What is FBProphet and When Will It Shine?</h3><p>Do you realize that someone with less knowledge of time-series forecasting skill can<strong> </strong>do time series forecasting? That’s why Facebook open-sourced its package called <em>FBProphet</em>. What is FBProphet? It’s a tool intended to help you to do time series forecasting <strong>at a scale with ease</strong></p><p>FBProphet uses decomposable time series model with 3 main components: seasonal, trends, holidays or events effect and error which are combined into this equation:</p><blockquote>f(x) = g(x) + s(x) + h(x) + e(t)</blockquote><p>FBProphet uses time as a regressor and tries to fit several linear and nonlinear function of time as components. By default, FBProphet will fit the data using a linear model but it can be changed to the nonlinear model (logistics growth) from its arguments.</p><p>Before deciding to use FBprophet, there are some data characteristics that should be met:</p><ol><li>Hourly, daily or weekly observation within at least a few months (minimum 1 month), but 1 year of historical data is much preferred</li><li>Having strong seasonalities: day of the week and time of the year</li><li>Important events or holidays that occur must be noted</li><li>A reasonable number of missing or outlier data</li><li>Historical trend changes</li></ol><p>If you meet those conditions, let’s get your hands dirty and experience the FBProphet magic!</p><h3>Preparing Data Sources</h3><p>In this tutorial, we use <a href="https://www.kaggle.com/airbnb/seattle"><em>Airbnb Seattle Open Data</em></a> taken from kaggle as our IDE. From this data set, we picked <em>Airbnb Seattle room booking per listing_id per day</em>; then, sum and average the price daily.</p><h3>Exploration</h3><p>The column of calendar.csv on Airbnb Seattle Open Data consists of the following information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/0*ctXMkhsLzHGsCWO3" /><figcaption>Column Information of calendar.csv</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*KUAUHRlfRQJRt9Q4oIqSCg.png" /><figcaption>Airbnb Calendar CSV to aggregated per date index</figcaption></figure><p>As seen above, the table consists some missing values. Although FBprophet will handle this kind of problem, we will aggregate the table by date per average and total price, and then set the date as the index.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OveAo5Jx76ssw2xg" /><figcaption>Total Price per date</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*B0Eu1y3_zGD4yWYv" /><figcaption>Average price per date</figcaption></figure><p>Both graphs show that at the beginning of the year, the price was relatively low and then it got higher at the end of Q1 to the end of Q2. We can assume that people have started preparing for their summer holiday and went for a vacation. You can double-check this event by using the date from the calendar. In this case, we used dates from United State Holiday calendar as a reference</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pTtIvGFJmR_VLOSy" /><figcaption>Average price per month</figcaption></figure><p>As shown in the graph, in July 2016, the average price for room reached $151 per night. We can conclude that the price started getting expensive in the mid-year.</p><h3>Saturating Forecast</h3><p>By default, FBProphet fits your model into a linear model. When forecasting grows, there are some points that will be on their maximum achievable points. We call this as carrying capacity and we should saturate the forecast growth.</p><p>Besides the linear model, FBProphet can opt to use logistics growth trend model instead by changing its argument:</p><ol><li><strong>Define the cap or maximum achievable point (optional) : </strong>In this case, we try to use a cap and have it as a column on our data frame. We define the value on 5.05 because the peak point on the data is on 5.05, so we will use this value as the cap.</li><li><strong>Define whether you want to use the linear model or logistics model (optional) : </strong>For this case, we won’t use the logistics growth number and let the model use its default setting for the linear model.</li></ol><h3>Trend Changepoints</h3><p>What is Trend Changepoints? Changepoints is the location, or in this case, the date or time index that defines a point when the data starts changing direction, either it is increasing or decreasing. To define trend changepoints at FBProphet, use one of these two methods:</p><ol><li>Specify trend changepoints flexibility</li><li>Specify the location of changepoints. It means you should define it as a data frame series when the trend starts to change</li></ol><p>If you work on the data that has less noise you can add manually the changepoints, but if you work on the data that has a lots of noise, it will take your time to add the changepoints</p><p>Tips ! You can use mean and standard deviation to filter the noise or even using IQR (Inter Quartile Range)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*x27UbuiVOYsQfb2Bvcs9Sg.png" /><figcaption>changepoint date function</figcaption></figure><p>In this case , the changepoints trend is specified by defining changepoint flexibility</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/0*F1Vk1J6-DZsKo_hF" /><figcaption>Prophet object model</figcaption></figure><p>We define the changepoint_prior_scale as the flexibility of trend changepoint to 0.095. Default value for changepoint_prior_scale is 0.05. Increasing it will make the trend more flexible.</p><h3>FB Prophet Model</h3><p>Generally, FBProphet Model Method consists of certain arguments such as:</p><pre><em>model = Prophet(data,<br>interval_width = 0.95,<br>yearly_seasonality = True,<br>weekly_seasonality = True,<br>daily_seasonality = True,<br>holidays = None,<br>changepoint_prior_scale = 0.05<br>)</em></pre><ul><li>Interval width will be the default at 95% confidence interval; this sets the uncertainty interval to produce a confidence interval around the predicted value</li><li>Yearly_seasonality / Weekly_seasonality / Daily_seasonality at default will be false, so you should change that to the seasonality that you will use</li><li>Holidays is the argument if you want to include holidays or event date</li><li>Changepoint_prior_scale is the flexibility of how the model will behave against trend changepoints</li></ul><p>The final code for the model and its arguments will be as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*oXuAAD_1r4NJbYkb" /></figure><p>On FBProphet, you can make yearly, monthly, weekly, daily or even hourly predictions in one go. For now, we only create a prediction for 60 data points on a daily level. The picture below is the result of the prediction</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ymR3ItxG92lvTDOD" /><figcaption>FB Prophet Forecasting result</figcaption></figure><h3>Forecast Components</h3><p>Forecast components can be produced in several view levels, such as how the trend will be on holidays, or on a weekly or yearly basis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*dOJ_Uv8su9swgbwg" /><figcaption><em>Forecast Components of FB Prophet</em></figcaption></figure><h3>Conclusion</h3><p>FBProphet is interesting, sophisticated and quite easy to implement. Even by using the default argument or parameter, this model allows you to generate good forecast output with little effort or domain knowledge in time-series analysis. While Prophet library is very powerful, there is an additional library that you need to incorporate to evaluate the model. We can do this by using sci-kit learns metric, but sometimes we need something more powerful to evaluate and validate the model, such as cross-validation over sliding windows from the data set.</p><p>You can access the jupyter notebook from <strong>this Kaggle </strong><a href="https://www.kaggle.com/nikomata/time-series-forecasting-airbnb-data-fbprophet"><strong>link</strong></a> in case you want to give it a try. There are many things that can be added or try such as splitting training and testing data, tune your seasonality and add your data trend changepoints, and handle your outlier using FBProphet. Not every time-series problem can be solved using FBProphet, and you can compare it using ARIMA, XGBoost, etc. Happy exploring!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76f276f0a058" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tokopedia-data/hacking-time-series-forecasting-like-a-pro-with-fbprophet-76f276f0a058">Hacking Time-Series Forecasting Like a Pro with FBProphet</a> was originally published in <a href="https://medium.com/tokopedia-data">Tokopedia Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preprocessing in Text Analytics]]></title>
            <link>https://medium.com/tokopedia-data/preprocessing-in-text-analytics-dd462c8d00d2?source=rss-efedb1d56be8------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd462c8d00d2</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[text-analytics]]></category>
            <category><![CDATA[tokopedia]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Nikolaus Herjuno Sapto Dwi Atmojo]]></dc:creator>
            <pubDate>Wed, 07 Nov 2018 10:19:45 GMT</pubDate>
            <atom:updated>2019-04-15T06:14:39.824Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*VZ3te-9_8YuKgaf2OVyulg.png" /></figure><p>It is a common knowledge that text does exist everywhere in every aspect of human being, such as newspaper, SMS, Wikipedia, or even chat conversation within our chat apps. Huge amount of text is produced everyday and lots of information and insights can be obtained from it.</p><p>Traditional Data Analysis is typically based on a relational model in which data is stored in the form of what we call as <strong>table</strong>. We call this form of data as <strong>structured data. </strong>However, only an approximate of 20% data is stored as structured data, so the rest of them is what we call as <strong>unstructured data </strong>(refers to: Big Data for Dummies Book)<strong><em>.</em></strong></p><p>Text is one of many forms of unstructured data. If we say that structured data is “big”, then unstructured data is definitely “huge”. Handling this type of data is not as easy as handling structured data. Computers are good at handling and processing structured data, because structured data is basically number at its core — how many times a page was visited, how long someone was on your site, what products they bought, where they came in from. However, what kind of interpretation can computer get from raw text?</p><p>Many businesses do some different approaches for this matter, one of them is applying brute forces and manual labor to read raw text manually, interpret emotion and sentiment, and then convert it into structured data as well as put it into visualization. Unfortunately, brute force is wasting time and not efficient.</p><p>Given this background, a concept called Text Analytics was born.</p><blockquote><strong>Text Analytics is a practice or set of processes of converting unstructured text data into meaningful data for analysis process.</strong></blockquote><p>As we can see, there is a word ‘converting’ in the definition above. So the question is, why should we convert the data? Why can’t we just feed the data to computer? The answer is, because computer is a machine that does not have the capability to know explicitly how to process text or words.</p><p>Then, how do we process the data so it can be processed by computer as machine? To overcome this, we should know how the data processed in something we call pipeline. In general, Text Analytics Pipeline can be illustrated as follow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*-dK6U1sOG-gMepK-IcAm1A.png" /><figcaption>Text Analytics Pipeline in general</figcaption></figure><p>As shown in the picture above, to get understandable insights and knowledge from text, there are several steps that should be taken: Preprocessing, Feature Extraction, Processing into Algorithm or Machine Learning Pipeline and Analytics Process. And at the end of the process, we can gain knowledge that allows us to do several things such as, sentiment analysis for product review or customer complaint, social media monitoring, email spam filter, or text summarization.</p><p>In this post, we will only cover the basic fundamental of Preprocessing in Text Data.</p><h3>Text Preprocessing</h3><p>Amazing things we can do with text analytics do not happen like magic. Instead, it takes effort for achieving it. As I mentioned before, machine does not understand text or word explicitly. This is why Preprocessing Data becomes a critical step in transforming data to be well-served for machine to be processed later by algorithm. The process includes five stages as follow.</p><h3>1. Sentence Segmentation (End of Sentence)</h3><p>Sentence Segmentation or EoS (End of Sentence) is a process where we take sentences within paragraphs in order to avoid feeding a whole paragraph to algorithm directly.</p><p>An example below shows 1 paragraph as the input and several sentences broken down from the paragraph as the output.</p><pre>In : [‘Monique Corzilius was born and raised in Pine Beach, New Jersey, the youngest of the three children of Fred and Colette Corzilius. While she was a child, her mother began taking her to New York City on child acting auditions. Working under the stage name Monique Cozy, her first job came at age two, modeling in a print advertisement for Lipton soup’] </pre><pre>Out : [[&#39;Monique Corzilius was born and raised in Pine Beach, New Jersey, the youngest of the three children of Fred and Colette Corzilius&#39;],[&#39;While she was a child, her mother began taking her to New York City on child acting auditions.&#39;],[&#39;Working under the stage name Monique Cozy, her first job came at age two, modeling in a print advertisement for Lipton soup&#39;]]</pre><p>These arrays of sentence will later be chopped up on the next process: Tokenization.</p><h3><strong>2. Tokenization / Chunking</strong></h3><p>Tokenization is a process of breaking sequences of string or character into smaller pieces called tokens. Tokens can be words, keywords, phrases, or even sentences itself. In the process of Tokenization, some characters like punctuation will be discarded.</p><p>Let us use the same sample from previous step of EoS.</p><pre>In : [&#39;Monique Corzilius was born and raised in Pine Beach, New Jersey, the youngest of the three children of Fred and Colette Corzilius&#39;]</pre><pre>Out : [&#39;Monique&#39;, &#39;Corzilius&#39;, &#39;was&#39;, &#39;born&#39;, &#39;and&#39;, &#39;raised&#39;, &#39;in&#39;, &#39;Pine&#39;, &#39;Beach&#39;, &#39;New&#39;, &#39;Jersey&#39;, &#39;the&#39;, &#39;youngest&#39;, &#39;of&#39;, &#39;the&#39;, &#39;three&#39;, &#39;childrens&#39;, &#39;of&#39;, &#39;Fred&#39;, &#39;and&#39;, &#39;Collete&#39;, &#39;Corzilius&#39;]</pre><p>As we can see, an array of sentence is chopped up into tokens. Sometimes the output of</p><p>Tokenization may not be accurate. Have a look at the result ‘Monique’ and ‘Corzilius’, and ‘New’ and ‘Jersey’. These tokens should be in one phrase, because it can not stand independently. Since we have this kind of problem, we need another process called<a href="https://nlpforhackers.io/text-chunking/"> <strong>Chunking</strong></a><strong>. </strong>Chunking will take into consideration part of speech in order to group some words into one phrase or chunk. Let’s use previous example for this matter :</p><pre>In : [&#39;Monique Corzilius was born and raised in Pine Beach, New Jersey, the youngest of the three children of Fred and Colette Corzilius&#39;]</pre><pre>Out : [‘Monique Corzilius’, ‘was’, ‘born’, ‘and’, ‘raised’, ‘in’, ‘Pine Beach’, ‘New Jersey’, ‘the’, ‘youngest’, ‘of’, ‘the’, ‘three’, ‘children’, ‘of’, ‘Fred’, ‘and’, ‘Colette Corzilius’]</pre><p>Instead of breaking ‘Monique Corzilius’ into 2 pieces of tokens, we keep this as 1 chunk.</p><h3><strong>3. Stop Words Removal</strong></h3><p>Sometimes, if you find some words that are extremely common on the document or even language, you can call it as stop words. Stop words hold less meaning than other words, so it is safe to discard stop words from documents. The simple ways to detect those words whether they are stop words or not are as follow:</p><ol><li>Let us say you have a collection of documents. Group and aggregate the document by its terms. You will get the total count of words in each term. This will serve as Term Frequency.</li><li>Sort for its term in a descending order.</li></ol><p>Some common words excluded from previous step’s example:</p><pre>In : [&#39;Monique&#39;, &#39;Corzilius&#39;, &#39;was&#39;, &#39;born&#39;, &#39;and&#39;, &#39;raised&#39;, &#39;in&#39;, &#39;Pine&#39;, &#39;Beach&#39;, &#39;New&#39;, &#39;Jersey&#39;, &#39;the&#39;,&#39;youngest&#39;, &#39;of&#39;, &#39;the&#39;, &#39;three&#39;, &#39;childrens&#39;, &#39;of&#39;, &#39;Fred&#39;, &#39;and&#39;, &#39;Collete&#39;, &#39;Corzilius&#39;]</pre><pre>Out : [&#39;Monique&#39;, &#39;Corzilius&#39;, &#39;born&#39;, &#39;raised&#39;, &#39;in&#39;, &#39;Pine&#39;, &#39;Beach&#39;, &#39;New&#39;, &#39;Jersey&#39;, &#39;youngest&#39;, &#39;the&#39;, &#39;three&#39;, &#39;childrens&#39;, &#39;Fred&#39;, &#39;Collete&#39;, &#39;Corzilius&#39;]</pre><p>We remove some common words (‘was’, ‘and’, ‘in’, ‘of’) to keep only tokens which hold more meaning than others. By reducing stop words, we can significantly minimize number of words or tokens that a system has to store. Some libraries such as NLTK in Python can handle this, but sometimes you need to define or at least have your own stop word list if the library does not support your language. Sometimes we can use TF-IDF (Term Frequency — Inverse Document Frequency) instead of TF (Term Frequency) to make our stop words. TF-IDF evaluates the importance of each word or token in sets of corpus or documents.</p><h3><strong>4. Stemming and lemmatization</strong></h3><p>For grammatical reasons, we may find that documents need to use different forms of words, such as organize, organization, organizing, or eat, eating, eaten, ate or etc. Both of stemming and lemmatization is normalized at the following examples.</p><pre>am, are, is =&gt; be</pre><pre>eat, eating, eaten, ate =&gt; eat</pre><pre>boy, boys, boy&#39;s =&gt; boy</pre><p><em>Stemming </em>usually refers to a process of removing words from its either prefix or suffix. So, the words or token are transformed into base forms. Different from stemming, lemmatization transforms words or token into base form, taking Part of Speech into account, rather than just derivational affixes.</p><h3><strong>5. Word Embedding / Text Vector</strong></h3><p>Word Embedding is a technique and modern way of representing words as vectors. The aim of this stage is to redefine high dimensional words features into low dimensional feature vectors. It represents words into X and Y vector coordinated. Common models that can be used are<a href="https://radimrehurek.com/gensim/models/word2vec.html"> <strong>Word2Vec</strong></a>,<a href="https://github.com/facebookresearch/fastText"> <strong>FastText.</strong></a></p><p>Text Vector itself is not just word embedding, it has many other techniques which can be used to transform text into vector, such as:</p><ol><li>Bag of Words</li><li>Continuous Bag of Words</li><li>One Hot Encoding</li><li>TF-IDF</li></ol><p>Preparing good and well-served text dataset is a complicated art which requires choosing and applying correct algorithm. Many pre-built Python libraries can help you a lot in text preprocessing especially NLTK, Scikit-Learn, but sometimes you should define your own function to do some cleaning on your text dataset. If you are interested in Text Analytics or Natural Language Processing, follow our blog!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJEp998491GN212bfizaUQ.jpeg" /><figcaption>Source: Pixabay</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd462c8d00d2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tokopedia-data/preprocessing-in-text-analytics-dd462c8d00d2">Preprocessing in Text Analytics</a> was originally published in <a href="https://medium.com/tokopedia-data">Tokopedia Data</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>