<?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 owais raza on Medium]]></title>
        <description><![CDATA[Stories by owais raza on Medium]]></description>
        <link>https://medium.com/@owaisr814?source=rss-d41e98b77e5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Gq2icF8Zgsms18aP5kSMag.jpeg</url>
            <title>Stories by owais raza on Medium</title>
            <link>https://medium.com/@owaisr814?source=rss-d41e98b77e5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 23:01:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@owaisr814/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[Inventing Tomorrow: The Genius of Douglas Engelbart]]></title>
            <link>https://medium.com/@owaisr814/inventing-tomorrow-the-genius-of-douglas-engelbart-187c3f767729?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/187c3f767729</guid>
            <category><![CDATA[mouse]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[video-conferencing]]></category>
            <category><![CDATA[collaboration-software]]></category>
            <category><![CDATA[douglas-engelbart]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Mon, 26 May 2025 07:45:16 GMT</pubDate>
            <atom:updated>2025-05-26T07:45:16.316Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ro91G7azqgnzp7TzzY2qiw.jpeg" /></figure><p>In the quiet corridors of mid-20th century innovation, long before the personal computer had found its way onto every desk and into every pocket, a visionary named <strong>Douglas Engelbart</strong> was already sketching the outlines of our digital future. To many, he’s the man who invented the <strong>computer mouse</strong> a simple, wooden device with two wheels, born from curiosity and crafted with purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*Yvlghr-UFSLE_jS-M1MEIg.jpeg" /><figcaption><em>1970 — Patent for the computer mouse</em></figcaption></figure><p>But to those who look deeper, Engelbart was never just an inventor. He was a philosopher of technology, a believer in machines not as masters, but as <strong>partners in human thought</strong>.</p><p>Born in 1925 in Portland, Oregon, Engelbart came of age during a time of war and wonder. He served as a radar technician in World War II, where he first glimpsed the raw power of electronics. But it wasn’t until after the war while studying engineering and reading Vannevar Bush’s <em>As We May Think </em>that a seed was planted: <strong>What if technology could amplify the human mind?</strong></p><p>Engelbart earned his Ph.D. from UC Berkeley, but academia could not contain his vision. He joined the Stanford Research Institute (SRI), where he founded the <strong>Augmentation Research Center</strong> a lab not just of code and wires, but of dreams.</p><h3>The Demo That Changed the World</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FyJDv-zdhzMY%3Fstart%3D23%26feature%3Doembed%26start%3D23&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DyJDv-zdhzMY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FyJDv-zdhzMY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e965e1598c38be6958c56f8e77a49b3/href">https://medium.com/media/5e965e1598c38be6958c56f8e77a49b3/href</a></iframe><p>On <strong>December 9, 1968</strong>, in a San Francisco auditorium filled with curious engineers, Engelbart took the stage. What followed would become legendary the <strong>Mother of All Demos</strong>. With calm precision, he demonstrated technologies that seemed like science fiction: the <strong>mouse</strong>, <strong>hypertext</strong>, <strong>windows</strong>, <strong>video conferencing</strong>, <strong>real-time collaboration</strong>.</p><p>He didn’t just show tools. He revealed a <strong>new way of thinking</strong>, a future where humans and computers worked hand in hand to solve complex problems and build collective intelligence. At a time when computers were room-sized machines used by mathematicians and governments, Engelbart saw them as instruments of connection, communication, and cognition.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJQ8ZiT1sn88&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJQ8ZiT1sn88&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FJQ8ZiT1sn88%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1aabab99e881158a0a11ec4e963ee18e/href">https://medium.com/media/1aabab99e881158a0a11ec4e963ee18e/href</a></iframe><h3>A Vision Unfolding</h3><p>Yet, for all its brilliance, his vision was too early. The world wasn’t ready. His lab lost funding. Others picked up where he left off Xerox PARC, Apple, and the tech titans that followed drawing deeply from the well he had dug, often without fully acknowledging its depth. But Engelbart was undeterred. He had never sought fame. He sought impact.</p><p>Through the <strong>Bootstrap Institute</strong>, he continued advocating for systems that helped organizations “boot up” their capacity to evolve, adapt, and think together. To him, the true frontier wasn’t faster chips or sleeker screens it was <strong>collective human intelligence</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*J0LhGzi5CVCmNrSY" /><figcaption>Engelbart: Bootstrap “Paradigm Map” — 1998</figcaption></figure><h3>Lasting Light</h3><p>Douglas Engelbart passed away in 2013, but his spirit runs like a current beneath every digital interaction. Every hyperlink we click, every window we drag, every online collaboration we join they all echo his dream.</p><p>He showed us that technology need not distract or divide, but could <strong>amplify what is best in us </strong>our curiosity, our creativity, our shared desire to solve problems. More than an inventor, he was a <strong>cartographer of the mind</strong>, drawing the first maps of a future we now live in. Lets end with a quote from Douglas Engelbart</p><blockquote>It would be wonderful if I can inspire others, who are struggling to realize their dreams, to say ‘if this country kid could do it, let me keep slogging away’.</blockquote><p>You did inspire so many proving that determination and passion can truly change the world.</p><p><strong>Thank you so much Sir Douglas Engelbart</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=187c3f767729" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Traditional Evaluation Plots for Multiclass Classification Models]]></title>
            <link>https://medium.com/analytics-vidhya/exploring-traditional-evaluation-plots-for-multiclass-classification-models-5bd8ec80d3da?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bd8ec80d3da</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Tue, 23 Jul 2024 16:30:33 GMT</pubDate>
            <atom:updated>2024-07-23T16:30:33.706Z</atom:updated>
            <content:encoded><![CDATA[<p>In the realm of machine learning, especially when tackling multiclass classification problems, understanding the performance of your models is essential. Traditional evaluation plots are invaluable tools in this process, providing insights into various aspects of model performance. From the basic yet informative confusion matrix to the more nuanced precision-recall curves, these visualizations help decode how well a model distinguishes between multiple classes. This article delves into the core evaluation plots used in multiclass settings, including the ROC curve, learning curves, and validation curves. Each plot offers unique insights, whether it’s assessing overall accuracy, understanding trade-offs between precision and recall, or tuning hyperparameters for optimal performance. By the end of this article, you’ll be equipped with the knowledge to effectively evaluate the performance of your multiclass classification models.</p><p>To effectively assess the performance of a multiclass classification model, it’s essential to use a variety of evaluation plots. Each plot offers unique insights:</p><ul><li><strong>Confusion Matrix:</strong> Provides a detailed breakdown of model predictions, showing counts of true positives, false positives, true negatives, and false negatives for each class. This visualization helps identify patterns of misclassification and class imbalance.</li><li><strong>Precision-Recall Curve:</strong> Illustrates the trade-off between precision and recall for each class, which is particularly useful in imbalanced datasets where some classes are rare.</li><li><strong>Receiver Operating Characteristic (ROC) Curve:</strong> Plots the true positive rate against the false positive rate for each class. This helps visualize how well the model can distinguish between different classes.</li><li><strong>Learning Curves:</strong> Show how model performance changes with varying sizes of the training dataset. They help diagnose issues like underfitting or overfitting by illustrating how performance improves with more data.</li><li><strong>Validation Curves:</strong> Analyze the effect of hyperparameter changes on model performance. These curves help in tuning hyperparameters to achieve optimal model performance.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*eae1rAuv7h_MwXvAz8aDGA.png" /><figcaption>Cover Image</figcaption></figure><p>Lets start delve into coding individual plot in python step by step.</p><h4>Step 1: Imports and Settings</h4><p>In this section, we import the necessary libraries and modules required for our multiclass machine learning evaluation. Below is a brief description of each import:</p><ul><li><strong>pandas</strong> and <strong>numpy:</strong> Fundamental libraries for data manipulation and numerical operations.</li><li><strong>matplotlib.pyplot</strong> and <strong>seaborn:</strong> Visualization libraries used for plotting various evaluation metrics and curves.</li><li><strong>sklearn.metrics:</strong> Includes functions for calculating various evaluation metrics such as ROC curves, precision-recall curves, and confusion matrices.</li><li><strong>sklearn.preprocessing:</strong> Provides tools for preprocessing data, including label binarization for multiclass classification.</li><li><strong>itertools.cycle:</strong> Used for cycling through different plot colors.</li><li><strong>sklearn.model_selection:</strong> Contains functions for creating learning curves and validation curves to evaluate model performance over varying training sizes and hyperparameters.</li><li><strong>warnings:</strong> Used to suppress warnings for cleaner output.</li></ul><p>By setting these libraries and tools in place, we are equipped to perform comprehensive model evaluation and visualization for multiclass classification problems.</p><pre>import pandas as pd<br>import numpy as np<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>from sklearn.metrics import roc_curve, auc, average_precision_score, confusion_matrix,precision_recall_curve<br>from sklearn.preprocessing import LabelBinarizer,label_binarize<br>from itertools import cycle<br>from sklearn.model_selection import learning_curve,StratifiedKFold, validation_curve<br>import warnings<br>warnings.filterwarnings(&#39;ignore&#39;)</pre><h4>Step 2: Loading the Dataset</h4><p>In this section, we load the dataset that we will be using for our multiclass machine learning evaluation. The dataset we are using is the <a href="https://www.kaggle.com/datasets/rabieelkharoua/students-performance-dataset">Student Performance Datase</a>t.</p><pre>df = pd.read_csv(&quot;/kaggle/input/students-performance-dataset/Student_performance_data _.csv&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*_0evbB8W7dgnfyyzpXFJOA.png" /><figcaption>Dataset Snapshot</figcaption></figure><h4>Step 3: Separating Features and Target Variable</h4><p>In this step, we separate the dataset into features (X) and the target variable (Y). This is a crucial step for any machine learning task as it allows us to train models using the features to predict the target variable.</p><pre>X = df.iloc[:,:-1]<br>Y = df.iloc[:,-1]</pre><h4>Step 4: Splitting the Dataset into Training and Testing Sets</h4><p>To evaluate the performance of our machine learning models, we need to split the dataset into training and testing sets. This allows us to train the model on one portion of the data and evaluate it on another, unseen portion. This step is essential for assessing the generalizability of our models.</p><pre>from sklearn.model_selection import train_test_split<br>X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=0)</pre><h4>Step 5: Training a Logistic Regression Model and Making Predictions</h4><p>In this step, we train a logistic regression model using the training dataset and then use this trained model to make predictions on the testing dataset. Logistic regression is a commonly used algorithm for classification problems.</p><pre>from sklearn.linear_model import LogisticRegression<br>classifier = LogisticRegression()<br>classifier.fit(X_train,Y_train)<br>y_pred = classifier.predict(X_test)</pre><h4>Step 6: Plotting the Confusion Matrix</h4><p>To evaluate the performance of our logistic regression model, we will plot the confusion matrix. The confusion matrix provides a summary of the prediction results on the testing data, showing the number of correct and incorrect predictions for each class. This visualization helps in understanding the types of errors the model is making and in identifying areas for improvement.</p><p>We define a function plot_confusion_matrix that takes the true labels (Y_test) and the predicted labels (y_pred) as inputs. Inside the function, we calculate the confusion matrix using the confusion_matrix function from the sklearn.metrics module. We then use the seaborn library to create a heatmap of the confusion matrix for better visualization.</p><p>The confusion matrix is annotated with the actual counts, and labeled with the predicted and true classes. The heatmap is displayed using the plt.show() function from the matplotlib.pyplot library.</p><pre>def plot_confusion_matrix(Y_test,y_pred):<br>    # Example confusion matrix<br>    cm = confusion_matrix(Y_test, y_pred)<br>    sns.heatmap(cm, annot=True, cmap=&#39;Blues&#39;, fmt=&#39;d&#39;)<br>    plt.xlabel(&#39;Predicted Labels&#39;)<br>    plt.ylabel(&#39;True Labels&#39;)<br>    plt.title(&#39;Confusion Matrix&#39;)<br>    plt.show()<br>    <br>plot_confusion_matrix(Y_test,y_pred)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*hO6kFHpAIoHKC14Gf8L2Ew.png" /><figcaption>Confusion Matrix</figcaption></figure><h4>Step 7: Plotting the Multiclass ROC Curve</h4><p>Receiver Operating Characteristic (ROC) curves are used to evaluate the performance of classification models by illustrating the trade-offs between the true positive rate (sensitivity) and false positive rate. In a multiclass classification setting, we extend this concept to multiple classes.</p><p>The function plot_multiclass_roc visualizes the ROC curves for each class and computes the micro-average ROC curve, which aggregates the performance across all classes.</p><p>The process begins by predicting the probabilities for each class using the trained model. These predicted probabilities are then compared with the true labels, which are binarized using LabelBinarizer. This transformation allows us to compute ROC curves for each class.</p><p>For each class, we calculate the False Positive Rate (FPR) and True Positive Rate (TPR) using the roc_curve function, and then compute the Area Under the Curve (AUC) using the auc function. This gives us an understanding of how well the model distinguishes between classes.</p><p>Additionally, we compute the micro-average ROC curve, which aggregates the performance of the model across all classes by treating each class equally, regardless of the number of samples.</p><p>Finally, we plot the ROC curves for each class and the micro-average ROC curve on the same plot. This visualization helps in comparing the performance of the classifier across different classes and understanding its overall performance.</p><pre>def plot_multiclass_roc(X_test,Y_test,num_classes):<br><br>    # Assuming &#39;model&#39; is your trained multiclass classification model<br>    y_pred_prob = classifier.predict_proba(X_test)  # Predict probabilities<br>    y_true = Y_test  # True labels<br>    num_classes = num_classes<br>    # Binarize the true labels<br>    lb = LabelBinarizer()<br>    y_true_bin = lb.fit_transform(y_true)<br><br>    # Compute ROC curve and ROC area for each class<br>    fpr = dict()<br>    tpr = dict()<br>    roc_auc = dict()<br>    for i in range(num_classes):<br>        fpr[i], tpr[i], _ = roc_curve(y_true_bin[:, i], y_pred_prob[:, i])<br>        roc_auc[i] = auc(fpr[i], tpr[i])<br><br>    # Compute micro-average ROC curve and ROC area<br>    fpr[&quot;micro&quot;], tpr[&quot;micro&quot;], _ = roc_curve(y_true_bin.ravel(), y_pred_prob.ravel())<br>    roc_auc[&quot;micro&quot;] = auc(fpr[&quot;micro&quot;], tpr[&quot;micro&quot;])<br><br>    # Plot ROC curve<br>    plt.figure(figsize=(8, 6))<br>    plt.plot(fpr[&quot;micro&quot;], tpr[&quot;micro&quot;], label=f&#39;Micro-average ROC curve (AUC = {roc_auc[&quot;micro&quot;]:0.2f})&#39;, color=&#39;deeppink&#39;, linestyle=&#39;:&#39;, linewidth=4)<br><br>    for i in range(num_classes):<br>        plt.plot(fpr[i], tpr[i], label=f&#39;ROC curve - Class {i} (AUC = {roc_auc[i]:0.2f})&#39;)<br><br>    plt.plot([0, 1], [0, 1], &#39;k--&#39;, linewidth=2)<br>    plt.xlim([0.0, 1.0])<br>    plt.ylim([0.0, 1.05])<br>    plt.xlabel(&#39;False Positive Rate&#39;)<br>    plt.ylabel(&#39;True Positive Rate&#39;)<br>    plt.title(&#39;Receiver Operating Characteristic (ROC) Curve - Multiclass&#39;)<br>    plt.legend(loc=&quot;lower right&quot;)<br>    plt.show()<br><br>plot_multiclass_roc(X_test,Y_test,num_classes)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*KtblffmcF535UVuQ8b85kA.png" /><figcaption>ROC Curve</figcaption></figure><h4>Step 8: Plotting the Multiclass Precision-Recall Curve</h4><p>The Precision-Recall (PR) curve is a valuable tool for evaluating the performance of classification models, particularly in scenarios where the classes are imbalanced. It plots precision (the proportion of true positive predictions among all positive predictions) against recall (the proportion of true positive predictions among all actual positives).</p><p>The function plot_multiclass_precisionrecallcurve is designed to visualize Precision-Recall curves for multiclass classification problems. Here&#39;s how it works:</p><ol><li><strong>Predict Probabilities:</strong> It uses the trained classifier to predict the probability scores for each class on the test set.</li><li><strong>Binarize Labels:</strong> The true labels are binarized into a format suitable for the Precision-Recall computation, allowing us to evaluate each class individually.</li><li><strong>Compute Precision and Recall:</strong> For each class, it calculates the precision and recall values using the precision_recall_curve function, and computes the average precision score for each class using the average_precision_score function.</li><li><strong>Compute Micro-Average:</strong> It calculates the micro-average Precision-Recall curve, which aggregates the performance of the classifier across all classes by treating each class equally.</li><li><strong>Plotting:</strong></li></ol><ul><li>It plots Precision-Recall curves for each class using plt.step to provide a clear view of the performance across different recall levels.</li><li>It also plots the micro-average Precision-Recall curve for overall performance assessment.</li></ul><p><strong>6. Visualization:</strong> The final plot displays the Precision-Recall curves for each class and the micro-average curve, allowing for a comprehensive evaluation of the classifier’s performance.</p><pre>def plot_multiclass_precisionrecallcurve(X_test,Y_test,num_classes):<br><br>    num_classes = num_classes<br>    # Example Precision-Recall curve<br>    y_score = classifier.predict_proba(X_test)  # or predict_proba()<br>    y_bin = label_binarize(Y_test, classes=list(range(num_classes)))<br><br>    precision = dict()<br>    recall = dict()<br>    average_precision = dict()<br>    for i in range(num_classes):<br>        precision[i], recall[i], _ = precision_recall_curve(y_bin[:, i], y_score[:, i])<br>        average_precision[i] = average_precision_score(y_bin[:, i], y_score[:, i])<br><br>    # Compute micro-average ROC curve and ROC area<br>    precision[&quot;micro&quot;], recall[&quot;micro&quot;], _ = precision_recall_curve(y_bin.ravel(), y_score.ravel())<br><br>    plt.figure(figsize=(8, 6))<br>    plt.step(recall[&#39;micro&#39;], precision[&#39;micro&#39;], where=&#39;post&#39;, label=&#39;Micro-average Precision-Recall curve&#39;)<br>    for i, color in zip(range(num_classes), cycle([&#39;navy&#39;, &#39;turquoise&#39;, &#39;darkorange&#39;, &#39;cornflowerblue&#39;, &#39;teal&#39;])):<br>        plt.step(recall[i], precision[i], where=&#39;post&#39;, color=color, label=f&#39;Class {i} (AP = {average_precision[i]:0.2f})&#39;)<br><br>    plt.xlabel(&#39;Recall&#39;)<br>    plt.ylabel(&#39;Precision&#39;)<br>    plt.ylim([0.0, 1.05])<br>    plt.xlim([0.0, 1.0])<br>    plt.title(&#39;Precision-Recall curve - Multiclass&#39;)<br>    plt.legend(loc=&quot;best&quot;)<br>    plt.show()<br><br>plot_multiclass_precisionrecallcurve(X_test,Y_test,5)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*rpy9UtFSHS5KGjn0OeoEaQ.png" /><figcaption>Precision Recall Curve</figcaption></figure><h4>Step 9: Plotting the Multiclass Learning Curve</h4><p>The learning curve provides insights into the performance of a model as the size of the training dataset increases. It helps in understanding how the model’s accuracy evolves with more training data and whether it benefits from additional training samples. This can be crucial for diagnosing whether a model is suffering from high bias or high variance.</p><p>The function plot_multiclass_learning_curve is designed to visualize the learning curve for multiclass classification problems. Here&#39;s an overview of how it works:</p><ol><li><strong>Calculate Learning Curves:</strong></li></ol><ul><li>It uses the learning_curve function from sklearn to compute the training and validation scores across different sizes of the training dataset.</li><li>The dataset is divided into training and validation sets using Stratified K-Fold cross-validation to ensure that each fold maintains the proportion of classes.</li></ul><p><strong>2. Compute Mean and Standard Deviation:</strong></p><ul><li>For both training and validation sets, it calculates the mean and standard deviation of the accuracy scores. This helps in plotting the accuracy and its variability over different training sizes.</li></ul><p><strong>3. Plot Learning Curve:</strong></p><ul><li>The training accuracy is plotted with blue markers and a line, while the validation accuracy is plotted with green markers and a dashed line.</li><li>Shaded areas around these lines represent the standard deviation, providing a visual sense of the accuracy’s variability.</li></ul><p><strong>4. Visualization:</strong></p><ul><li>The x-axis represents the number of training samples, and the y-axis represents the accuracy.</li><li>The plot includes labels, a title, and a legend to make the information clear and comprehensible.</li></ul><pre>def plot_multiclass_learning_curve(classifier,X,Y):<br>    # Example multiclass learning curve<br>    train_sizes, train_scores, test_scores = learning_curve(classifier, X, Y, cv=StratifiedKFold(n_splits=5), n_jobs=-1)<br>    train_mean = np.mean(train_scores, axis=1)<br>    train_std = np.std(train_scores, axis=1)<br>    test_mean = np.mean(test_scores, axis=1)<br>    test_std = np.std(test_scores, axis=1)<br><br>    plt.plot(train_sizes, train_mean, color=&#39;blue&#39;, marker=&#39;o&#39;, markersize=5, label=&#39;Training accuracy&#39;)<br>    plt.fill_between(train_sizes, train_mean + train_std, train_mean - train_std, alpha=0.15, color=&#39;blue&#39;)<br>    plt.plot(train_sizes, test_mean, color=&#39;green&#39;, linestyle=&#39;--&#39;, marker=&#39;s&#39;, markersize=5, label=&#39;Validation accuracy&#39;)<br>    plt.fill_between(train_sizes, test_mean + test_std, test_mean - test_std, alpha=0.15, color=&#39;green&#39;)<br><br>    plt.xlabel(&#39;Number of training samples&#39;)<br>    plt.ylabel(&#39;Accuracy&#39;)<br>    plt.title(&#39;Learning Curve - Multiclass&#39;)<br>    plt.legend()<br>    plt.show()<br><br>plot_multiclass_learning_curve(LogisticRegression(),X,Y)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*DHwbXmsHmAvPYdlNvCslVw.png" /><figcaption>Learning Curve</figcaption></figure><h4>Step 10: Plotting the Multiclass Validation Curve</h4><p>A validation curve helps to visualize how changing a hyperparameter affects the performance of a machine learning model. It is particularly useful for understanding the impact of hyperparameter settings on model performance and selecting the best parameter value for optimal model performance.</p><p>The function plot_multiclass_validation_curve generates a validation curve to evaluate the impact of a hyperparameter on the performance of a multiclass classifier. Here&#39;s a detailed explanation of its functionality:</p><ol><li><strong>Define Parameter Range:</strong></li></ol><ul><li>The parameter range (param_range) is specified for the hyperparameter to be evaluated. In this case, we use np.logspace(-4, 4, 10) to create a range of values for the hyperparameter C in a logarithmic scale.</li></ul><p><strong>2. Compute the Validation Curve:</strong></p><ul><li>The validation_curve function from sklearn computes the training and cross-validation scores for different values of the hyperparameter. This involves training the model with each parameter value and evaluating its performance using cross-validation.</li></ul><p><strong>3. Compute Mean and Standard Deviation:</strong></p><ul><li>The function calculates the mean and standard deviation of the training and test scores. This provides a sense of how the model performance varies with different parameter settings and helps to assess the stability of the model.</li></ul><p><strong>4. Plot the Validation Curve:</strong></p><ul><li><strong>X-axis:</strong> Represents the values of the hyperparameter.</li><li><strong>Y-axis:</strong> Represents the score (e.g., accuracy) of the model.</li><li><strong>Training Score:</strong> Plotted as a red line with a shaded area representing the standard deviation.</li><li><strong>Cross-validation Score:</strong> Plotted as a green line with a shaded area representing the standard deviation.</li><li>The plot uses a logarithmic scale on the x-axis to better visualize the effect of parameter values over a wide range.</li></ul><p><strong>5. Visualization:</strong></p><ul><li>The function displays a plot showing how the performance of the model changes with different values of the hyperparameter, aiding in the selection of the best parameter value.</li></ul><pre>def plot_multiclass_validation_curve(X,Y,classifier,param_name,param_range):<br>    # Define the parameter range for gamma<br>    param_range = param_range<br><br>    # Compute the validation curve<br>    train_scores, test_scores = validation_curve(<br>        classifier, X, Y, param_name = param_name, param_range=param_range, cv=5, scoring=&quot;accuracy&quot;, n_jobs=-1<br>    )<br><br>    # Compute mean and standard deviation of training and test scores<br>    train_scores_mean = np.mean(train_scores, axis=1)<br>    train_scores_std = np.std(train_scores, axis=1)<br>    test_scores_mean = np.mean(test_scores, axis=1)<br>    test_scores_std = np.std(test_scores, axis=1)<br><br>    # Plot validation curve<br>    plt.figure()<br>    plt.title(&#39;Validation Curve with SVM&#39;)<br>    plt.xlabel(&#39;Gamma&#39;)<br>    plt.ylabel(&#39;Score&#39;)<br>    plt.ylim(0.0, 1.1)<br>    plt.xscale(&#39;log&#39;)<br><br>    # Plot the mean scores with standard deviation for training scores<br>    plt.plot(param_range, train_scores_mean, label=&#39;Training score&#39;, color=&#39;r&#39;)<br>    plt.fill_between(param_range, train_scores_mean - train_scores_std,<br>                     train_scores_mean + train_scores_std, alpha=0.2, color=&#39;r&#39;)<br><br>    # Plot the mean scores with standard deviation for cross-validation scores<br>    plt.plot(param_range, test_scores_mean, label=&#39;Cross-validation score&#39;, color=&#39;g&#39;)<br>    plt.fill_between(param_range, test_scores_mean - test_scores_std,<br>                     test_scores_mean + test_scores_std, alpha=0.2, color=&#39;g&#39;)<br><br>    plt.legend(loc=&#39;best&#39;)<br>    plt.show()<br>plot_multiclass_validation_curve(X,Y,LogisticRegression(),&#39;C&#39;,np.logspace(-4,4,10))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*5sefCFYNk4y2J1t0S2CfsA.png" /><figcaption>Validation Curve</figcaption></figure><p>In this article, we’ve explored essential evaluation plots for multiclass classification models, including the Confusion Matrix, Precision-Recall Curve, ROC Curve, Learning Curves, and Validation Curves. These tools provide valuable insights into the performance of your models and are crucial for effective model evaluation and optimization.</p><p>To see the complete implementation and explore these evaluation techniques in detail, you can access the full Kaggle notebook using the link below:</p><p><strong>Kaggle Notebook: </strong><a href="https://www.kaggle.com/code/owaisraza009/machine-learning-evaluation-curves">https://www.kaggle.com/code/owaisraza009/machine-learning-evaluation-curves</a></p><p>Feel free to dive into the notebook to see the code in action and apply these techniques to your own datasets.</p><p>Happy Coding ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bd8ec80d3da" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/exploring-traditional-evaluation-plots-for-multiclass-classification-models-5bd8ec80d3da">Exploring Traditional Evaluation Plots for Multiclass Classification Models</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Feature Engineering and Classification: A Step-by-Step Guide]]></title>
            <link>https://medium.com/analytics-vidhya/mastering-feature-engineering-and-classification-a-step-by-step-guide-911103fb30d6?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/911103fb30d6</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 15:27:51 GMT</pubDate>
            <atom:updated>2024-07-21T15:27:51.969Z</atom:updated>
            <content:encoded><![CDATA[<p>In the ever-evolving field of data science, the ability to effectively engineer features and evaluate classifiers is crucial for building robust machine learning models. This article aims to guide you through the process of applying various feature engineering techniques and evaluating multiple classifiers on a dataset to determine their performance. Whether you’re a beginner or looking to brush up on your skills, this comprehensive guide will be a valuable resource.</p><h4>Objectives</h4><ol><li><strong>Feature Engineering</strong>: We’ll apply filter methods, embedded methods, and dimensionality reduction techniques to select and transform features.</li><li><strong>Classifier Evaluation</strong>: Using different classifiers, we’ll assess the performance of the engineered feature sets.</li></ol><h4>Overview of Feature Engineering Techniques</h4><h4>Filter Methods</h4><ul><li><strong>ANOVA (Analysis of Variance)</strong>: Selects features based on the ANOVA F-value between the feature and the label.</li><li><strong>Mutual Information</strong>: Selects features based on the mutual information between the feature and the label.</li></ul><h4>Embedded Methods</h4><ul><li><strong>L1 Regularization (Lasso)</strong>: Uses L1 penalty to perform feature selection during the model training process.</li><li><strong>Random Forest</strong>: Uses feature importance scores from a Random Forest model to select features.</li></ul><h4>Dimensionality Reduction</h4><ul><li><strong>Principal Component Analysis (PCA)</strong>: Reduces the dimensionality of the feature set by transforming it into a lower-dimensional space.</li></ul><h4>Overview of Classifiers</h4><ul><li><strong>Logistic Regression</strong>: A linear model for binary classification.</li><li><strong>Decision Tree Classifier</strong>: A tree-based model for classification.</li><li><strong>Gaussian Naive Bayes</strong>: A probabilistic classifier based on Bayes’ theorem.</li><li><strong>Support Vector Classifier (SVC)</strong>: A model that constructs hyperplanes for classification.</li></ul><h4>Evaluation Metrics</h4><p>To evaluate the performance of our models, we’ll use the following metrics:</p><ul><li><strong>Accuracy</strong>: The ratio of correctly predicted instances to the total instances.</li><li><strong>Precision</strong>: The ratio of correctly predicted positive observations to the total predicted positives.</li><li><strong>Recall</strong>: The ratio of correctly predicted positive observations to all the observations in the actual class.</li><li><strong>F1 Score</strong>: The weighted average of Precision and Recall.</li></ul><h4>Workflow</h4><p>Our workflow will be structured as follows:</p><ol><li><strong>Feature Selection</strong>: Implementing the feature engineering techniques to create various feature sets.</li><li><strong>Model Training and Evaluation</strong>: Training different classifiers on the engineered feature sets and evaluating their performance using the specified metrics.</li></ol><h3>Implementation</h3><p>Let’s dive into the implementation! We’ll start by importing the necessary libraries.</p><h4>Step 1: Importing the Libraries</h4><p>In this section, we import all the necessary libraries and modules required for our feature engineering and classification tasks:</p><ul><li><strong>Pandas</strong>: For data manipulation and analysis.</li><li><strong>NumPy</strong>: For numerical computations.</li><li><strong>Scikit-learn</strong>: For various machine learning algorithms and utilities:</li><li>LabelEncoder, StandardScaler: For preprocessing.</li><li>train_test_split: For splitting the dataset into training and testing sets.</li><li>SelectKBest, f_classif, mutual_info_classif: For feature selection using filter methods.</li><li>SelectFromModel: For feature selection using embedded methods.</li><li>RandomForestClassifier, LogisticRegression, DecisionTreeClassifier, GaussianNB, SVC: For classification.</li><li>PCA: For dimensionality reduction.</li><li>accuracy_score, precision_score, recall_score, f1_score: For evaluating model performance.</li></ul><pre># Importing the libraries<br>import pandas as pd<br>import numpy as np<br>from sklearn.preprocessing import LabelEncoder<br>from sklearn.preprocessing import StandardScaler<br>from sklearn.model_selection import train_test_split<br>from sklearn.feature_selection import SelectKBest, f_classif, mutual_info_classif<br>from sklearn.feature_selection import SelectFromModel<br>from sklearn.ensemble import RandomForestClassifier<br>from sklearn.linear_model import LogisticRegression<br>from sklearn.decomposition import PCA<br>from sklearn.tree import DecisionTreeClassifier<br>from sklearn.naive_bayes import GaussianNB<br>from sklearn.svm import SVC<br>from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score<br>import warnings<br>warnings.filterwarnings(“ignore”)</pre><h4>Step 2: Importing the Dataset</h4><p>In this section, we import the dataset that will be used for our feature engineering and classification tasks. The dataset used in this study is <a href="https://www.kaggle.com/code/owaisraza009/feature-engineering-and-classification/input">Feature Engineering dataset</a></p><p><strong>Load the Dataset</strong>:</p><ul><li><strong>Pandas</strong> is used to read the CSV file containing the dataset.</li><li>The dataset is loaded from the specified file path.</li></ul><pre># Importing dataset<br>dataset = pd.read_csv(&quot;/kaggle/input/playground-series-s4e2/train.csv&quot;)</pre><h4>Step 3: Displaying the First Five Rows of the Dataset</h4><p>In this cell, we display the first five rows of the dataset to get an initial understanding of its structure and content. This helps us verify that the data has been loaded correctly and provides a glimpse into the columns and sample records available for analysis</p><pre># Display the first five rows of the dataset<br>dataset.head()</pre><h4>Step 4: Checking for Missing Values</h4><p>Before we proceed with feature engineering and classification, it is crucial to check our dataset for any missing values. Missing data can significantly affect the performance of our models, so we need to handle them appropriately.</p><p><strong>Check for Missing Values</strong>:</p><ul><li>Use the isna() function from <strong>Pandas</strong> to identify missing values.</li><li>The sum() function is then used to count the number of missing values in each column.</li></ul><pre># Check for missing values<br>print(&quot;Missing values&quot;)<br>dataset.isna().sum()</pre><h4>Step 5: Showing Descriptive Statistics</h4><p>In this cell, we display the descriptive statistics of the dataset. This provides a summary of the central tendencies, dispersions, and shapes of the dataset’s distribution.</p><pre># Show descriptive statistics<br>dataset.describe()</pre><h4>Step 6: Initializing Features and Target Variable</h4><p>In this cell, we separate the dataset into features and target variable for further analysis and model training.</p><ul><li><strong>Features (X)</strong>: We select a subset of columns from the dataset to serve as the feature set. These include various attributes related to individuals’ demographics, habits, and other relevant factors.</li><li><strong>Target Variable (Y)</strong>: We select the column NObeyesdad as the target variable, which represents the outcome we want to predict based on the features.</li></ul><pre># Initialize features <br>X = dataset[[&#39;Gender&#39;, &#39;Age&#39;, &#39;Height&#39;, &#39;Weight&#39;, &#39;family_history_with_overweight&#39;,<br>       &#39;FAVC&#39;, &#39;FCVC&#39;, &#39;NCP&#39;, &#39;CAEC&#39;, &#39;SMOKE&#39;, &#39;CH2O&#39;, &#39;SCC&#39;, &#39;FAF&#39;, &#39;TUE&#39;,<br>       &#39;CALC&#39;, &#39;MTRANS&#39;]]<br><br># Initialize target variable<br>Y = dataset[&#39;NObeyesdad&#39;]</pre><h4>Step 7: Standardizing Numerical Features</h4><p>In this cell, we standardize the numerical features of the dataset. Standardization is an important preprocessing step that ensures all numerical features have a mean of 0 and a standard deviation of 1, which helps improve the performance and convergence of machine learning models.</p><ul><li><strong>Select Numerical Columns</strong>: We identify the numerical columns in the dataset that need to be standardized.</li><li><strong>Initialize StandardScaler</strong>: We use StandardScaler from sklearn.preprocessing to perform the standardization.</li><li><strong>Fit and Transform</strong>: We fit the scaler to the numerical columns and transform them. This process standardizes the numerical features by removing the mean and scaling them to unit variance.</li></ul><pre># Select numerical columns from the dataset<br>numerical_cols = X.select_dtypes(include=[&#39;int&#39;, &#39;float&#39;]).columns.tolist()<br><br># Initialize a StandardScaler to standardize the numerical features<br>scaler = StandardScaler()<br><br># Fit the scaler to the numerical columns and transform them<br># This standardizes the numerical features by removing the mean and scaling to unit variance<br>X[numerical_cols] = scaler.fit_transform(X[numerical_cols])</pre><h4>Step 8: Encoding Categorical Features and Target Variable</h4><p>In this cell, we convert categorical features and the target variable into numerical values using label encoding. This is essential for machine learning models that require numerical input.</p><ul><li><strong>Initialize LabelEncoder</strong>: We create an instance of LabelEncoder from sklearn.preprocessing.</li><li><strong>Encode Features</strong>: We iterate through each column in the feature set X:</li><li>If a column’s data type is object (i.e., categorical), we apply label encoding to convert these categorical values into numerical format.</li><li><strong>Encode Target Variable</strong>: We also apply label encoding to the target variable Y to ensure it is in a numerical format.</li></ul><pre># Initialze Label encoder <br>label_encoder = LabelEncoder()<br><br># Loop through columns<br>for col in X.columns:<br>    <br>    # Check if data type of column is object<br>    if X[col].dtype == &#39;object&#39;:<br>        <br>        # If column is of type object then tranform that column <br>        X[col] = label_encoder.fit_transform(X[col])<br><br># Fiting target column to label encoder<br>Y = label_encoder.fit_transform(Y)</pre><h4>Step 9: Feature Selection and Dimensionality Reduction Methods</h4><h4>Filter Methods</h4><ol><li><strong>ANOVA F-value Feature Selection</strong> (filter_method_ANOVA):</li></ol><ul><li>Uses the ANOVA F-value between label/feature pairs to select the top k features.</li><li>Applies SelectKBest with f_classif as the score function.</li></ul><ol><li><strong>Mutual Information Feature Selection</strong> (filter_method_mutual_info):</li></ol><ul><li>Uses mutual information between label/feature pairs to select the top k features.</li><li>Applies SelectKBest with mutual_info_classif as the score function.</li></ul><h4>Embedded Methods</h4><ol><li><strong>L1 Regularization (Logistic Regression)</strong> (embedded_method_L1):</li></ol><ul><li>Applies L1 regularization via logistic regression to select features.</li><li>Uses SelectFromModel to select features based on the learned coefficients.</li></ul><ol><li><strong>Random Forest Feature Importance</strong> (embedded_method_random_forest):</li></ol><ul><li>Uses a Random Forest classifier to determine feature importance.</li><li>Applies SelectFromModel to select features based on importance scores.</li></ul><h4>Dimensionality Reduction</h4><ol><li><strong>Principal Component Analysis (PCA)</strong> (dimensionality_reduction_PCA):</li></ol><ul><li>Reduces the dimensionality of the dataset by projecting it onto a set of orthogonal components.</li><li>Keeps the top n_components principal components.</li></ul><pre>def filter_method_ANOVA(X, y, k=10):<br>    skb = SelectKBest(f_classif, k=k)<br>    X_new = skb.fit_transform(X, y)<br>    return X_new<br><br>def filter_method_mutual_info(X, y, k=10):<br>    skb = SelectKBest(mutual_info_classif, k=k)<br>    X_new = skb.fit_transform(X, y)<br>    return X_new<br><br># Embedded Methods<br>def embedded_method_L1(X, y, C=1):<br>    lr = LogisticRegression(penalty=&#39;l1&#39;, C=C, solver=&#39;liblinear&#39;)<br>    lr.fit(X, y)<br>    sfm = SelectFromModel(lr)<br>    X_new = sfm.fit_transform(X, y)<br>    return X_new<br><br>def embedded_method_random_forest(X, y, n_estimators=100):<br>    rf = RandomForestClassifier(n_estimators=n_estimators)<br>    rf.fit(X, y)<br>    sfm = SelectFromModel(rf, threshold=0.01)  # Adjust threshold as needed<br>    X_new = sfm.fit_transform(X, y)<br>    return X_new<br><br># Dimensionality Reduction<br>def dimensionality_reduction_PCA(X, n_components=10):<br>    pca = PCA(n_components=n_components)<br>    X_new = pca.fit_transform(X)<br>    return X_new</pre><h4>Step 10: Feature Selection and Dimensionality Reduction Initialization</h4><p><strong>ANOVA Feature Selection</strong>:</p><ul><li>Initializes features selected using the ANOVA F-value method</li></ul><p><strong>Mutual Information Feature Selection</strong>:</p><ul><li>Initializes features selected using mutual information.</li></ul><p><strong>Embedded Method (L1 Regularization)</strong>:</p><ul><li>Initializes features selected using L1 regularization via logistic regression.</li></ul><p><strong>Principal Component Analysis (PCA)</strong>:</p><ul><li>Initializes features reduced to a lower-dimensional space using PCA.</li></ul><pre># Initialize the anova features<br>anova_features = filter_method_ANOVA(X, Y)<br><br># Initialize the mutual info features<br>mutualInfo_features = filter_method_mutual_info(X, Y)<br><br># Initialize the embeded method features<br>embeded_features = embedded_method_L1(X , Y)<br><br># Initialize the PCA features<br>pca_features = dimensionality_reduction_PCA(X) </pre><h4>Step 11: Model Evaluation with Different Feature Sets</h4><p><strong>Initialize Feature Sets and Classifiers</strong>:</p><ul><li>Define feature sets using different feature selection and dimensionality reduction methods.</li><li>Initialize a list of classifiers to evaluate: Logistic Regression, Decision Tree, Gaussian Naive Bayes, and Support Vector Classifier.</li></ul><p><strong>Evaluate Each Feature Set</strong>:</p><ul><li>For each feature set:</li><li>Print the name of the feature set.</li><li>Split the data into training and test sets.</li><li>For each classifier:</li><li>Print the classifier’s name.</li><li>Fit the classifier on the training data.</li><li>Predict on the test data.</li><li>Print and calculate performance metrics: Accuracy, Precision, Recall, and F1 Score</li></ul><pre># Intialize the feature sets<br>feature_sets = [(&#39;anova_features&#39;, anova_features), (&#39;mutualInfo_features&#39;,mutualInfo_features), (&#39;embeded_features&#39;,embeded_features), (&#39;pca_features&#39;,pca_features)]<br><br># Initialize the classifiers list<br>classifiers = [LogisticRegression(), DecisionTreeClassifier(), GaussianNB(), SVC()]<br><br># Loop through each feature sets<br>for feature_set in feature_sets:<br>    <br>    # Print name of feature set<br>    print(f&#39;Featuere set used is {feature_set[0]}&#39;)<br>    <br>    # Split the data<br>    X_train, X_test, Y_train, Y_test = train_test_split(feature_set[1] , Y, test_size = 0.2, random_state = 0)<br>    <br>    # Loop through the classifiers<br>    for classifier in classifiers:<br>        <br>        # Print name of classifier<br>        print(classifier.__class__.__name__)<br>        <br>        # Fit the classifier<br>        classifier = classifier.fit(X_train,Y_train)<br>        <br>        # Predict the test set<br>        y_pred = classifier.predict(X_test)    <br>        <br>        # Print and calculate performance metrics<br>        print(f&#39;Accuracy Score is:  {accuracy_score(y_pred,Y_test)}&#39;)<br>        print(f&#39;Precision Score is:  {precision_score(y_pred,Y_test,average = &quot;micro&quot;)}&#39;)<br>        print(f&#39;Recall Score is:  {recall_score(y_pred,Y_test,average = &quot;micro&quot;)}&#39;)<br>        print(f&#39;F1 Score is:  {f1_score(y_pred,Y_test,average = &quot;micro&quot;)}&#39;)</pre><p><strong>Initialize Results Storage</strong>:</p><ul><li>Create an empty list to store evaluation results for each combination of feature set and classifier.</li></ul><p><strong>Evaluate Models</strong>:</p><ul><li>For each feature set:</li><li>Extract the feature set name and features.</li><li>Split the data into training and test sets.</li><li>For each classifier:</li><li>Fit the classifier on the training data.</li><li>Predict on the test data.</li><li>Calculate performance metrics: Accuracy, Precision, Recall, and F1 Score.</li><li>Store the results in a dictionary</li></ul><p><strong>Create and Display Results DataFrame</strong>:</p><ul><li>Convert the list of results into a DataFrame for easy viewing.</li><li>Display the DataFrame to review the performance metrics for all feature sets and classifiers.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*1ioP7z5b24blvZkaKAsHNg.png" /><figcaption>Results for modeling</figcaption></figure><p>By systematically applying feature engineering techniques and rigorously evaluating classifiers, we can build more robust and accurate machine learning models. This process not only improves model performance but also provides a deeper understanding of the data and its underlying patterns.</p><p>Feel free to experiment with different feature engineering methods and classifiers on your datasets to see what works best for your specific use case. The journey of data science is iterative and constantly evolving, so keep exploring and learning.</p><p>Link to the Kaggle notebook: <a href="https://www.kaggle.com/code/owaisraza009/feature-engineering-and-classification">https://www.kaggle.com/code/owaisraza009/feature-engineering-and-classification</a></p><p>Link to Dataset: <a href="https://www.kaggle.com/code/owaisraza009/feature-engineering-and-classification/input">https://www.kaggle.com/code/owaisraza009/feature-engineering-and-classification/input</a></p><p>Happy Coding ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=911103fb30d6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/mastering-feature-engineering-and-classification-a-step-by-step-guide-911103fb30d6">Mastering Feature Engineering and Classification: A Step-by-Step Guide</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to implement VGG19, VGG16 using Keras and Pytorch? Part 1]]></title>
            <link>https://medium.com/@owaisr814/how-to-implement-vgg19-vgg16-using-keras-and-pytorch-part-1-4ae1a858b466?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ae1a858b466</guid>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Wed, 14 Sep 2022 14:10:39 GMT</pubDate>
            <atom:updated>2022-09-14T14:10:39.867Z</atom:updated>
            <content:encoded><![CDATA[<p>Here in this blog VGG16 and VGG19 are implemented using keras and pytorch. It is one of simple architecture to implement although its very useful for variety of purposes. It is was first proposed in paper <strong>“</strong><a href="https://arxiv.org/abs/1409.1556"><strong>Very Deep Convolutional Networks for Large-Scale Image Recognition</strong></a><strong>”. </strong>According to this paper <strong>“</strong>The<strong> </strong>main contribution is a thorough evaluation of networks of increasing depth using an architecture with very small ( 3 × 3) convolution filters, which shows that a significant improvement on the prior-art configurations can be achieved by pushing the depth to 16–19 weight layers”. After this paper they made their two best performing network publicly available for research. Libraries such as keras and pytorch implemented these network and made them available as pretrained model. Now I will be implementing both VGG16 and 19 from scratch with each layer. First lets have look at the configuration proposed in the paper for various models created in the study.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*qFL0Tz6WEapWFd3DzLozAQ.png" /><figcaption>Network configuration as in <a href="https://arxiv.org/abs/1409.1556"><strong>Very Deep Convolutional Networks for Large-Scale Image Recognition</strong></a></figcaption></figure><p>Model D and E are the best performing models known as VGG16 with 16 layer and VGG19 with 19 layers. The model D contains layer with 3x3 convolutional layer with number of filter ranging from 64 to 512 max pooling is applied between layers and in the end fully connected layer is used to show the prediction the dataset used in the study has 1000 classes hence 1000 in the last layer. Below code shows the implementation of VGG16 using keras</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d1f50193bec1cdf6e453ee0e46a2100/href">https://medium.com/media/3d1f50193bec1cdf6e453ee0e46a2100/href</a></iframe><p>Sequential model is used to create the VGG16 all layer are added to that model, 3 types of layers are used Conv2D, Maxpool2D and Dense Layer which represent a fully connected network. The size of kernel is 3*3 that is small which is one of the novel elements of this paper and strides in convolutional layers are kept at 1 and same padding mean a border of zeros around the matrix i.e. image is given. In max pooling pooling size is kept (2,2) and the strides at two.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*kw_IKf3PAJEodsd_uroR2g.png" /><figcaption>Comparison for our and keras implementation</figcaption></figure><p>To be sure the implementation is correct this comparison is made in above figure. Now lets implement the VGG19. The code given below is for VGG 19 there are three additional convolutional layers are added with the width of 256, 512 and 512, respectively strides, kernel and padding setting of these layers is similar to other convolutional layers</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f68f743d96a9b85cab390cc277fb428/href">https://medium.com/media/3f68f743d96a9b85cab390cc277fb428/href</a></iframe><p>Similar to VGG16 comparison of VGG19 with keras implementation is done to be sure that the implemented model is similar and the model is correctly implemented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*UpAgsyK8MZfMt9HdiNv-cg.png" /><figcaption>Comparison of VGG19 model implemented by us and Keras</figcaption></figure><p>This is a three part tutorial. In first part Keras implementation is discussed in next part pytorch implementation will be shown and in third part these models are trained on real world data and their evaluation is performed.</p><p>Hope you liked the article please share your thoughts in comment also Follow me on <a href="https://web.facebook.com/codingbakht"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/in/mspowaisraza/"><strong>LinkedIn</strong></a><strong> and </strong><a href="https://github.com/owais4321"><strong>GitHub</strong></a>. Until next time happy Coding ❤</p><p><strong>References:</strong></p><ol><li><a href="http://VERY DEEP CONVOLUTIONAL NETWORKS FOR LARGE-SCALE IMAGE RECOGNITION">VERY DEEP CONVOLUTIONAL NETWORKS FOR LARGE-SCALE IMAGE RECOGNITION</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ae1a858b466" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How climate change is effecting Rainfall? Machine learning Perspective: Case Study of Pakistan]]></title>
            <link>https://medium.com/@owaisr814/how-climate-change-is-effecting-rainfall-machine-learning-perspective-case-study-of-pakistan-2a628a1d9b2a?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a628a1d9b2a</guid>
            <category><![CDATA[rainfall-prediction]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[climate-change]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Sat, 10 Sep 2022 16:36:22 GMT</pubDate>
            <atom:updated>2022-09-10T16:36:22.711Z</atom:updated>
            <content:encoded><![CDATA[<h3>How climate change is effecting Rainfall? Machine Learning Perspective: Case Study of Pakistan</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/0*63lapSf0sdpKrXyv" /></figure><p>Recent heavy rainfall in the Pakistan has shown how climate change is affecting normal weather pattern through out the world this change is causing some really serious destruction, as in Pakistan one third of the country is under the flood caused by the rain. In order to study how climate change indicator are effecting yearly rainfall. A dataset is collected from Humanitarian Data Exchange (HDX) to study the effects of climate change indicators on rainfall. The <a href="https://www.kaggle.com/code/owaisraza009/rainfall-prediction-using-climate-change-indicator/data">dataset</a> is made available at Kaggle and the prediction model created in this study is also available as <a href="https://www.kaggle.com/code/owaisraza009/rainfall-prediction-using-climate-change-indicator/notebook">notebook </a>on Kaggle. In this article we will have a look at the dataset run a basic kernel understand few key relationships and open door for further work.</p><h3>Dataset</h3><p>The data is collected from The Humanitarian Data Exchange (HDX). HDX is a free and open platform for data sharing across crises and organizations. HDX, which was launched in July 2014, aims to make humanitarian data easier to find and use for analysis. Users from over 200 countries and territories have accessed our growing collection of datasets. Data is collected from HDX it provides a data file regarding a crises or a region. In this case Pakistan climate change indicator data was collected from HDX two files were created one contain 77 columns then another file is created from this file by deleting all the columns with the data of less then 45 years resulting in a file with 25 column. The figure below shows the columns in the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YvN75E5oR0pAwOOj6yBRXQ.png" /><figcaption>List of columns in the dataset</figcaption></figure><h3>Dataset Cleaning</h3><p>Dataset is checked for any missing values and the useless column such as ‘Sno’ are deleted in this process. To clean out missing values the imputer is used from sklearn package. Missing values are replaced with the mean of the column. Figure 2 shows the number of missing values in the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*WFS7e7xUNMmk6RJS7vZ3rw.png" /><figcaption>Figure 2: Number of missing value in each column</figcaption></figure><p>To clean out the missing values the below code is used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*1yO-o_Ebv3GBOfw-lLfOFQ.png" /><figcaption>Figure 3: Cleaning the missing values by replacing them with mean of the column</figcaption></figure><h3>Data Analysis</h3><p>After cleaning data visualizations are created to understand the climate change indicator with respect to time the code to plot that is given below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*Y8SfCU78XV3z_UPQDtc7Mg.png" /><figcaption>Figure 4: Code for plotting all columns against the years</figcaption></figure><p>A sample plot for carbon emission is shown in figure 5 with respect to the year from 1960 to 2020</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/0*REAuxBh83i3bzbJe.png" /><figcaption>Figure 6: CO2 emission against years</figcaption></figure><p>Comparison of all indicators with rainfall against the years from 1960 to 2020 code for that is shown as below in figure 7</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w3P_m3gwAq61tVIb47YEKA.png" /><figcaption>Figure 7: Code for plotting comparison of rainfall and climate change indicator against time</figcaption></figure><p>The sample plot of this kind of visualization is shown in figure 8 where cereal production is compared with rainfall against time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/0*IozDFq_gejmTbNFc.png" /><figcaption>Figure 8: Cereal production is compared with rainfall against time</figcaption></figure><p>The data is not normalized which is the reason the difference in comparison graph but the trend is clear both are positively related with each other. One more type of correlation was calculated for the dataset called Pearson correlation. Figure 9 shows the Pearson correlation chart for the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5UTxIkq5igsAS1JQ.png" /><figcaption>Figure 9: Pearson correlation among the each column of the dataset</figcaption></figure><p>Code for the Pearson correlation is quite simple ‘dataset.corr()’. From figure 9 it can be seen that there are attributes where rainfall is positively related such as Cereal Production and Urban population, and there are features where rainfall is negatively correlated and also some features where rainfall is very loosely correlated with values less than 0.1.</p><h3>Data Modeling</h3><p>Regression is used to model the dataset to make future predictions using all the features. Three algorithms were used to model the dataset for future prediction Linear Regression, Ridge Regression and K nearest neighbor regression. The evaluation parameters used are RMSE, MSE and R Squared. Code for evaluation is shown in figure 10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*KMGbw4ubjbRgFtuyHhp7Mw.png" /><figcaption>Figure 10: Evaluation function</figcaption></figure><p>The code for performing the data modeling and evaluation is given in figure 11.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*HFY7zQixcA7CLcxHEsJsZw.png" /><figcaption>Figure 11: Data modeling and evaluation</figcaption></figure><p>Results of the data modeling are shown as number for evaluation metric and comparison chart between original and predicted values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*2aG27ysW8LIF7oq7PUpv5g.png" /><figcaption>Figure 12 sample results of linear regression model</figcaption></figure><p>Figure 12 shows the results for the single model. To check all the results and get the complete code checkout the <a href="https://www.kaggle.com/code/owaisraza009/rainfall-prediction-using-climate-change-indicator/notebook">Notebook</a> on Kaggle upvote it upvote the <a href="https://www.kaggle.com/code/owaisraza009/rainfall-prediction-using-climate-change-indicator/data">data </a>if it helped and provided you some value.</p><blockquote><strong>Conclusion:</strong></blockquote><blockquote>It is clear that there is correlation between rainfall and climate change indicator</blockquote><blockquote>Machine Learning can be applied for prediction but better approach for feature selection can show better results.</blockquote><blockquote>Three algorithms are used here, more can be used for better results</blockquote><blockquote>This work is just a door to endless possibilities which are also discussed with dataset on <a href="https://www.kaggle.com/code/owaisraza009/rainfall-prediction-using-climate-change-indicator/notebook">Kaggle</a></blockquote><p>Hope you liked the article please share your thoughts in comment also Follow me on <a href="https://web.facebook.com/codingbakht"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/in/mspowaisraza/"><strong>LinkedIn</strong></a>, and <a href="https://www.kaggle.com/owaisraza009"><strong>Kaggle</strong></a> for more content . Upvote this work on <a href="https://www.kaggle.com/code/owaisraza009/rainfall-prediction-using-climate-change-indicator/data">Kaggle</a> if it provided you any values. Until next time happy Coding ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a628a1d9b2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2 Minute Paper - Implicitly Abusive Language — What does it actually look like and why are we not…]]></title>
            <link>https://medium.com/@owaisr814/2-minute-paper-implicitly-abusive-language-what-does-it-actually-look-like-and-why-are-we-not-5d44bdfea5e5?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d44bdfea5e5</guid>
            <category><![CDATA[abuse-detection]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Fri, 19 Aug 2022 20:03:36 GMT</pubDate>
            <atom:updated>2022-08-19T20:03:36.179Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>2 Minute Paper</strong> - Implicitly Abusive Language — What does it actually look like and why are we not getting</h3><p>Welcome to the 2-minute paper series. In this series, we will discuss some of the really interesting papers in the field of Artificial Intelligence, Machine Learning, and Natural Language Processing. This is the first paper of this series.</p><p>In the age of social media, content moderation has become one of the biggest challenges in the field of Machine learning. There are different types of content such as images, videos, or text. A lot of online abuse exists in form of text. So the paper <a href="https://aclanthology.org/2021.naacl-main.48/">Implicitly Abusive Language — What does it actually look like and why are we not getting there</a> discusses two types of online abuse, explicit and implicit. Explicit abuse contains some form of vulgar language or inappropriate terms which makes it easy to detect as compared to Implicit abuse which is a subtle form of abuse that usually doesn’t contain some inappropriate language. One of the key challenges in detecting implicit abuse is that it is highly context-dependent. In this paper, researchers have classified implicit abuse into several categories for better detection. Following are those categories:</p><p><strong>Stereotypes</strong>: Stereotypes are defined as “By stereotypes, we understand a fixed, overgeneralized belief about a particular group or class of people”.</p><blockquote>Example: Men should drive and women should cook</blockquote><p>2. <strong>Perpetrators</strong>: Perpetrators is defined as “It depict some identity group as perpetrators”.</p><blockquote>Example: Black people steal everything</blockquote><p><strong>Comparisons</strong>: Comparisons is defined as “Abusive comparisons are comparisons in which the vehicle (such as you) is compared to some offensive entity, action or state (such as idiot).”</p><blockquote>Example: You talk like an idiot. You look like someone only a mother could love.</blockquote><p><strong>Dehumanization</strong>: Comparisons is defined as “The act of perceiving or treating people as less than human.”</p><blockquote>Example: I own my wife and her money.</blockquote><p><strong>Euphemistic Constructions</strong>: Euphemistic Constructions is defined as “The remarks that were disguised as an euphemistic construction.”</p><blockquote>Example: You inspire my inner serial killer.</blockquote><p><strong>Call for Action</strong>: Call for Action is defined as “The author of a text asks that something, typically some form of punishment, needs to be done to the abused target”</p><blockquote>Example: Thank you for your fortitude and perseverance. Please give McConnell a kick in the butt from some of us.</blockquote><p><strong>Call for Action</strong>: Call for Action is defined as “The author of a text asks that something, typically some form of punishment, needs to be done to the abused target”</p><blockquote>Example: Thank you for your fortitude and perseverance. Please give McConnell a kick in the butt from some of us.</blockquote><p><strong>Multimodal Abuse: “</strong>Most social-media platforms allow users to embed<br>images or videos in their posts. In many cases, the abusive content of a micropost is hidden in the non textual components or results as an interplay of text and image/video”</p><p><strong>Phenomena Requiring World Knowledge and Inferences: </strong>This type of implicit abuse falls into the sub categories of jokes, sarcasm and implicit abuse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*2KHkuxpuArSX7NFl2isN_w.png" /><figcaption>Dataset under consideration in the paper</figcaption></figure><p>Using these subcategories authors manually annotated a sample of 500 texts from different datasets and found out that existing datasets are not a good source of data for learning implicit abuse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6razmif_UFvtVwVveKivQ.png" /><figcaption>Subtypes of Abuse in datasets under consideration</figcaption></figure><p>Based on the paper let’s see what are do’s and don’ts of implicit abusive language detection</p><p><strong>Problems With Existing Datasets.</strong></p><ol><li>Large datasets for abusive language detection generated by random sampling typically have an overwhelming proportion of explicit abuse among abusive instances; therefore, they should not be relied on for implicit abuse detection.</li><li>Datasets with a higher proportion of implicit abuse are prone to biases caused by sampling of the underlying raw data. (Typically, text is sampled for certain keywords or topics that may coincide with abusive language.)</li><li>It is extremely consequential to increase the size of data by merging different corpora. Supervised classifiers may simply produce higher classification scores as a result of the merging process’s additional biases.</li></ol><p><strong>Things To do</strong></p><ol><li>Make new datasets that focus on specific types of implicit abuse. This will also make it easier to consider appropriate negative data.</li><li>Create a dataset based on smaller units of text, such as clauses, rather than the entire text. Because this small unit is easier to learn than a micropost or an article.</li></ol><p>If you enjoyed the article like and share, if you have any questions, please leave them in the comments. Follow me on <strong>Facebook</strong>, <strong>Instagram</strong>, <strong>LinkedIn</strong>, and <strong>YouTube </strong>for more content. See you in my next post, and until then, happy coding ❤</p><p><strong>References:</strong></p><ol><li>Implicitly Abusive Language — What does it actually look like and why are we not getting there? (https://aclanthology.org/2021.naacl-main.48) (Wiegand et al., NAACL 2021)</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d44bdfea5e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create your first chrome extension “Wise Man Says”]]></title>
            <link>https://medium.com/@owaisr814/create-your-first-chrome-extension-wise-man-says-a12a5290c5e6?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a12a5290c5e6</guid>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[quotes]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Mon, 16 Mar 2020 21:52:16 GMT</pubDate>
            <atom:updated>2020-03-16T21:52:16.167Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog post we are going to see how we can create a chrome extension. It may seems difficult but getting started and creating your first chrome extension isn’t that difficult. Here we will be creating a simple extension which whenever we will open show a piece of advice.</p><p>lets start</p><p>There are two part of chrome extension one is manifest.json and other is front end that gives look and feel and dynamic behavior to extension for my extension I have created 4 files manifest.json popup.html and popup.js and wise.png which is the logo for extension.</p><h3>1. manifest.json</h3><p>It is the most important file in creating chrome extension it contain the information such as logo which will shown in address bar and page which will pop up when extension is clicked it also contain information regarding the versions and permission required in extension. Below picture shows the code of our chrome extension</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AvyJuFgFw_2JiJ6T4sEI4Q.png" /><figcaption>manifest.json</figcaption></figure><h3>2. popup.html</h3><p>This file contains html and css which gives look and feel to our extension the basic is design is same as design of any web page minimal amount of designing is applied just to give it a decent look below picture show html css code for extension</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S2684D_VS48WzKa-tHclSQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KhJkakw3n_0QFDlBsSgRw.png" /><figcaption>complete popup.html</figcaption></figure><h3>3. popup.js</h3><p>This file contains the functionality which make our extension dynamic so in our extension we are getting quote or piece of advice from an open api so our in this file we get data from api and show it on front end</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*e7J76NPgVi-kImTj9ej-_g.png" /><figcaption>popup.js</figcaption></figure><p>Now we have everything lets have a look in our chrome browser and to do so apply following steps</p><ol><li>Open chrome</li><li>Go to more tools</li><li>Go to extensions</li><li>Make sure on top right corner developer mode button is on</li></ol><p>By following these steps you would be on screen which look like in below figure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgCiqRyxNMv1k4I7Pk1eKg.png" /></figure><p>Now click on load unpackaged select the folder which contains all the files we made or where the whole code is and you will see your extension there as shown in below picture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*grrwwMTkZi1PztS9p0jbHQ.png" /><figcaption>Wise man says loaded</figcaption></figure><p>Now you will able to see your extension in url bar as i can see mine show in picture below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*rCW893ceiX_yxdcyDy_4PQ.png" /></figure><p>lets click and see how it looks like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*65MIMziEQJwJ2OZ8c7U2CA.png" /><figcaption>Wise man says extension look and feel</figcaption></figure><p>So this is how this extension looks like.</p><p><a href="https://github.com/owais4321/wise-man-says-chrome-extension"><strong>https://github.com/owais4321/wise-man-says-chrome-extensio</strong>n</a> this is the github repository for extension if anyone wants to see code or add any new features to the extension and do some experiment you’re more then welcome</p><p>Hope you have enjoyed the blog post comment clap share have any query ask me at owais.leghari@hotmail.com see you all with my next blog post.</p><p>Happy Coding❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a12a5290c5e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis of Donald Trumps tweets during different phases of his life using NLP]]></title>
            <link>https://medium.com/analytics-vidhya/analysis-of-donald-trumps-tweets-during-different-phases-of-his-life-using-nlp-2eca27b6db30?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2eca27b6db30</guid>
            <category><![CDATA[donald-t]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[word-cloud]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Wed, 26 Feb 2020 16:05:35 GMT</pubDate>
            <atom:updated>2020-03-02T04:27:43.110Z</atom:updated>
            <content:encoded><![CDATA[<p>Since the Trump presidency, the role of twitter has changed it has become official source of information like getting news of trump firing secretary of state via tweet. Donald Trump unlike any other president wakes up to twitter in the beginning of trump presidency Donald trump was tweeting at the rate of 9 tweets per day but as time past the tweet rate has tripled. According to the New York Times, Donald Trump has tweeted 11,000 times in 33 months. Twitter has always been Donald Trump’s favorite social media platform. So lets analyze Trump’s tweets in form of word cloud.</p><h3>Dataset</h3><p>The <a href="https://www.kaggle.com/austinreese/trump-tweets">dataset</a> used here is taken from kaggle. It contains 9 columns content for tweet text, date for date of tweet, retweets for number of retweets, favorites for number of favorites, mentions for mentions (if any), hashtags for hashtags (if any) and geo for location of tweet (if specified). We are using two columns for our purpose:</p><ul><li>content for taking complete text of tweet and</li><li>second is date to specify the period of tweet.</li></ul><p>We will be applying operations on this.</p><h3>Pre-processing</h3><p>We are using NLTK package for NLP operations. The text we get from content column need a bit of cleaning so we have applied following techniques to pre-process</p><ol><li>Using regular expression to eliminate all symbol except alphabet</li><li>Stemming to find root word to kill ambiguity</li><li>Stopword removal</li></ol><h3>Different Periods of Donald Trump’s life</h3><p>Following are the important dates which are used to find out tweets during 4 phases of Donald Trump’s life</p><ol><li>Before Presidency</li><li>During Election campaign</li><li>During Presidency</li><li>During Impeachment hearing</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*NJiCTdBN0qDnrWOMoacv6A.png" /><figcaption>Important Dates for our kernel</figcaption></figure><h3>Word Cloud</h3><p>Word Cloud or Tag cloud is a novel way to represent textual data in order to create word cloud we have used wordcloud library in python and we have used matplotlib to plot that word cloud</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*rl-Z2ItPfK_QPmQFlGQsHA.png" /><figcaption>snippet for creating and plotting word cloud</figcaption></figure><h3>Word Cloud before presidency</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/0*3JvTvMvDKqt1HztB.png" /><figcaption>Word Cloud before presidency</figcaption></figure><h3>During Election Campaign</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*5coTNJHIMSn4cqabivjv4Q.png" /><figcaption>During Election Campaign</figcaption></figure><h3>During Whole Presidency</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*z0K_cgAa3kJyvCq_es1r-A.png" /></figure><h3>During Impeachment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*13vR96eMKS_TMBPNRnd2fg.png" /><figcaption>During Impeachment</figcaption></figure><p>Hope you enjoyed the reading following is the link of my kaggle kernel have a look upvote if you like it</p><p><a href="https://www.kaggle.com/owaisraza009/trumps-tweets-word-cloud-during-phases-of-his-life">https://www.kaggle.com/owaisraza009/trumps-tweets-word-cloud-during-phases-of-his-life</a></p><p>Happy coding ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2eca27b6db30" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/analysis-of-donald-trumps-tweets-during-different-phases-of-his-life-using-nlp-2eca27b6db30">Analysis of Donald Trumps tweets during different phases of his life using NLP</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Should You Buy Refurbished Phones?]]></title>
            <link>https://medium.com/@owaisr814/should-you-buy-refurbished-phones-41e9e4a3cf03?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/41e9e4a3cf03</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Sun, 10 Nov 2019 15:59:16 GMT</pubDate>
            <atom:updated>2019-11-10T15:59:16.299Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*KF_v6jWvzu3ur5P2-ktgKg.jpeg" /></figure><p>Enabling on-demand music, video, mapping, communication, banking and much more, smartphones have upended our lives. As smartphones have gotten, well, smarter over the years, there’s less of a need to upgrade to the newest model — especially when a new phone can cost $1,000 or more. If you’re looking to upgrade your phone on a budget, refurbished phones should be at the top of your consideration set.</p><p>Refurbished smartphones are pre-owned phones that have been repaired and tested for functionality. Many refurbished phones even come with a warranty that is similar to what new phones offer. Issues with refurbished phones are rare, but it’s still important to verify that you are covered by a warranty — or can return the phone if it doesn’t meet your expectations.</p><p>New smartphones are being released by manufacturers at a rapid rate, but in many cases the changes from one model generation to another are minimal. There is a good chance that the latest version of a smartphone will only have slight upgrades to the generation that preceded it. You may even feel that the design of the newest model is a step backwards: if, for example, the redesign got rid of a feature like a smartphone jack that you rely on heavily.</p><p>In these scenarios, sticking to <a href="https://www.mywit.com/">refurbished phones</a> may be a better option than buying new. Refurbished phones are ideal for people who like their phone experience to remain the same from one year to the next. If your phone is not working anymore, you can simply replace it with a refurbished model: effectively getting a new phone at a discounted price. This way, refurbished phones can allow you to continue using your preferred phone.</p><p>Refurbished phones are also ideal for people who are not adaptable to the latest technology. They get a new phone with a user interface that they are familiar with, saving them from having to relearn how to operate their device. Furthermore, many refurbished phone sellers offer a 30-day return policy and a competitive warranty.</p><p>It’s important to be smart when shopping for a refurbished phone, however. If the vendor does not offer a warranty or a return option, that may indicate that the phone was not restored to nearly-new condition. Be sure to browse online reviews of phone vendors, as well, to ensure you’re making a safe purchase. If you purchase from a reputable vendor, you are likely to get a smartphone that is just as durable as a new phone. All in all, if you don’t feel like you need the latest technology — and do your research to find a trusted vendor — a refurbished phone may be the perfect option for you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41e9e4a3cf03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[6 Questions to Ask Yourself Before You Expand Your Business]]></title>
            <link>https://medium.com/@owaisr814/6-questions-to-ask-yourself-before-you-expand-your-business-99417577194b?source=rss-d41e98b77e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/99417577194b</guid>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[owais raza]]></dc:creator>
            <pubDate>Wed, 06 Nov 2019 08:32:22 GMT</pubDate>
            <atom:updated>2019-11-06T11:28:29.027Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Start a Business in 5 Steps</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*1LrjaZrBBe3AK5KnHiln6Q.jpeg" /></figure><p>Are you an entrepreneur with a million-dollar business idea? So, then get off that chair and make your idea a reality! What are you waiting for? Starting a business can take a lot of time and it can be overwhelming. Entrepreneurs like you are providing customers with new innovative products and services all over the world. So, trust me, the world of consumers is rooting for you to succeed! Just how do you take your idea and put it into action? Well, the following steps will help you create the startup of your dreams!</p><p><strong>Do Your Research</strong></p><p>Well, unfortunately, not every idea is a million-dollar idea. So, how can you make sure your business idea is going to be worth the time and money it takes to create a startup? Do your research! As an entrepreneur, I am sure you know that your business will only be as successful as the market allows it to be. In other words, is there a market need? Did you know that the number one cause of failed startups was due to lack of market need? Starting your own business can be risky, but with proper research, you should conclude whether your business idea is worth the shot. Doing a market analysis will allow you to get a better understanding of the industry you are entering and how to gain strategic advantage over those that are already in the industry.</p><p><strong>Make a Business Plan</strong></p><p><a href="https://www.entrepreneur.com/article/281416">Creating a solid business plan</a> will help you better understand the future of your startup business. Creating a successful business plan takes time, research and knowledge. The first part of your business plan is going to include your executive summary, company description, market analysis, organizational and management details, list of products and services, marketing and sales plans, funding requests, financial projections, and the appendix. The executive summary is going to be a detailed overview of the overall plan. This is going to sum up your business plans content and set the tone for the reader. The executive summary should catch the eye of the reader and really capture their attention. The market analysis is going to allow you to show that there is in fact a large enough market need to create and maintain a sustainable startup company. There is a lot that goes into a business plan, so if you are looking for help, you might want to talk to a startup business consulting agency!</p><p><strong>Get Funding</strong></p><p>Don’t let the lack of money prevent you from starting your dream company! More often than not, businesses will need <a href="https://www.seekcapital.com/startup-business-loans/StartupBusinessCapital.html">startup business loans</a> to create the company of their dreams. It is key to know your funding options and come up with a justifiable amount. There are loans, business lines of credit and even small business grants for entrepreneurs just like you! Also, keep in mind, even if you don’t need the funding to get started, you may want to get a business line of credit or startup business loan for things like expansion, payroll, inventory, advertising budgets, hiring a top of the line staff, and any remodels you may want to make in the first months of your business. Having this money for backup and emergencies down the road may save you some heartache and unnecessary problems in the future. So, what are some things you may <a href="https://www.thebalancesmb.com/how-to-apply-for-a-small-business-loan-393254">apply for a loan</a>? You will need to have the perfect business plan, check your credit report, consider what you have for collateral, and consider investing some of your own funds.</p><p><strong>Pick You Company Name</strong></p><p>Your business name is going to be important! You wouldn’t just name your baby anything, right? So, obviously coming up with a creative business name is both exciting and important. So, take your time and really think about the name that fits you and your company. After you come up with the perfect name, check to make sure it is not already being used or owned. Then register your business name and create a domain name as well!</p><p><strong>Create Your Dream Team</strong></p><p>Every startup business needs a team of talented employees. Sure, you may want to just hire friends and family to start, but really putting that effort into finding people that will be good for your company is key. You want leaders, team players, innovative, and motivated personnel running your business. Your startup is like your baby and your employees are going to be like your family. Your employees are going to have to be passionate about what your company is offering to the world. If your employees are passionate, they will treat your business like their baby too! It is suggested that you find the “dream team” sooner than later!</p><p>Startups and small businesses are great for the economy. They create jobs, growth and innovation within local communities. Opening a business and being a part of the difference is just one of the rewarding things about starting a business. Starting your own business means being your own boss and making your own schedule. Sure, you are going to have to put in the hours to create a successful business with growth opportunities, but it will all be worth it! So do your research, write your business plan, get the funding you need and gather your dream team! Make it happen!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99417577194b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>