<?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 Eshban Suleman on Medium]]></title>
        <description><![CDATA[Stories by Eshban Suleman on Medium]]></description>
        <link>https://medium.com/@eshban9492?source=rss-5eb1baae9266------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WuMA1vtqeLY_F7ImqoH27g.jpeg</url>
            <title>Stories by Eshban Suleman on Medium</title>
            <link>https://medium.com/@eshban9492?source=rss-5eb1baae9266------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 01:47:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eshban9492/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[A Gentle Guide to Model Calibration]]></title>
            <link>https://eshban9492.medium.com/a-gentle-guide-to-model-calibration-76101ce3696f?source=rss-5eb1baae9266------2</link>
            <guid isPermaLink="false">https://medium.com/p/76101ce3696f</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Eshban Suleman]]></dc:creator>
            <pubDate>Mon, 26 Aug 2024 19:07:56 GMT</pubDate>
            <atom:updated>2024-08-26T19:07:56.712Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-li9mK-JJwLfs-Kjw8y7WA.jpeg" /></figure><h3>What is Model Calibration?</h3><p>Model calibration is the process of adjusting the predictions of a model to improve the accuracy of predicted probabilities or outcomes. In simpler terms, calibration ensures that the predictions made by a machine learning model are reliable and interpretable. Calibration is crucial for both classification and regression problems.</p><h3>Why is Model Calibration Important?</h3><p>An uncalibrated model can lead to inaccurate predictions and potentially disastrous decisions in real-life scenarios. For instance:</p><ul><li><strong>Medical Diagnosis</strong>: An uncalibrated model could predict a high probability of a patient having a disease when, in reality, the chance is much lower, leading to unnecessary stress and tests.</li><li><strong>Financial Forecasting</strong>: In stock price predictions, an uncalibrated model could cause incorrect investment decisions, resulting in significant financial losses.</li><li><strong>Weather Prediction</strong>: In weather forecasting, if a model is poorly calibrated, it might overestimate or underestimate the chances of rain, affecting agriculture, event planning, and daily activities.</li></ul><h3>Identifying Miscalibrated Models</h3><p>To detect miscalibrated models, one commonly used method is to examine the <strong>reliability graph</strong>, also known as the <strong>calibration curve</strong>. This graph plots the predicted probabilities from a model against the actual observed frequencies of the events. For a well-calibrated model, the points on the reliability graph should lie close to the diagonal line, where the predicted probability matches the observed frequency. For example, if a model predicts a 70% chance of rain, then, out of 100 such predictions, it should indeed rain around 70 times.</p><p>Deviations from the diagonal line indicate miscalibration: if the points lie above the diagonal, the model is underconfident, meaning it systematically predicts lower probabilities than the true likelihood; conversely, if the points lie below the diagonal, the model is overconfident, systematically predicting higher probabilities. Here’s an example of an uncalibrated model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*1hqJdYXARJngqwyZW2rpGQ.png" /><figcaption>Calibration Curve of an Uncalibrated Classifier</figcaption></figure><p>Following is a comparison between the calibration curves of a calibrated and uncalibrated classifier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*y64IOoOyRva7pzjl_rzUcA.png" /><figcaption>Calibration Curve Comparison b/w a Calibrated &amp; Uncalibrated Classifier</figcaption></figure><p>Additionally, statistical metrics such as the Brier score or the Expected Calibration Error (ECE) can quantify the degree of miscalibration. A high Brier score or ECE indicates a higher level of miscalibration, suggesting the need for recalibration</p><h3>Model Calibration in Classification Problems</h3><p>In classification problems, model calibration focuses on the predicted probabilities of different classes. A well-calibrated classification model will predict a probability that aligns closely with the actual likelihood of an event. For example, if a model predicts a 70% chance of rain, we expect it to rain 7 out of 10 times when it makes this prediction.</p><h4>Example of an Uncalibrated Classification Model</h4><p>Imagine a binary classification model that predicts whether a customer will buy a product (yes or no). If the model predicts a 90% probability of purchase, but only 50% of those customers actually buy the product, the model is poorly calibrated. This miscalibration can mislead decision-makers into overestimating the effectiveness of marketing campaigns.</p><h4>Common Calibration Techniques for Classification</h4><ul><li><strong>Platt Scaling</strong>: Uses a logistic regression model on the scores predicted by the original classifier to map them into calibrated probabilities.</li><li><strong>Isotonic Regression</strong>: A non-parametric approach that fits a piecewise constant or piecewise linear function to map predicted probabilities to calibrated probabilities.</li></ul><h4>Importance of Model Calibration for Imbalanced Datasets</h4><p>Model calibration is particularly important when dealing with imbalanced datasets. An imbalanced dataset is one where the number of instances in different classes varies significantly. For example, in a medical dataset predicting a rare disease, there might be 99% healthy patients and only 1% with the disease.</p><h4>Why Calibration Matters More in Imbalanced Datasets?</h4><ul><li><strong>Biased Predictions</strong>: Without proper calibration, a model trained on an imbalanced dataset might produce biased probability estimates that are overly confident in the majority class (e.g., predicting “healthy” with 99% confidence regardless of the input features).</li><li><strong>Misleading Probabilities</strong>: In the case of rare events, the model may not correctly estimate the actual risk or probability of the rare event occurring. A model might predict a 20% probability for a rare disease, but in reality, only 1% of those predicted to have a 20% risk actually have the disease.</li><li><strong>Decision-Making Impact</strong>: For tasks like fraud detection, medical diagnosis, or fault detection in industrial systems, miscalibrated probabilities can lead to missing important cases (false negatives) or raising unnecessary alarms (false positives).</li></ul><p>Calibrating the model helps ensure that even in the context of imbalance, the predicted probabilities are meaningful and accurate, leading to better decision-making and resource allocation.</p><h3>Model Calibration in Regression Problems</h3><p>In regression problems, calibration means that the model’s predicted values should align well with the actual values. In other words, a calibrated regression model should provide accurate uncertainty estimates.</p><h4>Example of an Uncalibrated Regression Model</h4><p>Consider a regression model that predicts house prices. If the model consistently predicts prices that are significantly lower or higher than the actual market prices, it is uncalibrated. This could result in real estate investors making poor investment decisions based on inaccurate price estimates.</p><h4>Common Calibration Techniques for Regression</h4><ul><li><strong>Quantile Regression</strong>: Provides a more detailed view of the predicted distribution by estimating conditional quantiles.</li><li><strong>Bayesian Methods</strong>: Incorporates prior distributions to better estimate uncertainty and improve calibration.</li></ul><h3>Real-Life Implications of Uncalibrated Models</h3><p>In real-life applications, the consequences of using uncalibrated models can be severe. Some implications in popular domains can be:</p><ul><li><strong>Healthcare</strong>: Misleading probabilities in diagnostic tools can lead to incorrect treatments.</li><li><strong>Finance</strong>: Uncalibrated risk models can result in poor investment choices and substantial financial loss.</li><li><strong>Autonomous Vehicles</strong>: Poorly calibrated perception models could cause an autonomous vehicle to misjudge distances, leading to accidents.</li></ul><h3>Conclusion</h3><p>Model calibration is a critical step in ensuring that the predictions made by machine learning models are trustworthy and interpretable. By calibrating a model, we make sure that the predicted probabilities reflect the true likelihood of an event, leading to more reliable decision-making in real-world applications. This is especially important in scenarios involving imbalanced datasets, where accurate probability estimates are crucial for minimizing the costs of false positives and false negatives. The Python example above illustrates how calibration can be easily implemented and demonstrates its effectiveness in improving model performance.</p><h3>References &amp; Further Reading</h3><ul><li><a href="https://github.com/EshbanTheLearner/Model-Calibration/blob/main/Model_Calibration_Tutorial.ipynb">Code @ GitHub</a></li><li><a href="https://towardsdatascience.com/a-comprehensive-guide-on-model-calibration-part-1-of-4-73466eb5e09a">A Comprehensive Guide on Model Calibration: What, When, and How</a></li><li><a href="https://scikit-learn.org/stable/modules/calibration.html">Probability Calibration</a></li><li><a href="https://www.sciencedirect.com/topics/computer-science/model-calibration">Model Calibration</a></li><li><a href="https://www.giskard.ai/glossary/model-calibration">Model Calibration in Machine Learning</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76101ce3696f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Evaluation Metrics for Time Series Forecasting]]></title>
            <link>https://eshban9492.medium.com/understanding-evaluation-metrics-for-time-series-forecasting-5c8a3c877654?source=rss-5eb1baae9266------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c8a3c877654</guid>
            <category><![CDATA[time-series-forecasting]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Eshban Suleman]]></dc:creator>
            <pubDate>Thu, 04 Jul 2024 17:55:06 GMT</pubDate>
            <atom:updated>2024-07-04T17:55:06.420Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JZXEZ72UXiKoYyad" /><figcaption>Photo by <a href="https://unsplash.com/@nampoh?utm_source=medium&amp;utm_medium=referral">Maxim Hopman</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What is Time Series?</h3><p>A time series is a sequence of data points collected or recorded at specific time intervals. These data points represent values of a variable over time and are used to analyze patterns, trends, and seasonal variations to make forecasts or understand underlying processes. Examples of time series data include daily stock prices, monthly sales figures, annual rainfall measurements, and hourly temperatures.</p><h3>Time Series Applications in Real World</h3><p>Time series analysis and forecasting are essential in numerous domains due to their ability to model temporal patterns and predict future values based on historical data. In finance, time series are used to forecast stock prices, interest rates, and economic indicators, aiding in investment decisions and risk management. In retail, businesses use time series to predict sales, manage inventory, and optimize supply chains. In meteorology, time series forecasting helps in predicting weather patterns, climate change, and natural disasters. Healthcare utilizes time series for patient monitoring, disease outbreak prediction, and resource allocation. Additionally, in energy, time series analysis is vital for predicting demand, optimizing grid operations, and managing renewable energy sources. Overall, the versatility of time series analysis makes it indispensable across a wide range of industries, enabling data-driven decision-making and strategic planning.</p><h3>Evaluating Time Series Forecasting Models</h3><p>When building and evaluating time series forecasting models, it’s crucial to use appropriate error metrics to measure the accuracy of the predictions. These metrics help us understand how well a model performs and guide us in choosing the best model for our forecasting needs. Commonly used error metrics include:</p><ul><li>Mean Absolute Error (MAE)</li><li>Mean Squared Error (MSE)</li><li>Root Mean Squared Error (RMSE)</li><li>Mean Absolute Percentage Error (MAPE)</li><li>Symmetric Mean Absolute Percentage Error (sMAPE)</li><li>Mean Absolute Scaled Error (MASE)</li><li>Weighted Absolute Percentage Error (WAPE)</li></ul><h3>Mean Absolute Error (MAE)</h3><p>MAE is the average of the absolute differences between the actual and predicted values. It gives an idea of how much the predictions deviate from the actual values on average.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/174/0*rm-VkSDD-QuGwsQd" /></figure><pre>from sklearn.metrics import mean_absolute_error<br><br>y_true = [3, -0.5, 2, 7]<br>y_pred = [2.5, 0.0, 2, 8]<br>mae = mean_absolute_error(y_true, y_pred)<br>print(f&quot;MAE: {mae}&quot;)</pre><p><strong>Pros:</strong></p><ul><li>Easy to understand and interpret.</li><li>Not sensitive to outliers.</li></ul><p><strong>Cons:</strong></p><ul><li>Does not account for the scale of the data.</li></ul><h3>Mean Squared Error (MSE)</h3><p>MSE is the average of the squared differences between the actual and predicted values. It emphasizes larger errors due to the squaring operation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/181/0*LPEvsJexKl20HQ4U" /></figure><pre>from sklearn.metrics import mean_squared_error<br><br>mse = mean_squared_error(y_true, y_pred)<br>print(f&quot;MSE: {mse}&quot;)</pre><p><strong>Pros:</strong></p><ul><li>Penalizes larger errors more than smaller errors.</li><li>Differentiable, useful for optimization algorithms.</li></ul><p><strong>Cons:</strong></p><ul><li>Sensitive to outliers.</li><li>Harder to interpret due to squaring.</li></ul><h3>Root Mean Squared Error (RMSE)</h3><p>RMSE is the square root of MSE. It provides an error metric on the same scale as the original data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/215/0*NEZ9wePYnnuEWAPz" /></figure><pre>import numpy as np<br><br>rmse = np.sqrt(mean_squared_error(y_true, y_pred))<br>print(f&quot;RMSE: {rmse}&quot;)</pre><p><strong>Pros:</strong></p><ul><li>Same units as the original data, making it interpretable.</li><li>Penalizes large errors, highlighting poor performance.</li></ul><p><strong>Cons:</strong></p><ul><li>Sensitive to outliers.</li></ul><h3>Mean Absolute Percentage Error (MAPE)</h3><p>MAPE is the average of the absolute percentage errors between the actual and predicted values. It expresses the error as a percentage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/209/0*Bjcn1LFUak-ocZRf" /></figure><pre>def mean_absolute_percentage_error(y_true, y_pred): <br>    y_true, y_pred = np.array(y_true), np.array(y_pred)<br>    return np.mean(np.abs((y_true - y_pred) / y_true)) * 100<br><br>mape = mean_absolute_percentage_error(y_true, y_pred)<br>print(f&quot;MAPE: {mape}&quot;)</pre><p><strong>Pros:</strong></p><ul><li>Scale-independent, useful for comparing across datasets.</li><li>Easy to interpret as a percentage.</li></ul><p><strong>Cons:</strong></p><ul><li>Undefined for zero actual values.</li><li>Can be biased if the actual values are very small.</li></ul><h3>Symmetric Mean Absolute Percentage Error (sMAPE)</h3><p>sMAPE is a modified version of MAPE that treats over- and under-forecasting equally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/0*86xbp6DUsxEjQTrW" /></figure><pre>def symmetric_mean_absolute_percentage_error(y_true, y_pred):<br>    return 100/len(y_true) * np.sum(2 * np.abs(y_pred - y_true) / (np.abs(y_true) + np.abs(y_pred)))<br><br>smape = symmetric_mean_absolute_percentage_error(y_true, y_pred)<br>print(f&quot;sMAPE: {smape}&quot;)</pre><p><strong>Pros:</strong></p><ul><li>Scale-independent.</li><li>Balances the treatment of over- and under-forecasting.</li></ul><p><strong>Cons:</strong></p><ul><li>Can be less interpretable than MAPE.</li><li>Sensitive to small values in the denominator.</li></ul><h3>Mean Absolute Scaled Error (MASE)</h3><p>MASE scales the absolute errors based on the in-sample mean absolute error from a naive forecast method. This makes it easier to interpret the forecast accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/0*2GKlAwKdupzIRmZB" /></figure><pre>def mean_absolute_scaled_error(y_true, y_pred):<br>    n = len(y_true)<br>    d = np.abs(np.diff(y_true)).sum()/(n-1)<br>    errors = np.abs(y_true - y_pred)<br>    return errors.mean()/d<br><br>mase = mean_absolute_scaled_error(y_true, y_pred)<br>print(f&quot;MASE: {mase}&quot;)</pre><p><strong>Pros:</strong></p><ul><li>Scale-independent.</li><li>Useful for comparing forecast methods across different series.</li></ul><p><strong>Cons:</strong></p><ul><li>Requires in-sample data to calculate the naive forecast error.</li><li>More complex to compute than other metrics.</li></ul><h3>Weighted Absolute Percentage Error (WAPE)</h3><p>WAPE is a variant of the Mean Absolute Percentage Error (MAPE), where the absolute errors are weighted by the actual values. It provides a more balanced view of forecast accuracy, especially useful when dealing with data with varying scales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/0*AEHE8dzEbq1SpQHP" /></figure><pre>def weighted_absolute_percentage_error(y_true, y_pred):<br>    return np.sum(np.abs(y_true - y_pred)) / np.sum(np.abs(y_true)) * 100<br><br>wape = weighted_absolute_percentage_error(y_true, y_pred)<br>print(f&quot;WAPE: {wape}&quot;)</pre><p><strong>Pros:</strong></p><ul><li>Scale-independent.</li><li>Provides a more balanced view of forecast accuracy for datasets with varying scales.</li><li>Easy to interpret as a percentage.</li></ul><p><strong>Cons:</strong></p><ul><li>Can be biased if actual values are very small.</li><li>Less commonly used compared to other metrics.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/953973df7d9224ded8fc46163ee3c187/href">https://medium.com/media/953973df7d9224ded8fc46163ee3c187/href</a></iframe><p>By choosing the appropriate error metric based on the specific characteristics of the time series data and the forecasting goals, you can better assess the performance of your forecasting models and make more informed decisions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c8a3c877654" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Feature Engineering in NLP]]></title>
            <link>https://eshban9492.medium.com/feature-engineering-in-nlp-7d89bf47f7ae?source=rss-5eb1baae9266------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d89bf47f7ae</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[feature-engineering]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Eshban Suleman]]></dc:creator>
            <pubDate>Thu, 10 Feb 2022 16:02:15 GMT</pubDate>
            <atom:updated>2022-02-10T16:02:15.247Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-JsZMLw9RGaKNdBfmjGZoQ.jpeg" /></figure><p>Welcome to the 3rd chapter from “The NLP Grimoire” series. In the <a href="https://eshban9492.medium.com/how-to-collect-parse-and-clean-text-data-c5e4fa88e71">last chapter</a>, we learned about the process of collecting, parsing and cleaning text data. In this chapter, we will learn about feature engineering, its importance and how you can extract features from text data. So, without any further delay, let’s get cooking.</p><h3>What is Feature Engineering?</h3><p>Feature engineering is a process of extracting meaningful information from the raw data to make it usable for machine learning models. Features are essentially the inputs for your ML models. It is one of the most critical steps in any data-driven task and can make or break your system. To understand the concept of feature extraction, let’s talk about it from a computer vision perspective.</p><p>Let’s talk about GoogLeNet for a bit. GoogLeNet is a deep learning model trained on the ImageNet dataset. When visualizing what the model’s layers have learnt, we find that the first layer detects edges, the following layer have learned to recognise textures. Next layers have learned to detect patterns, followed by parts and objects. These are visualized below and you can interactively view them <a href="https://distill.pub/2017/feature-visualization/">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w_eSoS4v5qzx_mDFvgjglw.png" /><figcaption><a href="https://distill.pub/2017/feature-visualization/"><em>Image Source</em></a></figcaption></figure><p>This view helps us visualize how a deep neural network will classify an input image. It will detect some edges, recognize textures, identify patterns and parts and based on all the information it collects from these features, it’ll finally make a prediction. But usually, we don’t have enough time, resources and data to train a deep neural network for automatic feature extraction. Here feature engineering comes into play. Using the domain knowledge we have about the problem, we can come up with a set of features that best represents the data and can be used as an input to our machine learning models. This approach gives us almost as good results as deep neural networks without the hassle of collecting tons of data and spending lots of time and resources.</p><h3>Feature Engineering in NLP</h3><p>Now, based on our understanding of feature engineering, how can we translate it to the text data. Firstly and most importantly, it is essential to understand our problems completely. Some techniques can be useful for a certain type of problem only. For example, for some problems we might need to extract grammatical features from data whereas for some problems, we might need to just get the most frequently occurring words only. It is important to note that feature engineering in NLP is a little different from the other types of data. In NLP, we are dealing with language or texts, so to derive inputs for our machine learning models, we would need to transform our text into some sort of numeric representation so computers can process it. One of our goals would be to represent our text in a computer-friendly manner.</p><h3>Extracting Features from Text</h3><p>In this section, we will learn about the common feature extraction techniques and methods. We’ll also talk about when to use them and some challenges we might face implementing those techniques. Feature extraction methods can be divided into 3 major categories, basic, statistical and advanced/vectorized. Let’s talk about it.</p><h3>Basic Methods</h3><p>These feature extraction methods are based on various concepts from NLP and linguistics. These are some of the oldest methods but still can be very reliable are used frequently in many areas. Let’s discuss a few.</p><h4>Parsing</h4><p>Now, this parsing is a little different from what we discussed in the last chapter where we parsed different types of documents into text. In this context, parsing is a process of breaking a sentence (or some text) into smaller chunks that helps us understand the syntactic structure and syntactic meaning of the sentence. In NLP, rules of context-free grammar (CFG) or probabilistic context-free grammar (PCFG) are used to analyze sentences. Building a parser from scratch is a very complex task in itself. We would pick a grammar like CFG or PCFG, then decide upon which type of parser we want to build. Based on that, we would implement certain algorithms to build our very own parser. We certainly don’t have to do it every time and can use pre-built tools. To learn more about parsing in detail, click <a href="https://www.analyticsvidhya.com/blog/2021/12/dependency-parsing-in-natural-language-processing-with-examples/">here</a>. Now, let’s see how you can break down a sentence into its syntactic components using spaCy.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D5&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D5&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F9eb5ceb5eeec47e3920e90cacbc182ea%2Fpreview%2Fd45400940d95473ebe3c7a5617ffae19&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/e75af72a14912b97c925505f76e79877/href">https://medium.com/media/e75af72a14912b97c925505f76e79877/href</a></iframe><p>You can extract grammatical features like noun phrases, PoS tags for words in those phrases, root words from sentences etc. In practice, we rarely develop a parser from scratch. Also, we only use parsing to extract grammatical when dealing with problems that require such grammatical features e.g. grammar correction systems.</p><h4>Challenges</h4><ul><li>It is difficult to develop a parser of languages that do not have a tagged corpus e.g. Hebrew.</li><li>It is a complex procedure and requires some degree of domain knowledge.</li></ul><h4>PoS Tagging</h4><p>Parts of Speech (PoS) tagging is the process of marking each word in a corpus with their corresponding part of speech. A tagger or a PoS tagger is a tool that assigns the relevant PoS tag to a given word. Tagging is a tricky task because the part of speech can vary based on the meaning of the sentence as a whole. Although it is possible to develop your very own PoS tagger using an annotated corpus, some manually selected features and a machine learning algorithm, we’ll mostly need to use an already available tagger. We can use the polyglot library to extract PoS tags as follows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D7&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D7&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F9eb5ceb5eeec47e3920e90cacbc182ea%2Fpreview%2Fd45400940d95473ebe3c7a5617ffae19&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b9b1e7a0152dfe1f0ff36d5b5d924c4/href">https://medium.com/media/9b9b1e7a0152dfe1f0ff36d5b5d924c4/href</a></iframe><p>PoS tags can be really useful in a bunch of different applications like chatbots, information extraction systems, information retrieval etc.</p><h4>Challenges</h4><ul><li>An annotated corpus is required to develop an accurate parser and it is difficult to find annotated corpora for many languages.</li><li>Also, identifying the correct PoS tag in an ambiguous syntactic structure is quite difficult.</li></ul><h4>Name Entity Recognition (NER)</h4><p>As the name suggests, it is a process of extracting named entities i.e. noun phrases that represent real-world objects like person, location, organization etc from some text. For example, in the sentence “Barack Obama is from Hawaii”, Barack Obama is an entity (person) and Hawaii is another entity (location). We can use spaCy’s NER tool to extract entities as follows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D9&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D9&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F9eb5ceb5eeec47e3920e90cacbc182ea%2Fpreview%2Fd45400940d95473ebe3c7a5617ffae19&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/854a33a32231f5a50c037944697f0175/href">https://medium.com/media/854a33a32231f5a50c037944697f0175/href</a></iframe><p>NER features are very useful in use cases where we might need to search for some information in a large corpus. It can be used in information extraction, information retrieval, search and recommendation systems.</p><h4>Challenges</h4><ul><li>NER tools trained on a specific domain will find it hard to generalize to other domains.</li><li>Words that are used for multiple categories can cause some inaccuracies.</li><li>Acronyms and words from other languages can also cause some minor inaccuracies.</li></ul><h4>Bag of Words (BoW)</h4><p>Unlike the previously discussed techniques, BoW simplifies the representation of the language and rules out complexities like grammar, syntactic structure etc. BoW just represents text in a form of a collection like a bag/set of words where the text can be in the form of documents, sentences etc. Consider the following example.</p><p>Sentence 1: Matt is a fan of football.</p><p>Sentence 2: He also likes to cook occasionally.</p><p>Sentence 3: He is a nice guy.</p><p>Based on these sentences, we can create a BoW list as follows.</p><p>BoW_List = [“Matt”, “is”, “a”, “fan”, “of”, “football”, “He”, “also”, “likes”, “to”, “cook”, “occasionally”, “nice”, “guy”]</p><p>Using this BoW, we can calculate and represent each document based on its term frequency.</p><p>Sentence 1: [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]</p><p>Sentence 2: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0]</p><p>Sentence 3: [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]</p><p>These features can be fed to machine learning algorithms. We can calculate BoW using the scikit-learn library as follows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D11&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D11&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F9eb5ceb5eeec47e3920e90cacbc182ea%2Fpreview%2Fd45400940d95473ebe3c7a5617ffae19&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/598af78d970dcb39607c85527ea09228/href">https://medium.com/media/598af78d970dcb39607c85527ea09228/href</a></iframe><p>BoWs can be used in a wide variety of NLP tasks like document classification, neural feature generation, sentiment analysis etc.</p><h4>Challenges</h4><ul><li>The length of our feature vector can drastically increase the number of words in our vocabulary.</li><li>This is a fairly naive approach and can result in a sparse matrix which we usually want to avoid.</li><li>No information about the syntax or context is preserved in this method.</li></ul><h3>Statistical Methods</h3><p>This is a bit more advanced feature extraction method and uses the concepts from statistics and probability to extract features from text data. We’ll look at the most common statistical feature extraction technique now.</p><h4>Term Frequency-Inverse Document Frequency (TF-IDF)</h4><p>Unlike the words that occur once or twice, words that occur frequently in a document are more important. But the words that occur very frequently like “a”, “the” etc are not important and doesn’t carry any meaning. TF-IDF aims to satisfy these two constraints and helps us extract meaningful words from documents. The first component of TF-IDF is the term frequency method. Let’s see how it works.</p><p>Term-Frequency, as the name suggests calculates the frequency of each of the words present in a document/dataset. The equation for calculating the TF of a term t is as follows.</p><p>TF(t) = (Number of times term t appears in a document) / (Total number of terms in the document)</p><p>Now, let’s talk about the IDF component. IDF gives higher weightage to the terms that occur only in a few documents. Such terms are useful for discriminating those documents. Its equation is as follows.</p><p>IDF(t) = log10(Total number of documents / Number of documents with termt t in it)</p><p>Hence, our TF-IDF equation would be as</p><p>TF-IDF = TF*IDF</p><p>We usually don’t have to implement the TF-IDF algorithm ourselves and can use scikit-learn for it as follows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D14&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D14&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F9eb5ceb5eeec47e3920e90cacbc182ea%2Fpreview%2Fd45400940d95473ebe3c7a5617ffae19&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/526ffb54bb03b0b405d7d41c3e6218b3/href">https://medium.com/media/526ffb54bb03b0b405d7d41c3e6218b3/href</a></iframe><p>TF-IDF is used vastly in NLP. You can use TF-IDF for text analysis, summarization, search, document classification etc.</p><h4>Challenges</h4><ul><li>Doesn’t capture important information like position, context, semantics etc.</li></ul><h3>Advanced Methods</h3><p>These methods can also be called vectorized methods as they aim to map a word, sentence, document to a fixed-length vector of real numbers. The goal of this method is to extract semantics from a piece of text, both lexical and distributional. Lexical semantics is just the meaning reflected by the words whereas distributional semantics refer to finding meaning based on various distributions in a corpus. Now let’s talk about the most common method.</p><h4>Word2Vec</h4><p>As the name suggests, this technique aims to map a word to a fixed-length vector. We can train a neural network to generate word2vec embeddings for any kind of text data. But why is that helpful and how does it store semantics? We’ll try to give you a simplistic view, for more details on word2vec, click <a href="https://towardsdatascience.com/introduction-to-word-embedding-and-word2vec-652d0c2060fa">here</a> and <a href="https://www.youtube.com/watch?v=UqRCEmrv1gQ">here</a>. In simple terms, words that have similar meanings or are related closely, when mapped into a vector space would appear closer, like in a cluster. This can help us understand the semantics of the words in a sentence better than any previously mentioned technique. Consider the following diagram.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGFikSfa05bbEGgN-e3n4g.png" /><figcaption><em>Source: </em><a href="https://developers.google.com/machine-learning/crash-course/embeddings/translating-to-a-lower-dimensional-space"><em>Embeddings: Translating to a Lower-Dimensional Space</em></a></figcaption></figure><p>In this image, we can see some word vectors visualized in 2D space. Notice how we can establish semantic relationships e.g. a man is to a woman what a king is to a queen or Moscow is Russia’s capital like Rome is Italy’s capital. These properties help us build amazing applications. We can train our very own Word2Vec model on our custom corpus or we can also use pre-trained word2vec embeddings. In the following example, we are training a word2vec model on the Game of Thrones corpus. Visit the <a href="https://github.com/EshbanTheLearner/the-NLP-Grimoire/tree/main/Chapter-3">repository</a> for detailed code.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D20&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D20&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F9eb5ceb5eeec47e3920e90cacbc182ea%2Fpreview%2Fd45400940d95473ebe3c7a5617ffae19&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/bef9273664209584a45e7d54af6a56ac/href">https://medium.com/media/bef9273664209584a45e7d54af6a56ac/href</a></iframe><p>Once the model is trained, we can visualize some words in our vocabulary like this.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D27&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D27&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F9eb5ceb5eeec47e3920e90cacbc182ea%2Fpreview%2Fd45400940d95473ebe3c7a5617ffae19&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/dba34e623fab3558dd0378cf11274259/href">https://medium.com/media/dba34e623fab3558dd0378cf11274259/href</a></iframe><p>We can also perform interesting tasks like finding the most similar words as below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D23&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D23&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F9eb5ceb5eeec47e3920e90cacbc182ea%2Fpreview%2Fd45400940d95473ebe3c7a5617ffae19&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab3259c1c26fbb8a47c3b9603daab0f6/href">https://medium.com/media/ab3259c1c26fbb8a47c3b9603daab0f6/href</a></iframe><p>We can also perform an odd-one-out operation like this.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D24&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-3%2Fv%2F1%26cellId%3D24&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F9eb5ceb5eeec47e3920e90cacbc182ea%2Fpreview%2Fd45400940d95473ebe3c7a5617ffae19&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/d3e5137bf5676ea2ac4528776dc27ee9/href">https://medium.com/media/d3e5137bf5676ea2ac4528776dc27ee9/href</a></iframe><p>There are many other vectorization techniques like Doc2Vec, GloVe, ELMO etc but WordVec serves as a basis for those as well. Word2Vec embeddings can be used in almost every NLP task. We can use it in dependency parsing, Named Entity Recognition (NER), sentiment analysis, semantic text similarity, document classification, word clustering and many more.</p><h4>Challenges</h4><ul><li>Word2Vec cannot handle out of vocabulary words very well.</li><li>Doesn’t take the context of the word into account.</li><li>Requires fairly large corpus to train on.</li></ul><h3>Key Takeaways</h3><ul><li>Use grammatical features like PoS Tagging, NER, Parsing when your problem requires you to work with the structure of the language</li><li>Use statistical features like TF-IDF when you have a large corpus and you want to simplify them into fewer words for your application</li><li>Use vectorized embeddings like word2vec when your applications require to work with the semantics of the language</li></ul><p>All the examples can be found on my GitHub <a href="https://github.com/EshbanTheLearner/the-NLP-Grimoire">here</a>. Follow me on my <a href="https://eshban9492.medium.com/">Medium</a>, <a href="https://twitter.com/EshbanSuleman">Twitter</a> and <a href="https://www.linkedin.com/in/eshban-suleman-624a49113/">LinkedIn</a> to interact and stay updated for more content like this. Happy learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d89bf47f7ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Collect, Parse, and Clean Text Data?]]></title>
            <link>https://eshban9492.medium.com/how-to-collect-parse-and-clean-text-data-c5e4fa88e71?source=rss-5eb1baae9266------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5e4fa88e71</guid>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Eshban Suleman]]></dc:creator>
            <pubDate>Thu, 27 Jan 2022 17:06:20 GMT</pubDate>
            <atom:updated>2022-01-27T17:06:20.561Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NZEK8zj08BqnYO07UjwiYw.jpeg" /></figure><p>Welcome to the second chapter from the NLP Grimoire series. In the <a href="https://eshban9492.medium.com/an-introduction-to-natural-language-processing-2f9e248b782b">last chapter</a>, we learned what NLP is all about and what are some tasks we usually do in NLP, along with some common applications of NLP. In this chapter, we will discuss the process of selecting an appropriate dataset for your problem, what to do if such a dataset doesn’t exist, what factors to consider while procuring a DIY dataset, how to scrape data from a website, how to parse such data and different steps involved in cleaning text data. So, without any further adieu, let’s get cooking.</p><h3>Data Collection</h3><p>Always remember the fundamental principle of “garbage in, garbage out” while working on any data-driven problem. Picking the right dataset requires an understanding of what makes a dataset “right”. Let’s try to understand that in context to NLP.</p><h4>Corpus</h4><p>A corpus (plural corpora) is a collection of machine-readable texts which acts as a representative of language or some task in language. For example, <a href="https://www.english-corpora.org/coca/">Corpus of Contemporary American English (COCA)</a> is a billion-word corpus that represents the English language. Corpora play an essential role in NLP and it is important for every NLP practitioner to understand its nuances. Although open source corpora are readily available for different tasks in NLP, there can be some situations where we might need to collect a corpus of our own. It is recommended to do extensive research to see if an appropriate dataset is available for your problem because if it is, it will save you a lot of time, money and hassle. A quick Google might help you a lot in this regard.</p><p>In case of not being able to find an appropriate corpus, you will have to think about curating a corpus of your own. Although it is a very detail-oriented and gruesome task, here are some of the questions you can ask yourself while working on a DIY dataset.</p><h4>Is my data representative?</h4><p>A corpus would be representative of a language if the findings based on it can be generalized to that particular language. Ask yourself whether you need a <em>sample corpus</em>, which is a static view of a task or language like the <a href="https://www.sketchengine.eu/brown-corpus/">Brown corpus</a>, or a monitor corpus, which is updated frequently to capture changes in language over time like the <a href="https://www.english-corpora.org/coca/help/compare-wbo.asp">Bank of English (BoE)</a> corpus. You will also have to ask yourself whether you need a <em>general</em> or a <em>specialized</em> corpus. A general corpus, for example, the <a href="https://www.english-corpora.org/bnc/">BNC</a>, serves as a basic description/representation of a language whereas a specialized corpus would be specific to a certain domain or genre like medicine or law. Also, think about the sampling methods you have at your disposal and choose the correct one according to your needs.</p><h4>How much data do I need?</h4><p>The size of the corpus usually doesn’t matter these days due to improved storage capacities and computation powers. The more, the better seems to be the general approach. But just remember that if a smaller corpus can get your job done, there is no need to spend time, money and energy collecting huge amounts of data.</p><h4>Do I need to worry about copyright?</h4><p>Simply put, yes. Although there are a lot of open-source corpora available, there are times when you might need to collect data from the web, as it is a humongous archive of all kinds of data. In case you need to use printed publications, DO NOT use them without officially receiving permission to use it. You could find yourself in real legal trouble if you decide to use copyrighted material, especially to make money. You should also read about the “fair use” policy for copyrights.</p><h4>What about data annotation?</h4><p>Data annotation is the process of labelling data in such a way that machines can use them. For example, a corpus of 100,000 Amazon reviews might not tell you enough, but when labelled with their respective sentiment, you can build a pretty good sentiment analyzer from that data. Labelling data requires a lot of time and human labour. You should always consider how much time and labour would it require to label your data before collecting it. Even if you don’t want a labelled dataset, you still will have to provide a lot of metadata, data about data for people who might want to use it in future.</p><h4>Data Scraping</h4><p>Data scraping is the process of downloading raw data from a webpage and storing it in a structured format. Data scraping itself is a vast topic and there are multiple tools available for it. In this chapter, we will use a library called BeautifulSoup along with some other standard libraries to collect some data from a Wikipedia page about The Office. Look at the code below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttp%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D3&amp;dntp=1&amp;display_name=Jovian&amp;url=http%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D3&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fb058cf6c3c55094963e75de803dd67/href">https://medium.com/media/1fb058cf6c3c55094963e75de803dd67/href</a></iframe><p>In the above code, we are downloading a webpage from the URL and then parsing it in an HTML tree structure to extract data using HTML tags and classes. Since this was a static page, it was pretty straightforward and easy to scrape data from it but when you need to scrape data from the dynamic website where you need to interact with Javascript event handlers, you should work with <a href="https://selenium-python.readthedocs.io/">Selenium</a> or <a href="https://docs.scrapy.org/en/latest/">Scrapy</a>.</p><h3>Data Parsing</h3><p>Data parsing is the process of converting data from one format to another, for example, HTML to textfile. In this section, you’ll learn about some common data parsing libraries that you can use. You’ll learn to handle and parse data from different formats like textfiles, PDFs, HTML etc.</p><h4>Text and Flat Files</h4><p>You can read text from text and flat files as follows. Also, refer to this notebook for more methods.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D6&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D6&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/48f5f08424b5cb472c2b38c05c3c11a2/href">https://medium.com/media/48f5f08424b5cb472c2b38c05c3c11a2/href</a></iframe><h4>PDF</h4><p>There are a couple of different libraries available for reading from PDFs but we’ll use the following method.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D10&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D10&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/02c502c01ae8279131964226503108bd/href">https://medium.com/media/02c502c01ae8279131964226503108bd/href</a></iframe><h4>Word Document</h4><p>Here’s how to parse data from a word document.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D13&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D13&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5d57430a7395525d686d298dbd3e153/href">https://medium.com/media/b5d57430a7395525d686d298dbd3e153/href</a></iframe><h4>HTML/XML</h4><p>Although very different, both HTML and XML are markup languages and can be parsed using similar methods using BeautifulSoup as we did in data scraping above.</p><h4>JSON</h4><p>JSON is a very popular data type and it can be parsed as follows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D15&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D15&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3e7ef63d218ea49c8b648f793cea02b/href">https://medium.com/media/b3e7ef63d218ea49c8b648f793cea02b/href</a></iframe><h3>Data Preprocessing</h3><p>Data preprocessing is the process of cleaning and transforming the data to ensure getting the best performance. It is one of the most essential steps in any data-driven task and it helps maintain data quality. When talking about text, there are certain methods used in order to make sure we are getting the best quality of data. In this section, we will perform some cleaning steps on the Twitter dataset to understand different methods of preprocessing.</p><h4>Regular Expressions</h4><p>Regular expression is one of the strongest tools to have in your arsenal. It is a language to search for patterns in strings, for example, you can find all words ending with ‘es’ in a corpus. Regular expressions can be intimidating at first but I recommend learning them by doing. Learn the patterns from <a href="https://www.dataquest.io/blog/regex-cheatsheet/">here</a> and practice <a href="https://www.regexpal.com/">here</a>. Also, have a look at the official <a href="https://docs.python.org/3/library/re.html">documentation</a> of Python re. We will use regular expressions to remove old retweet tags (RT), numerics, punctuations, and hyperlinks. Read comments on the code understand what each regular expression will do.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D22&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D22&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4cb1401da106e4d34f971e9f7e7e125/href">https://medium.com/media/c4cb1401da106e4d34f971e9f7e7e125/href</a></iframe><h4>Lower Casing</h4><p>Since string data is case sensitive, it always helps to convert your text data into lower case. It is quite straightforward and can be done using a single line of code as follows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D24&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D24&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/51e821f499cd0f5fc222da84f0991b7e/href">https://medium.com/media/51e821f499cd0f5fc222da84f0991b7e/href</a></iframe><h4>Tokenization</h4><p>As described in the previous chapter, tokenization is the process of splitting text into smaller units called tokens. Tokens can be any length, from sentences to phrases to words to subwords. It all depends on what you are trying to achieve, i.e. your problem statement. For our example, we don’t sentence tokenization, we’ll just use word tokenization. Following is the code for word tokenization.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D26&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D26&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/c15053f01261a0d7302947cce96690a0/href">https://medium.com/media/c15053f01261a0d7302947cce96690a0/href</a></iframe><h4>Stopword Removal</h4><p>Stopwords are commonly occurring words in a language that doesn’t convey a lot of meaning in a sentence and are usually removed during text preprocessing to focus on more informative and meaningful words. We can remove stopwords as follows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D28&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D28&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/239f5dda6fab55dd50b501350b5d9a5f/href">https://medium.com/media/239f5dda6fab55dd50b501350b5d9a5f/href</a></iframe><h4>Text Normalization</h4><p>Text normalization is a process of reducing the noise or the randomness of the text by transforming the words into a standard form. Some NLP researchers consider tokenization and lower-casing a part of normalization processes as well but commonly normalization consists of 2 different processes that are mentioned below.</p><h4>Stemming</h4><p>Stemming is the process of transforming a word into its stem, or base word. It is a rule-based, naive and less accurate version of lemmatization. We will not use stemming in our example.</p><h4>Lemmatization</h4><p>Lemmatization is almost like stemming, the only difference is that it aims to reduce a word to its base form which is also a dictionary word. We can carry out the process of lemmatization of our text as follows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D31&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D31&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/06a4ab0141837a1a77ac77c8ec757c10/href">https://medium.com/media/06a4ab0141837a1a77ac77c8ec757c10/href</a></iframe><h4>Bonus: Word Cloud</h4><p>Here’s a word cloud that visualizes the most frequent words in negative tweets.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D35&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-2%2Fv%2F1%26cellId%3D35&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fjvn%2Fassets%2Feshbanthelearner%2Fprofile_images%2F10b15260cf6f4170aa130fc480ebe75c%2Fmedium.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/16ab10667cc17d7b5e6e16136b195f62/href">https://medium.com/media/16ab10667cc17d7b5e6e16136b195f62/href</a></iframe><h3>Key Takeaways</h3><ol><li>Data quality is of the utmost importance</li><li>Understand your problem statement</li><li>Spend time cleaning your data to improve its quality</li></ol><p>All the examples can be found on my GitHub <a href="https://github.com/EshbanTheLearner/the-NLP-Grimoire">here</a>. Follow me on my <a href="https://eshban9492.medium.com/">Medium</a>, <a href="https://twitter.com/EshbanSuleman">Twitter</a> and <a href="https://www.linkedin.com/in/eshban-suleman-624a49113/">LinkedIn</a> for more content like this. Happy learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5e4fa88e71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction to Natural Language Processing]]></title>
            <link>https://eshban9492.medium.com/an-introduction-to-natural-language-processing-2f9e248b782b?source=rss-5eb1baae9266------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f9e248b782b</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Eshban Suleman]]></dc:creator>
            <pubDate>Thu, 13 Jan 2022 16:21:21 GMT</pubDate>
            <atom:updated>2022-01-13T16:45:09.094Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*d1wMcYoJcxrDTXrF.jpg" /></figure><p>Welcome to the first chapter of the NLP Grimoire! A series that will enable its diligent readers to harness the power of NLP and create cosmically powerful applications. All you need to know is some Python programming. This chapter will be a little more theoretical but it is suggested to code along with the given examples. So, let’s get cooking.</p><h3>What exactly is NLP?</h3><p>Imagine 5, 10 or 15 years from now. How do you think you would interact with the tech of that time? Now some tech-savvy people might say we’d just think and it’ll happen and that’s not entirely incorrect. But most of you would say that you’d be able to talk to the machines and they’ll be able to understand you. <br> That is what Natural Language Processing aims to achieve. It is a collection of techniques and methods that makes human language accessible to computers. But what is human language? We, humans, use a medium to express our feelings, thoughts and ideas. That medium is called language. Whatever we speak, read, write and listen to is in the form of human language otherwise known as natural language. So, processing language in a way that enables computers to understand what is being communicated and respond back properly is the goal of NLP. In some fancy words,</p><blockquote>“Natural Language Processing is an interdisciplinary field of Artificial Intelligence, Computational Linguistics, Computer Science and many other disciplines and it focuses on the interactions between computers and human language”</blockquote><p>Now that we have an idea of what NLP means, let’s talk about how it is interdisciplinary and how different domains of knowledge lend their methods to form something as powerful as NLP. Although there are many disciplines that influence NLP, we will discuss some major ones. Have a look at the diagram below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pu6CEP1QsSvA6l7fyqS7zw.png" /><figcaption>Relationship of NLP with other domains</figcaption></figure><p>Let’s talk about these disciplines for a moment and try to understand how NLP draws knowledge from them.</p><h3>Computational Linguistics</h3><p>Computational linguistics and natural language processing are often used synonymously but there is a difference. Computational linguistics is the study of language with the help of computational modelling. Language itself is the focus here. Whereas in NLP, the focus is on developing techniques and algorithms to represent human language in a way that computers can understand it and enabling computers to make use of this understanding in a practical way. Simply put, computational linguistics is a theoretical study of language and NLP is a more practical, engineering-focused discipline.</p><h3>Computer Science</h3><p>Computer science has been relevant to NLP for a long time. From the times of classical NLP to the modern age of big data, computer science has been providing NLP with powerful, precise and efficient tools. Be it the Formal Language Theory to model language or algorithm analysis to analyze the computational complexity of algorithms, or parallelization to process huge amounts of text data, computer science has made the lives of NLP practitioners easier.</p><h3>Artificial Intelligence</h3><p>Artificial Intelligence is the branch of computer science which deals with the development of machines that can perform various tasks with human-level performance. One such task is interaction with humans. Achieving the level of human-like conversation is one of the indicators of achieving intelligence (see <a href="https://en.wikipedia.org/wiki/Turing_test">Turing Test</a>). AI guides NLP to reason and make intelligent decisions concerning language.</p><h4>Machine Learning</h4><p>Machine Learning is a branch of AI that focuses on developing systems that can automatically learn and improve with experience without being explicitly programmed. A lot of modern NLP can also be classified under ML research with a few distinct differences here and there like the discrete nature of text data or the compositional nature of language. We can use ML in conjunction with NLP to develop systems that can learn and get better with experience.</p><h3>Neurolinguistics</h3><p>Neurolinguistics is the study of the brain’s capacity to comprehend, produce and learn human language. The ultimate goal is to understand how exactly our brain functions to deal with various aspects of language. Once we have an understanding of how it is done, we can try to model it mathematically and then translate it into an intelligent system. Unlike vision, language is still to be understood at a deeper level.</p><p>Now that we’ve talked about how NLP draws its power from different dimensions of various disciplines, let’s try to understand what are some of the common problems that we have to solve in NLP.</p><h3>Tasks in NLP</h3><p>Analysis and processing of language are often categorized into three stages or phases. Syntactic, semantic and pragmatic. Another initial stage that is often not mentioned in the Lexical analysis stage which logically precedes syntactic analysis. Each of these phases has many constituents, but we don’t use all of them every time. We are not even required to follow all these phases. It all depends upon the problem at hand and the kind of data we have. This categorization just helps in understanding these concepts. Have a look at this picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OZJzUl9_vWjHzaaLAyG5uQ.png" /><figcaption>Tasks in NLP</figcaption></figure><p>Let’s go through these phases one by one.</p><h3>Lexical Analysis</h3><p>Lexical analysis is the process of analyzing and trying to understand what words mean. We study lexemes in lexical analysis. A lexeme is just a sequence of characters often related to the morpheme, which is the smallest linguistic unit with some meaning. Lexical analysis is most often the first step in processing language. Many tasks fall under the umbrella of lexical analysis but we will have a look at the most common ones.</p><h4>Tokenization</h4><p>Tokenization is the process of splitting text into smaller units called tokens. Tokens can be either characters, subwords, words, phrases, or sentences. It is one of the most common tasks in NLP and you might use it for almost every problem. Tokenization isn’t as straightforward as one might think. For example, in languages like Chinese, Japanese, Thai, it is impossible to tokenize using white spaces as we do in the English language. Different languages employ different tokenizers and the choice of tokenizers depends upon requirements. Basic tokenization can be done easily in Python using the NLTK library.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D5&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D5&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F7391f36a313b4cda8ab1ed24292a70e3%2Fpreview%2Fec2a5f9349374becb98a1835a7e6a6c6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ee72ea6d2516517f7fd742fe8023f52/href">https://medium.com/media/8ee72ea6d2516517f7fd742fe8023f52/href</a></iframe><h4>Morphological Analysis</h4><p>Morphological analysis is the study of determining the morphemes of given words. Morphemes are the smallest units of words that carry some meaning. Unlike tokenization, it operates on a subword and word level. For example, “mangoes” can be decomposed into “mango” (stem word) and “es” (suffix to show plurality). Following is code to extract morphemes from words using Python library Polyglot.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D7&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D7&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F7391f36a313b4cda8ab1ed24292a70e3%2Fpreview%2Fec2a5f9349374becb98a1835a7e6a6c6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b576faead54890295dc5bb4969180146/href">https://medium.com/media/b576faead54890295dc5bb4969180146/href</a></iframe><h4>Stemming</h4><p>It is the process of reducing a word into its stem or base word. Stemming usually serves as a quick solution and is based upon handwritten rules and this isn’t as accurate as one might think. But for most NLP applications it doesn’t matter much. Following is how you can perform stemming using NLTK.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D9&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D9&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F7391f36a313b4cda8ab1ed24292a70e3%2Fpreview%2Fec2a5f9349374becb98a1835a7e6a6c6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c99bc026a94843557141d1efea50fbf/href">https://medium.com/media/5c99bc026a94843557141d1efea50fbf/href</a></iframe><h4>Lemmatization</h4><p>Lemmatization is almost like stemming, the only difference is that it aims to reduce a word to its base form which is also a dictionary word. In doing so it achieves better accuracy than stemming but is slower. Following is the code to perform lemmatization using the NLTK library.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D11&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D11&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F7391f36a313b4cda8ab1ed24292a70e3%2Fpreview%2Fec2a5f9349374becb98a1835a7e6a6c6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/b47089d3071c90be25467a2fada52fe2/href">https://medium.com/media/b47089d3071c90be25467a2fada52fe2/href</a></iframe><h3>Syntactic Analysis</h3><p>A sentence is the smallest unit of language that can convey a thought, idea or proposition. But sentences are not just a bunch of words, there is a certain level of structure that is important to understand to extract the correct meaning of the sentence. For example, consider the sentence “ <em>The boat sailed on the river sank</em>” ( <a href="https://www.dailycal.org/2018/11/19/6-sentences-that-literally-make-no-sense-but-are-still-correct/">source</a>). This sentence is grammatically correct is difficult to understand unless you know that the word “sailed” is not used as a verb here. Syntactic analysis not only ensures that sentences are grammatically correct but also help us understand their meaning. Some common tasks that fall under this phase are as follows.</p><h4>Parts of Speech Tagging</h4><p>Parts of Speech tagging (PoS tagging) is the process of marking the words in a text with their respective, well, part of speech depending upon their meaning and context. This helps in validating grammar as well as understanding ambiguous sentences. You can perform PoS tagging using NLTK like this.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D16&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D16&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F7391f36a313b4cda8ab1ed24292a70e3%2Fpreview%2Fec2a5f9349374becb98a1835a7e6a6c6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/f21eda4b4b70bf2c4423b2b83d47f25b/href">https://medium.com/media/f21eda4b4b70bf2c4423b2b83d47f25b/href</a></iframe><h4>Syntactic Parsing</h4><p>Grammar in the language is used to define some rules and it describes the language. We can use grammar to disambiguate sentences and try to understand their true meaning. We can also verify if sentences are grammatically correct. It heavily employs formal language theory concepts like Context-Free Grammar, Finite and Pushdown Automata etc. We can define our grammar in NLTK and construct syntax trees.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D14&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D14&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F7391f36a313b4cda8ab1ed24292a70e3%2Fpreview%2Fec2a5f9349374becb98a1835a7e6a6c6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/44b6a8bcee19c6976c293ca543df3f22/href">https://medium.com/media/44b6a8bcee19c6976c293ca543df3f22/href</a></iframe><h3>Semantic Analysis</h3><p>Semantic analysis is all about trying to understand the intended meaning of sentences. It considers the literal meaning as well as the context to make sense of the sentences. There is heavy use of machine learning methods in this phase as we intend our system to continue to learn while maintaining a steady knowledge about the language. Following are some of the tasks that can be categorized under the semantic analysis phase.</p><h4>Word Sense Disambiguation</h4><p>Word Sense Disambiguation (WSD) involves resolving the ambiguity in the texts due to certain words by trying to figure out the actual sense of such words. For example, consider the word “bank”. It can have different meanings and we humans can figure out the right meaning due to context and our vast knowledge. But if we want computers to understand a text better, we would need them to be able to differentiate between different senses. WSD can use either knowledge-based, machine learning-based or a rule-based approach. You can perform WSD using NLTK as follows.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D19&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D19&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F7391f36a313b4cda8ab1ed24292a70e3%2Fpreview%2Fec2a5f9349374becb98a1835a7e6a6c6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d000ad5f2967ebdc5f5660862a4449b/href">https://medium.com/media/5d000ad5f2967ebdc5f5660862a4449b/href</a></iframe><h4>Semantic Role Labelling</h4><p>In this task, we try to make sense of an input sentence in terms of the scene it portrays so we can assign certain roles to entities and ask questions like who did what to whom etc. AllenNLP uses the latest and very powerful SRL BERT model for this purpose and you can use it online <a href="https://demo.allennlp.org/semantic-role-labeling">here</a>.</p><h4>Textual Entailment</h4><p>Textual Entailment is the task of verifying a direct relationship between two pieces of text. Have a look at the examples from the 3rd PASCAL RTE Challenge (<a href="https://aclanthology.org/W07-1401.pdf">source</a>) below. Our goal is to understand the semantic i.e. meaning of these texts so we can predict the entailment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*VbdA1kZOQ3dVBsVVCnjbwg.png" /><figcaption>3rd PASCAL RTE Challenge</figcaption></figure><h3>Pragmatic Analysis</h3><p>The final phase is the pragmatic analysis which is concerned with discourse. It tries to establish the meaning of the conversation with all of its contexts. Previously, we were dealing with smaller units of speech like words or sentences, but this phase takes the context of the entire conversation or text and then aims to understand what is being meant exactly.</p><h4>Co-Reference Resolution</h4><p>In this task, we try to determine which phrases in a document refer to the same entity. For example, in the sentence “John put the carrot on the plate and ate it”, what is “it” referring to? This problem becomes complex when more entities are involved and documents are longer. We can use the Stanford NLP library for this purpose.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjovian.ai%2Fembed%3Furl%3Dhttps%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D22%26hideOutput%3Dtrue&amp;dntp=1&amp;display_name=Jovian&amp;url=https%3A%2F%2Fjovian.ai%2Feshbanthelearner%2Fchapter-1%2Fv%2F1%26cellId%3D22%26hideOutput%3Dtrue&amp;image=https%3A%2F%2Fjovian.ai%2Fapi%2Fgist%2F7391f36a313b4cda8ab1ed24292a70e3%2Fpreview%2Fec2a5f9349374becb98a1835a7e6a6c6&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=jovian" width="800" height="200" frameborder="0" scrolling="no"><a href="https://medium.com/media/620ed5ae430df4f4cd84888b1d6c22b4/href">https://medium.com/media/620ed5ae430df4f4cd84888b1d6c22b4/href</a></iframe><p>Now that we have understood what NLP is and what are some tasks we need to do in NLP, let’s have a quick overview of the applications of NLP.</p><h3>Applications of NLP</h3><p>According to an estimate by IBM (<a href="https://www.altexsoft.com/blog/structured-unstructured-data/">source</a>), the amount of data is expected to reach 175 zettabytes by 2025. 1 zettabyte is equal to 1 trillion gigabytes. There are 12 zeros in a trillion. And out of all the data we have, 80% of it is unstructured including but not limited to audios, videos, text documents etc. And as we humans communicate using languages, we have built linguistic interfaces with a lot of machines. There are a ton of NLP applications but I’m going to list a few major ones below.</p><ul><li>Chatbots and Virtual Assistants like Siri, Alexa etc</li><li>Machine Translation like Google Translate</li><li>Search Engines like Google, Bing etc</li><li>Autocorrect and Autocomplete like in all smartphones</li><li>Targeted Advertisement</li><li>Email Filtering like spam blockers in Gmail</li><li>Sentiment Analysis</li><li>Text Summarization</li><li>Automatic Image Captioning</li><li>Text Generation</li><li>…many others…</li></ul><h3>Takeaways</h3><p>Key takeaways from this article are</p><ol><li>NLP is a set of methods that enables humans and computers to interact in natural language</li><li>Tasks in NLP can be divided into lexical, syntactic, semantic and pragmatic stages.</li><li>NLP is used everywhere around us and is an important part of our technology.</li></ol><p>All the examples can be found on my GitHub <a href="https://github.com/EshbanTheLearner/the-NLP-Grimoire">here</a>. Follow me on my <a href="https://eshban9492.medium.com/">Medium</a>, <a href="https://twitter.com/EshbanSuleman">Twitter</a> and <a href="https://www.linkedin.com/in/eshban-suleman-624a49113/">LinkedIn</a> for more content like this. Happy learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f9e248b782b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A 100 Day #thePersonalMSDS Journey]]></title>
            <link>https://eshban9492.medium.com/a-100-day-thepersonalmsds-journey-796933e3aeb1?source=rss-5eb1baae9266------2</link>
            <guid isPermaLink="false">https://medium.com/p/796933e3aeb1</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Eshban Suleman]]></dc:creator>
            <pubDate>Sat, 04 Sep 2021 19:46:02 GMT</pubDate>
            <atom:updated>2021-09-04T19:49:21.447Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eU5Bmzb6tpf1gKfOz4Lsfw.png" /></figure><p>The Machine Learning landscape is in a state of continuous change. New research, technologies and tools are put out every day. This sometimes makes it hard to keep up with the latest trends. Besides that, the vastness of the domain can induce the imposter syndrome in practitioners. This is perfectly put in the following tweet</p><h3>Michael A Osborne on Twitter: &quot;In machine learning, the span of time betweenfeeling like a fraud for not yet having learned enough, tofeeling like a fraud because you are out of touch is about zero minutes. / Twitter&quot;</h3><p>In machine learning, the span of time betweenfeeling like a fraud for not yet having learned enough, tofeeling like a fraud because you are out of touch is about zero minutes.</p><p>I too had felt this over the years. Either I feel that I know too little or feel like I’m out of touch. To combat this, I’ve been following some challenges to get in touch with my skills and learn new ones along the way. One of the challenges I recently completed is #thePersonalMSDS.</p><p>#thePersonalMSDS was an initiative by one of my seniors, <a href="https://www.linkedin.com/in/mhjhamza/">Muhammad Hamza Javaid</a> to get industry professionals and students to follow a self-curated Data Science Masters roadmap to develop new skills and hone existing ones. The partaker can decide the number of days (usually 100) and the number of hours they want to dedicate towards learning per day. I first came across it in January 2020 and decided to pledge for 100 days of following a customized roadmap. I completed the challenge from January 13th 2020 to April 22nd 2020. During those 100 days, I studied various topics with the help of online courses and articles. Some of the things I studied back then included</p><ul><li>Statistics and Probability</li><li>Big Data with Apache Spark</li><li>AI for Business</li><li>Investment Fundamentals &amp; Data Analytics</li><li>Data Engineering on GCP</li><li>Basic Bash Scripting and Shell Programming</li><li>Data Science Project Management</li></ul><p>As it might be seen, I customized my learning path based on my needs and interests. This challenge not only helped me learn new skills but also to get on top of my existing skills. More recently I pledged the last 100 days, from May 26th 2021 to September 2nd 2021 to the #thePersonalMSDS challenge. I learned some new topics that I hadn’t learned before and also worked on some of the skills that I already have. I got a discount coupon for Databricks Data Science Pathway and I spent 36 days completing it. I earned 41 certificates in these 36 days, some of which you can check <a href="https://github.com/EshbanTheLearner/Certifications">here</a>. Some other topics/technologies that I studied apart from this were</p><ul><li>Deploying Machine Learning Models</li><li>Spatial Analysis and Geospatial Data Science</li><li>Data Privacy</li><li>ElasticSearch (ELK Stack)</li><li>HuggingFace Transformers</li><li>Customer Segmentation</li><li>Time Series Analysis and Forecasting</li></ul><p>You can track my detailed learnings <a href="https://github.com/EshbanTheLearner/thepersonalMSDS-v2/blob/main/todayilearned.md">here</a>. A question that I get a lot is how I find the motivation to start and continue. This is a great question and it is a very common problem. I too have gone off the track a few times so, through the process of trial and error, I worked out some methods that work for me. I hope you find them useful too.</p><h3>Plan Ahead of Time</h3><p>A good plan will help you stay on top of your skills and it’ll show how self-aware you are regarding your strengths and weaknesses. I like to make 2 separate lists, one dedicated to topics and skills that I want to learn and one for the skills that I’ve already learnt but either feel out of touch with or just want to study in-depth. Then I pick topics from both lists that I feel are both important and fun. Remember, you can always add or redact topics later.</p><h3>Find a Community</h3><p>Get your friends and/or colleagues to sign up for the challenge with you. If nobody wants to join, find people on the internet with the same interests. Become a part of online study groups. Most importantly share your daily progress on the internet with proper hashtags. It’ll get you the exposure you need to find people that are interested in what you’re doing and keep you motivated to meet the daily goal.</p><h3>Stay Positive</h3><p>Maintaining a routine like this along with work or studies can be cumbersome and frustrating at times. Sometimes it may feel like you are going nowhere but that is the moment where you need to look at how far you’ve come, how many new things you’ve learned, how many people you connect with along the way. This will help you stay positive and motivated.</p><h3>Take Breaks</h3><p>Self-learning is all about flexibility. You don’t need to burden yourself with covering a lot of topics in a short period of time. If you’re feeling tired, just take a break. Take as many breaks as necessary to relieve your stress and come back more focused. You are your own in charge.</p><h3>Have Fun</h3><p>The most important factor in staying motivated is to have fun while learning. The more you make your learning fun, the more you’ll look forward to it. Everyone has their own methods of having fun, e.g. you can do mini-projects using the skills you’re learning, make video tutorials, write blogs about it etc. I like to take handwritten notes and do mini-projects. You pick your poison.</p><p>So, if you are planning to learn something new or even brush up on your skills, start today, start now because tomorrow never comes. I wish you all the very best for your future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=796933e3aeb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alternatives to Google Patents]]></title>
            <link>https://medium.com/traindex/alternatives-to-google-patents-ad4c076571a7?source=rss-5eb1baae9266------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad4c076571a7</guid>
            <category><![CDATA[patent-litigation]]></category>
            <category><![CDATA[prior-art]]></category>
            <category><![CDATA[patent-search]]></category>
            <category><![CDATA[patents]]></category>
            <dc:creator><![CDATA[Eshban Suleman]]></dc:creator>
            <pubDate>Sat, 20 Feb 2021 09:56:01 GMT</pubDate>
            <atom:updated>2021-02-22T16:02:04.464Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Mtxuzq2MQdGO259w.jpg" /></figure><p>There are multiple tools available over the internet to check the similarity of a claim or a patent. There are pros and cons of every tool and a user can sometimes have a hard time deciding what to use where. In such situations, people tend to use the services they trust. People tend to rely on big tech companies when it comes to choosing between a variety of options because they are perceived to be doing well in every area. Such is the case with Google Patents.</p><p>Although Google Patents is a well all-round search engine for patent data, it does have some disadvantages. In this article, we will have a look at some of the more obvious cons of Google Patents and will also proceed to look at some other services available online. And if you are not familiar with the concepts of patent search or how to conduct a patent search, have a look at our article <a href="https://www.traindex.io/blog/patent-search-4j05">Patent Search</a>.</p><p>This article is not aimed at disregarding Google Patents as a search engine for patents, instead, the goal of this article is to get the reader familiar with some alternatives to using Google Patents. So, let’s, first of all, discuss why one might decide to not use Google Patents.</p><h3>1. Semi Semantic Behavior</h3><p>Google Patents has been observed to show semi-semantic behavior. It is a keyword-based search at its core but it can extract some semantically similar results. Sometimes it can be useful but most of the time it searches for unrelated synonyms. Following is an example of this behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PyDUhyAGRTIw9tZ8sacGHQ.png" /></figure><p>It is not necessarily bad behavior but it does affect the results.</p><h3>2. Bad with Acronyms</h3><p>As with all keyword-based searches, Google Patents also seem to struggle with the acronyms. The most common example of it is the acronym AIDS (Acquired Immune Deficiency Syndrome) which is often misinterpreted with the word “aids”, a verb with the meaning of “to help”. So you might get a lot of false positives if your query contains such acronyms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AOhQkTu5Wkdq5UMxltpEDg.png" /></figure><h3>3. Empty Results</h3><p>Google Patents shows the keyword search behavior here as well. If the keywords are very unique then it might show zero results. Semantic search engines usually shine in this department but Google Patents is not one of them.</p><h3>4. Unable to Process Scientific Jargon</h3><p>Patents usually cover complex novel scientific inventions and thus have a lot of “science language”, but it is observed that Google Patents is usually unable to get results if queried with scientific jargon for example chemical formulas, etc.</p><h3>5. Missing Citations</h3><p>There’s been a case of some missing patents which occurred during data transfer. Due to this, citations are missing in some of the patents.</p><h3>6. Disclosure Risk</h3><p>Google tracks its search activity according to its <a href="https://policies.google.com/privacy?hl=en">Privacy Policy</a>. According to <a href="https://www.uspto.gov/web/offices/pac/mpep/s904.html">MPEP 904.02(c)</a> of Manual of Patent Examining Procedure by the United States Patent and Trademark Office (USPTO), examiners are allowed to use tools and the internet to search for the prior art of any claim under examination but are not allowed to use any proprietary information as query, instead, they are advised to use a general state of the art query to get similar results. Simply put, to check whether the claim under inspection is similar or identical to any published claim, you can use any service on the internet but you shouldn’t provide any information about the claim that might expose its privacy. Since Google Patents is a keyword-based search, it is difficult to come up with a query that maintains the balance of the privacy of your claims and search for any similar or identical existing claim. Thus your case might always be at risk if Google Patents is being used.</p><p>I think these are more than enough reasons to try something different this time. Let’s now discuss some of the alternatives to Google Patents.</p><h3>Patentscope</h3><p><a href="https://patentscope.wipo.int/search/en/search.jsf">Patentscope</a> is a patent search service by the World Intellectual Property Organization ( <a href="https://www.wipo.int/portal/en/index.html">WIPO</a>). You can search over 92 million patents worldwide and can also enhance your search results by filtering them using certain meta-level filters. It is a free global search engine technology information. It doesn’t employ any spelling correction technique nor does it enable to use chemical compounds as a query on the open version. Also, it strictly searches for words in the query and not their other forms, so no lemmatization is observed. It also returns zero results if even one word in the query is out of its vocabulary.</p><h3>Escapenet</h3><p><a href="https://worldwide.espacenet.com/">Escapenet</a> by European Patent Office (EPO) is also a keyword-based patent search on over 120 million patents. It has all the characteristics of keyword search such as advanced search features and metadata-based filters. Unlike Patentscope, it uses lemmatization to get different word forms too and supports multiple European languages. The base search only allows up to 10 keywords.</p><h3>lens.org</h3><p><a href="https://www.lens.org/">lens.org</a> provides search services for different scholarly datasets including patent data of 125.4 million patent records. It has very fine-grained advanced search filters and has patents from all around the world. It uses Apache Lucene and Elasticsearch for text search and shows a semi-semantic behavior. It also supports spelling correction and handles acronyms better than the previous two options. Still, it doesn’t search for chemical compounds, etc, and is susceptible to return empty results.</p><h3>Traindex</h3><p><a href="https://www.traindex.io/">Traindex</a> is a semantic search engine, unlike others in this list. It uses Machine Learning to find patents that are semantically similar to the query. It searches over Google Public Patents Data and can be integrated very easily into your applications. It can accept texts of various lengths, you can enter whole patent documents and it will handle that easily. Since it is a semantic search engine, it outstands in retrieving desired results for even a very unique set of queries. One of the things that make it stand out is that it doesn’t track search data and lets you use their API safely. Does this look like something you want to know more about? How about you schedule a demo <a href="https://www.traindex.io/">here</a> and we will walk you through the process.</p><p>The goal of this article was to point out some areas where Google Patents falls short and to provide you with some alternative resources so you can use the right tool for your problems, without compromising privacy and security. If you’re still confused, you can reach us at help@traindex.io and we would be happy to guide you more.</p><p><em>Originally published at </em><a href="https://www.traindex.io/blog/alternatives-to-google-patents-4j4b"><em>https://www.traindex.io</em></a><em> on February 20, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad4c076571a7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/traindex/alternatives-to-google-patents-ad4c076571a7">Alternatives to Google Patents</a> was originally published in <a href="https://medium.com/traindex">Traindex</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event Driven Data Pipelines in AWS]]></title>
            <link>https://medium.com/traindex/event-driven-data-pipelines-in-aws-ce12872a6820?source=rss-5eb1baae9266------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce12872a6820</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Eshban Suleman]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 07:18:52 GMT</pubDate>
            <atom:updated>2023-06-03T16:40:57.185Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4f6ifrr5Z8ETvqmKglgOA.jpeg" /></figure><p>In a data-driven organization, there is a constant need to provide vast amounts of data to the teams. There are many tools available to aid your requirements and needs. Choosing the right tool can be a little challenging and overwhelming at times. The basic principle you can keep in mind is that there is no right tool or architecture, it depends on what you need.</p><p>In this guide, I’m going to show you how to build a simple event-driven data pipeline in AWS. Pipelines are often scheduled or interval based, however, the event-driven concept is unique and a good starting point. Instead of trying to figure out the right intervals of the pipeline activation, you can use an event handler to deal with certain events to activate your pipeline.</p><p>To learn more about which problem we were solving in Traindex and why the data pipeline was the right choice for us, refer to my previous article <a href="https://www.traindex.io/blog/introduction-to-data-pipelines-26o7">Introduction to Data Pipelines</a>.</p><p>As an example, we would be using the “Sentiment140 dataset with 1.6 million tweets” which is available on Kaggle. Our goal would be to set up a data preprocessing pipeline. Once you have uploaded the CSV file in a specified bucket, an event is generated. A lambda function would handle that event and will activate your pipeline. Your data pipeline would be AWS Data Pipeline which is a web service that helps you process and move data between different AWS compute and storage services. This pipeline would divide a compute resource and run your preprocessing code in that resource. Once your data is cleaned and preprocessed, it will upload it to the specified bucket for later use. Based on these objectives, we can divide our task into the following sub-tasks:</p><ul><li>Creating a pre-configured</li><li>Defining AWS data pipeline architecture</li><li>Writing the event handler AWS Lambda</li><li>Integrating everything</li></ul><p>Before diving into the steps, make sure you have the following preconditions met</p><ul><li>You require an AWS account with certain IAM privileges</li><li>Make sure you have already downloaded the data from “Sentiment140 dataset with 1.6 million tweets”</li><li>Active internet connection</li></ul><h3>Pre-Configured AMI</h3><p>This step can be optional based on your requirements but it is good to have a pre-configured AMI that you can use in the compute resources. Follow the following steps to create a pre-configured AMI:</p><ul><li>Go to the AWS console, click on the Services dropdown menu, and select EC2</li><li>On the EC2 dashboard, select Launch an Instance</li><li>Select the Amazon Linux AMI 2018.03.0 (HVM), SSD Volume Type - ami-01fee56b22f308154</li><li>Select the General Purpose t2.micro which is free-tier eligible</li><li>Click on Review and Launch and then click Launch to launch this EC2 instance</li><li>Now go to the EC2 dashboard and select your EC2 Instance. Copy the public DNS and SSH into your created instance.</li><li>Now, install all the required packages, tools, and libraries in it using standard Linux commands.</li><li>Also, set up any credentials you might require later like AWS credentials, etc.</li><li>Once satisfied with your instance, it’s time to create an AMI image from this instance.</li><li>Go to EC2 dashboard, right-click on your instance. Click on Actions, select Image, and click on create an image.</li><li>Keep the default settings and create the image by clicking on Create Image.</li><li>It’ll take a couple of minutes and once it’s done, go ahead and terminate the instance you created. You will only need the AMI ID in the next phases.</li></ul><h3>AWS Data Pipeline Architecture</h3><p>The main idea behind this step is to set up a data pipeline which upon certain triggers, launches an EC2 instance. And then we will have a bash script run in that instance that would be responsible to move our raw data back and forth and run our preprocessing python script. This step can be further divided into 3 main subsections, let’s do it.</p><h4>AWS Data Pipeline Architecture Definition</h4><p>First of all, let’s define the AWS data pipeline architecture. We can do so by writing a JSON file that defines and describes our data pipeline and provides it with all the required logic. I’ll try to break it down as much as required but you can always refer to the documentation to explore more options. The data pipeline definition can have different pieces of information like</p><ul><li>Names, locations, and formats of your data sources</li><li>Activities that transform the data</li><li>The schedule for those activities</li><li>Resources that run your activities and preconditions</li><li>Preconditions that must be satisfied before the activities can be scheduled</li><li>Ways to alert you with status updates as pipeline execution proceeds</li></ul><p>We can express the data pipeline definition in three parts: Objects, parameters and values.</p><h4>Objects</h4><p>Below you can see the syntax of the definition.</p><pre>{<br>  &quot;objects&quot; : [<br>    {<br>       &quot;name1&quot; : &quot;value1&quot;,<br>       &quot;name2&quot; : &quot;value2&quot;<br>    },<br>    {<br>       &quot;name1&quot; : &quot;value3&quot;,<br>       &quot;name3&quot; : &quot;value4&quot;,<br>       &quot;name4&quot; : &quot;value5&quot;<br>    }<br>  ]<br>} </pre><p>Following the above syntax we can place our required objects one by one. First of all, we need to define our pipeline object. We would be defining fields like ID, name, IAM and resource roles, path to save pipeline logs and schedule type. You can add or remove these fields based on your requirements and should look at the official documentation to know more about these and other fields.</p><pre>{<br>        &quot;id&quot;: &quot;Default&quot;,<br>        &quot;name&quot;: &quot;Default&quot;,<br>        &quot;failureAndRerunMode&quot;: &quot;CASCADE&quot;,<br>        &quot;resourceRole&quot;: &quot;DataPipelineDefaultResourceRole&quot;,<br>        &quot;role&quot;: &quot;DataPipelineDefaultRole&quot;,<br>        &quot;pipelineLogUri&quot;: &quot;s3://automated-data-pipeline/logs/&quot;,<br>        &quot;scheduleType&quot;: &quot;ONDEMAND&quot;<br>},</pre><p>You can use this object with one change, that is the pipelineLogUri field. You can give the path to the S3 bucket you want to save your logs in. The next object in our definition is the compute i.e. EC2 resource.</p><pre>{<br>        &quot;id&quot;: &quot;MyEC2Resource&quot;,<br>        &quot;type&quot;: &quot;Ec2Resource&quot;,<br>        &quot;imageId&quot;: &quot;ami-xxxxxxxxxxxxxxxxx&quot;,<br>        &quot;instanceType&quot;: &quot;r5.large&quot;,<br>        &quot;spotBidPrice&quot;: &quot;2.0&quot;,<br>        &quot;terminateAfter&quot;: &quot;30 Minutes&quot;,<br>        &quot;actionOnTaskFailure&quot; : &quot;terminate&quot;,<br>        &quot;maximumRetries&quot; : &quot;1&quot;,<br>        &quot;role&quot;: &quot;DataPipelineDefaultRole&quot;,<br>        &quot;resourceRole&quot;: &quot;DataPipelineDefaultResourceRole&quot;,<br>        &quot;keyPair&quot; : &quot;&lt;YOUR-KEY&gt;&quot;<br>},</pre><p>We have described our compute needs in this object, for example, we need an EC2 instance of type r5.large on spot pricing with your key. Also, remember to put in the pre-configured AMI ID in the imageId field so it launches the instance with all of the configurations set in place. Now, let’s move on to the next and last object which is the shell activity. This object would be able to run our shell script which in turn would run our preprocessing code.</p><pre>{<br>        &quot;id&quot;: &quot;ShellCommandActivityObj&quot;,<br>        &quot;name&quot;: &quot;ShellCommandActivityObj&quot;,<br>        &quot;type&quot;: &quot;ShellCommandActivity&quot;,<br>        &quot;command&quot;: &quot;aws s3 cp s3://automated-data-pipeline/script.sh ~/ &amp;&amp; sudo sh ~/script.sh #{myS3DataPath}&quot;,<br>        &quot;maximumRetries&quot;: &quot;0&quot;,<br>        &quot;runsOn&quot;: {<br>            &quot;ref&quot;: &quot;MyEC2Resource&quot;<br>        }<br>}</pre><p>In this object, the two most important fields are command and runsOn. In the command field you would define the bash command that you would like to run on the EC2 instance described earlier. I described a command that will copy a bash script into the EC2 instance and run it. Note that I’m also giving it a parameter #{myS3DataPath}, it is the path we would like our pipeline to preprocess. It is given as a parameter to add flexibility to our pipeline so it can handle different data sets. The runsOn field takes the ID of the EC2 resource we created earlier so it can run the shell command on that resource.</p><h4>Parameters</h4><p>Parameters place holders should be written in this format #{myPlaceholder}. Every parameter should start with the &quot;my&quot; suffix. Here is the parameter section of the definition JSON file</p><pre>&quot;parameters&quot;: [<br>        {<br>            &quot;id&quot;: &quot;myS3DataPath&quot;,<br>            &quot;name&quot;: &quot;mys3DataPath&quot;,<br>            &quot;description&quot;: &quot;This is the path to the data uploaded&quot;,<br>            &quot;type&quot;: &quot;AWS::S3::ObjectKey&quot;<br><br>        }<br>    ] </pre><p>We have defined that our parameter should be AWS S3 object key type. The whole data pipeline definition can be found <a href="https://github.com/EshbanTheLearner/preprocessing-pipeline-demo/blob/main/definition.json">here</a>.</p><p>Now, after you are done with defining your pipeline, activate it by the following command.</p><pre>aws datapipeline create-pipeline --name data-preprocessing-pipeline --unique-id data-preprocessing-pipeline </pre><p>Once created, you can put the definition in place. Note that we can pass a temporary parameter value at this stage, which later can be passed dynamically.</p><pre>aws datapipeline put-definition --pipeline-definition file://definition.json \ --parameter-values s3DataPath=&lt;s3://your/s3/data/path&gt; --pipeline-id &lt;Your Pipeline ID&gt; </pre><p>Since our data pipeline is defined and created, let’s write the bash script that will run in the compute resource of our data pipeline.</p><h4>Bash Script</h4><p>This script will run on the EC2 instance that the pipeline would launch as its compute resource. The working of this script is simple, it makes a new working directory, sets the current working directory and path to data in S3 bucket as environment variables, copies the data into the current working directory, runs the python script and finally uploads the cleaned data back to S3. Here is the code you will need:</p><pre>#!/bin/bash<br><br>echo -e &quot;Starting the process&quot;<br><br>sudo mkdir ~/data-pipeline-tmp<br>sudo chmod ugo+rwx ~/data-pipeline-tmp<br>cd ~/data-pipeline-tmp<br><br>CURRENT_DIR=$(eval &quot;pwd&quot;)<br><br>DATA_PATH=$1<br><br>export WORKING_DIR=$CURRENT_DIR<br>export S3_DATA_PATH=$DATA_PATH<br><br>aws s3 cp s3://automated-data-pipeline/scripts/script.py $WORKING_DIR<br><br>python3 $WORKING_DIR/script.py<br><br>aws s3 cp $WORKING_DIR/twitter_data_cleaned.csv s3://automated-data-pipeline/outputs/ </pre><p>In my case, the S3 bucket is named automated-data-pipeline and I have made folders to separate different objects. This code can also be found <a href="https://github.com/EshbanTheLearner/preprocessing-pipeline-demo/blob/main/script.sh">here</a>. Next is the python code that will preprocess the data.</p><h4>Python Code</h4><p>This code is the standard preprocessing code that we will use to clean our datasets. Here’s the code that you would need. Changes can be made, add or remove anything according to your needs:</p><pre>import pandas as pd<br>import re<br>import nltk<br>nltk.download(&#39;stopwords&#39;)<br>from nltk.corpus import stopwords<br>from  nltk.stem import SnowballStemmer<br>import os<br><br>path = os.environ[&quot;S3_DATA_PATH&quot;]<br><br>print(f&quot;\nInside Python Script\nPath = {path}\n&quot;)<br>print(f&quot;Loading Data\n&quot;)<br><br>df = pd.read_csv(path, encoding=&quot;ISO-8859-1&quot;, names=[&quot;label&quot;, &quot;id&quot;, &quot;date&quot;, &quot;flag&quot;, &quot;user&quot;, &quot;tweet&quot;])<br>print(f&quot;Data has {df.shape[0]} rows and {df.shape[1]} columns\n&quot;)<br><br>TEXT_CLEANING_RE = &quot;@\S+|https?:\S+|http?:\S|[^A-Za-z0-9]+&quot;<br><br>stop_words = stopwords.words(&quot;english&quot;)<br>stemmer = SnowballStemmer(&quot;english&quot;)<br><br>def preprocess(text, stem=False):<br>    # Remove link, user and special characters<br>    text = re.sub(TEXT_CLEANING_RE, &#39; &#39;, str(text).lower()).strip()<br>    tokens = []<br>    for token in text.split():<br>        if token not in stop_words:<br>            if stem:<br>                tokens.append(stemmer.stem(token))<br>            else:<br>                tokens.append(token)<br>    return &quot; &quot;.join(tokens)<br>print(f&quot;Starting cleaning process&quot;)<br>df.text = df.text.apply(lambda x: preprocess(x))<br>print(&quot;Data cleaning completed, saving to CSV!\n&quot;)<br><br>df.to_csv(&quot;twitter_data_cleaned.csv&quot;, index=False) </pre><p>You can also find this code <a href="https://github.com/EshbanTheLearner/preprocessing-pipeline-demo/blob/main/script.py">here</a>. You have successfully defined and created a working data pipeline that can work on its (with manual activation). To add the event-driven label to it, we need to write a cloud function that will act as a trigger. It will handle certain events and then activate our pipeline when required.</p><h3>Event Handler AWS Lambda Function</h3><p>The title says that we will be using the AWS Lambda function for this step but I like to use Chalice for this step. You can use either as per your preference, the code will almost be the same. Following are the steps to create the chalice app that runs on AWS Lambda which triggers the data pipeline. You will need the ID of the pipeline you created earlier in this step.</p><ul><li>Create a chalice app using chalice new-project &lt;NAME&gt;</li><li>Once the project is initialized, open app.py file</li><li>Copy the contents of the following snippet into it. Code also available <a href="https://github.com/EshbanTheLearner/preprocessing-pipeline-demo/blob/main/app.py">here</a>.</li></ul><pre>from chalice import Chalice<br>import boto3<br><br>app = Chalice(app_name=&#39;pipeline-trigger&#39;)<br><br>client = boto3.client(&quot;datapipeline&quot;)<br><br># The pipeline you want to activate<br>PIPELINE_ID = &quot;df-xxxxxxxxxxxxxxxxxxxx&quot;<br><br>@app.on_s3_event(bucket=&#39;automated-data-pipeline&#39;, events=[&#39;s3:ObjectCreated:*&#39;], prefix=&quot;preprocess/&quot;, suffix=&quot;.csv&quot;)<br>def activate_pipeline(event):<br>    app.log.debug(f&quot;Received event for bucket: {event.bucket}, key: {event.key}&quot;)<br>    try:<br>        response = client.activate_pipeline(<br>            pipelineId=PIPELINE_ID,<br>            parameterValues=[<br>                {<br>                    &quot;id&quot;: &quot;myS3DataPath&quot;,<br>                    &quot;stringValue&quot;: f&quot;s3://{event.bucket}/{event.key}&quot;<br>                }<br>            ]<br>        )<br>        app.log.debug(response)<br>    except Exception as e:<br>        app.log.critical(e) </pre><ul><li>Change the arguments like pipeline-id, path to s3 bucket etc</li><li>Once done, deploy the chalice app using chalice deploy</li><li>If deployed successfully, go to the AWS console -&gt; Lambda</li><li>Select your lambda function, go the Permissions tab</li><li>Click on the name of Execution Role and it will open the IAM policy for the particular lambda function</li><li>Under the Permissions tab, click on the policy name to expand</li><li>Make sure that the policy has iam:PassRole and proper data pipeline permission</li><li>To make the life easier, following is the IAM policy that works fine</li></ul><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;VisualEditor0&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;iam:PassRole&quot;,<br>                &quot;datapipeline:*&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;*&quot;<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;VisualEditor1&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;logs:CreateLogStream&quot;,<br>                &quot;logs:CreateLogGroup&quot;,<br>                &quot;logs:PutLogEvents&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;arn:*:logs:*:*:*&quot;<br>        }<br>    ]<br>} </pre><h3>Testing</h3><p>To test this pipeline, you need to upload the dataset to the S3 bucket path you specified in the trigger function. In my case the path is s3://automated-data-pipeline/preprocess/. This allows me to use the following command in my PC terminal to simply upload the data, sit back and wait for the output into the S3 path I specified.</p><pre>aws s3 cp ~/training.1600000.processed.noemoticon.csv s3://automated-data-pipeline/preprocess/ </pre><p>After the pipeline has run its course, it will automatically delete the resources attached to it so you don’t incur any unwanted bills. It will upload the data to your specified path, ready to be used. Now let’s observe a before and after state of the data. Following is what the data looked in its raw form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*Yl0NzOyPyI65TJIrzjuTmQ.png" /></figure><p>Here is what the data looks like after going through the pipeline once:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2TQaFIuGYN6dxA2Ige74sA.png" /></figure><p>You can clearly observe the difference, you can also find these notebooks to observe closely <a href="https://github.com/EshbanTheLearner/preprocessing-pipeline-demo">here</a>.</p><h3>Conclusion</h3><p>I know that there are a lot of steps involved in this process but I assure you that once you have set up a pipeline like this, your life would be much easier. Still seems like a lot of work? Contact us at <a href="/service/mailto:help@traindex.io">help@traindex.io</a> to consult for any data engineering/science problems you might be facing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce12872a6820" width="1" height="1" alt=""><hr><p><a href="https://medium.com/traindex/event-driven-data-pipelines-in-aws-ce12872a6820">Event Driven Data Pipelines in AWS</a> was originally published in <a href="https://medium.com/traindex">Traindex</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Data Pipelines]]></title>
            <link>https://medium.com/traindex/introduction-to-data-pipelines-9fc2939bd770?source=rss-5eb1baae9266------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fc2939bd770</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[pipeline]]></category>
            <dc:creator><![CDATA[Eshban Suleman]]></dc:creator>
            <pubDate>Thu, 19 Nov 2020 10:10:01 GMT</pubDate>
            <atom:updated>2020-11-19T10:10:01.510Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v4gWUN9-X4jzMVpgQsLi8Q.jpeg" /></figure><p>If you are a growing data-driven organization, you might have been working to harvest large amounts of data to extract valuable insights from it. This can be costly and inefficient unless the data science team adopts the repeatable solutions to common problems. Although the specifics of organizations may vary, the basic principles remain the same. There are some common features that you can encapsulate into a data pipeline. Let’s look at a common problem and see how we overcame it.</p><p>Our team members at Traindex manually performed recurring tasks. These tasks included data cleaning, model training, testing, and so on. By performing these tasks manually, the engineer worked on the same thing again and again. This resulted in slow throughput, human error, and lack of flexibility and centralization.</p><p>To overcome this, we envisioned a data pipeline to do all the above tasks with minimal human intervention. We developed and deployed such a pipeline, and it has proven itself to be a gust of fresh air. In this article, we’ll look at what data pipelines are, the benefits of using data pipelines in a corporate setting, and finally, what an event-driven data pipeline is.</p><h3>What is a Data Pipeline?</h3><p>A pipeline is nothing more than a set of steps performed in a particular order in simple terms. A data pipeline is a set of processes performed on data from a source later moved to the destination, also known as the sink. The source could be anything from online transactional databases to data lakes, and the sink or the destination could be anything from data warehouses to business intelligence systems. The most common data pipeline is ETL, which extracts, transforms, and loads the data. The transformation process could include anything depending on the business. Here is a detailed data pipeline diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*RQ4xHvMztL0wF3iR3hl-nQ.png" /></figure><p>ETL pipeline is a type of data pipeline that performs operations in batches and is sometimes referred to as a batch data pipeline. Batch data processing was very common for a long time. Now there are different types of processing available like streaming and real-time processing. This architecture of the data pipelines has a lot of variety according to your business needs. For example, stream analytics for IoT applications keeps the data flowing from hundreds of sensors and real-time data analysis.</p><p>Now that we have understood what a data pipeline is let’s discuss why it is important to use data pipelines in modern data-oriented applications.</p><h3>Why use Data Pipeline</h3><p>In modern data-driven organizations, almost all actions and decisions are based on insights gathered from data. Every department of the organization has certain authorizations, restrictions, and data needs. Often the organizations have a single entity that manages the requirements of everyone resulting in a data silo. In such situations, getting even simple insights becomes difficult and leads to data redundancy within departments. The effort required to obtain essential data also handicaps the organization.</p><h4>Easy and Fast Access to Data</h4><p>Well-thought-out data pipelines result in easy and fast access with right permission roles to data throughout the organization. Anyone from any department can access their desired data with no intervention or interference.</p><h4>Swift Decision Making</h4><p>Based on the previously mentioned point, fast access to the data results in quick data-driven decisions. Data supports such choices, and they are less likely to go south.</p><h4>Scalability</h4><p>Well architectured data pipelines can automatically scale up or down according to the users’/organizations’ needs. This reduces admins’ headache to keep a constant eye and manually add or remove resources as per requirements.</p><h4>Reliability</h4><p>Well-written data pipelines improve data quality. The data becomes more reliable, and executives can make better decisions based on it.</p><h4>Economically Efficient</h4><p>Automated data pipelines run independently and need minimal maintenance and human intervention, thus less paid workforce. Also, their autonomous nature allows them to remove unused resources and save costs.</p><p>Since we now understand what a data pipeline is and its benefits, let us see how we crafted a pipeline according to our needs at Traindex.</p><h3>Event-Driven Data Pipelines</h3><p>Based on the problem we discussed at the beginning of this article, we decided on an event-driven pipeline. It runs based only on certain events. We wanted our pipeline to automatically run the data processing jobs, followed by training a machine learning model on the preprocessed data. We also wanted it to run some tests once it’s completed based on a specific event, which in our case, was an upload event.</p><p>Moving data to a specified data storage by the user or engineer generates an event. Once they complete the upload, it triggers our pipeline. Scheduling is not optimal for this use case because we don’t know when this raw data will be uploaded in our storage. It can be frequent or occasional, so we went for the event-driven approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dfol5F5phS_JwvmOXBQBwA.png" /><figcaption>Event-Driven Data Pipeline</figcaption></figure><h3>Conclusion</h3><p>We learned the importance of mining large datasets efficiently to get the best insights on time to stay ahead of the competition. Modern-day data-driven organizations should consider setting up data pipelines to provide their teams with correct and useful data a click away. Data pipelines can also automate data-driven and recurring tasks like data preprocessing, model training, and testing on a schedule or based on specific events. We hope you have found this article useful, and you may consider crafting some data pipeline solutions for your organization. You can consult your data engineering problems with us at help@traindex.io</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fc2939bd770" width="1" height="1" alt=""><hr><p><a href="https://medium.com/traindex/introduction-to-data-pipelines-9fc2939bd770">Introduction to Data Pipelines</a> was originally published in <a href="https://medium.com/traindex">Traindex</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>