<?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 Deval Parikh on Medium]]></title>
        <description><![CDATA[Stories by Deval Parikh on Medium]]></description>
        <link>https://medium.com/@devalpp?source=rss-981e779d864e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WATtZDiXRhkzamdBKVzi5A.png</url>
            <title>Stories by Deval Parikh on Medium</title>
            <link>https://medium.com/@devalpp?source=rss-981e779d864e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 08 Apr 2026 08:25:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@devalpp/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[Visualizing Backpropagation in Neural Network Training]]></title>
            <link>https://medium.com/data-science/visualizing-backpropagation-in-neural-network-training-2647f5977fdb?source=rss-981e779d864e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2647f5977fdb</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Deval Parikh]]></dc:creator>
            <pubDate>Fri, 14 Jan 2022 19:20:51 GMT</pubDate>
            <atom:updated>2022-01-14T19:20:51.394Z</atom:updated>
            <content:encoded><![CDATA[<h3>Visualizing Backpropagation in Neural Network Training at Any Scale</h3><h4>Using HiPlot to generate parallel coordinate plots to visualize deep learning model training.</h4><figure><img alt="A parallel coordinate plot generated to visualize ML training" src="https://cdn-images-1.medium.com/max/1024/1*tveesbVZ-nCY_vZjlSCWOA.png" /><figcaption>A parallel coordinate plot to visualize ML training (Image by Author)</figcaption></figure><p>Understanding and debugging a Neural Network’s performance on a dataset is a critical chapter in the end-to-end lifecycle of a Machine Learning (ML) model. Having the ability to comprehend how a model is training can provide valuable insight into where improvements can be made. In this article, we will walk through creating a simple, yet effective, method of visualizing a process called <a href="https://towardsdatascience.com/understanding-backpropagation-algorithm-7bb3aa2f95fd">backpropagation</a> during Neural Network training. The visualization technique we will be using is called <a href="https://www.data-to-viz.com/graph/parallel.html">parallel coordinate plots</a>. This is generally a technique used to visualize many different features with varying units or types from multiple data points. Below is an outline of the rest of this article:</p><ol><li>Understanding the importance of evaluating deep learning models</li><li>Building a foundation</li><li>Generating a visualization</li></ol><h3>1. Understanding the importance of evaluating deep learning models</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LJeisZ7hbzoTYb9Z" /><figcaption>Photo by <a href="https://unsplash.com/@hansreniers?utm_source=medium&amp;utm_medium=referral">Hans Reniers</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Deep learning models have a wide range of real-world applications ranging from fraud detection to self-driving vehicles. These applications are often things that impact our daily lives. When a model is scaled to be used by millions of users, millions of times a day, a marginal improvement in model metrics could result in a significant improvement in overall model performance.</p><p>By using visualizations, we can add another layer of depth to understanding how exactly our models are training and performing over each <a href="https://deepai.org/machine-learning-glossary-and-terms/epoch">epoch</a>. The further we can understand our models, the clearer decisions we can make during model selection. We can also use this information to understand if our models are being over-fitted or under-fitted based on the evaluation metric used, which can help with tuning hyperparameters.</p><h3>2. Building a foundation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fu5PfapomhT5YbNl" /><figcaption>Photo by <a href="https://unsplash.com/@etiennegirardet?utm_source=medium&amp;utm_medium=referral">Etienne Girardet</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now that we understand the benefits that visualizing model training can provide, let’s get building! This example will be using Python version 3.7.</p><p>We will start by importing our Python dependencies:</p><pre>import tensorflow as tf</pre><pre>from keras import layers<br>from keras import models</pre><p>For this example model, we will be using the [1] <a href="https://keras.io/api/datasets/boston_housing/"><strong>Keras Boston Housing dataset</strong></a>. This dataset contains 13 features of houses around Boston, with the target value being the value of the home. To download and load the data add the following lines:</p><pre># Download dataset<br>dataset = tf.keras.datasets.boston_housing</pre><pre># Test train split<br>(x_train, y_train), (x_test, y_test) = dataset.load_data()</pre><pre># Normalize data using training data<br>mean = train_data.mean(axis=0)<br>train_data -= mean<br>std = train_data.std(axis=0)<br>train_data /= std<br><br>test_data -= mean<br>test_data /= std</pre><p>Now that the data is ready to be trained on, we will create a function to build our barebones Neural Network.</p><pre>def build_model():</pre><pre>    model = models.Sequential()</pre><pre>    model.add(layers.Dense(64, activation=&#39;relu&#39;,<br>              input_shape=(x_train.shape[1],)))</pre><pre>    model.add(layers.Dense(64, activation=&#39;relu&#39;))</pre><pre>    model.add(layers.Dense(1))</pre><pre>    model.compile(optimizer=&#39;rmsprop&#39;, loss=&#39;mse&#39;, metrics=[&#39;mae&#39;])</pre><pre><br>return model</pre><p>Lastly, let’s train the model!</p><pre>num_epochs = 18</pre><pre>model = build_model()</pre><pre>model_history = model.fit(x_train, y_train, epochs=num_epochs, batch_size=16, verbose=0)</pre><pre>test_mse_score, test_mae_score = model.evaluate(x_test, y_test)</pre><pre>print(test_mae_score)</pre><p>Here are model is using <strong>Mean Absolute Error </strong>(MAE) as an evaluation metric. MAE can be used to evaluate how accurate our model is and can give a sense of performance. The MAE score will always be a positive number and the closer the score is to 0, the better your model is performing. MAE can be calculated by taking the average magnitude of errors. Take the absolute value of the predicted values subtracted by the actual values and take the sum off all of those numbers and lastly divide it by the total number of data points, 🎉 you’ve got your MAE score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*_aPHtBO39z9V7mcUo2YBQA.png" /><figcaption>The formula for calculating MAE (Image by Author)</figcaption></figure><h3>3. Generating a visualization</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*phAkJ1Y43Ecdl0Y0" /><figcaption>Photo by <a href="https://unsplash.com/@isaacmsmith?utm_source=medium&amp;utm_medium=referral">Isaac Smith</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now for the best part! Let&#39;s visually observe how model training went with our baseline Neural Network at each epoch by generating a parallel plot!</p><p>To do this we will leverage Facebook’s open-source HiPlot library. <strong>HiPlot</strong> is a lightweight tool that is able to easily and quickly generate a parallel coordinate plot based on the provided data. This is a super convenient way of displaying multiple features side-by-side to visually analyze what data looks like. In our case, we can use extracted meta-data about our model’s training to very quickly create a stunning and interactive visualization. More information about HiPlot can be found on the <a href="https://github.com/facebookresearch/hiplot">HiPlot Github Repository</a>.</p><p>To generate the visualization, first, you will need to install a Python dependency for HiPlot:</p><pre>pip install -U hiplot</pre><p>Next, you will need to import HiPlot and use the functions to generate the plot.</p><pre>import hiplot as hip</pre><pre>data = [{&#39;epoch&#39;: idx,<br>         &#39;loss&#39;: model_history.history[&#39;loss&#39;][idx], <br>         &#39;mae&#39;: model_history.history[&#39;mae&#39;][idx]}<br>       for idx in range(num_epochs)]<br>hip.Experiment.from_iterable(data).display()</pre><p>The code above will use the return value of the Keras model.fit() method to load in the model history to HiPlot to be visualized and interacted with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hm7axgABJpTTAD-BCqwtGQ.gif" /><figcaption>Interacting with the parallel plot generated by HiPlot (Image by Author)</figcaption></figure><p>🎉 Congratulations on building a Neural Network model and visualizing the backpropagation process with a parallel plot generated by HiPlot! You’ll notice for each epoch, the MAE score progressively gets better and now we are able to analyze and interact with this data while seeing where fitting tapers off at the exact epoch.</p><p>Going through this process, we can see how viable and seamless creating these interactive visualizations can be, while still providing great insight into how a model ran during training by leveraging training history data. One of the biggest <strong>advantages</strong> of using HiPlot is you can add many other attributes to extend onto the visualization to paint an even better picture without the cost of significantly increasing computing power needs.</p><h3>References</h3><p>[1] Boston Housing Dataset: <a href="https://keras.io/api/datasets/boston_housing/">https://keras.io/api/datasets/boston_housing/</a></p><p>Harrison, D. and Rubinfeld, D.L. ‘<a href="https://www.law.berkeley.edu/files/Hedonic.PDF">Hedonic prices and the demand for clean air</a>’ (1978), J. Environ. Economics &amp; Management, vol.5, 81–102</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2647f5977fdb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/visualizing-backpropagation-in-neural-network-training-2647f5977fdb">Visualizing Backpropagation in Neural Network Training</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Real Time Chat Application with NLP Super Powers!]]></title>
            <link>https://medium.com/data-science/building-a-real-time-chat-application-with-nlp-super-powers-ce800e19cb2b?source=rss-981e779d864e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce800e19cb2b</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Deval Parikh]]></dc:creator>
            <pubDate>Tue, 01 Jun 2021 01:08:32 GMT</pubDate>
            <atom:updated>2021-06-01T16:49:43.166Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Real Time Chat Application with NLP Capabilities</h3><h4>A Chat App with Sentiment Analysis and Tone Detection using TensorFlow JS Deep Learning API, IBM Cloud, Node.JS, Web Sockets, and React</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UALSe7FSNkTbgjqU" /><figcaption>Photo by <a href="https://unsplash.com/@lunarts?utm_source=medium&amp;utm_medium=referral">Volodymyr Hryshchenko</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In a world where Artificial Intelligence (AI) and Machine Learning (ML) models are being leveraged to obtain real-time information to continuously improve customer experience, I wanted to discover how effective ML can prove to be when trying to understand human conversations, and even try building our own custom application that implements this technology.</p><h4>Conversational Machine Learning in Practice</h4><p>The world is quickly adapting to using AI-driven applications to assist humans on a day to day basis. Siri and Alexa are driven by Natural Language Processing (NLP) based ML models that are continuously training and iterating to sound more natural and offer more value by understanding complex human dialog. Not to mention, Google’s latest conversation technology, <a href="https://blog.google/technology/ai/lamda/">LaMDA</a>. LaMDA is trained in a way to be able to interrupt larger blocks of human conversation and understand how multiple words or phrases are related to each other to gain more context about the inputed text, specifically targeting human dialog. It is then able to dynamically generate a response that is natural and human-like. The following is from Google’s AI blog post, <a href="https://blog.google/technology/ai/lamda/"><em>LaMDA: our breakthrough conversation technology</em></a>, which briefly describes the deep learning technology LaMDA is built on:</p><blockquote>[1] LaMDA’s conversational skills have been years in the making. Like many recent language models, including BERT and GPT-3, it’s built on <a href="https://ai.googleblog.com/2017/08/transformer-novel-neural-network.html">Transformer</a>, a neural network architecture that Google Research invented and open-sourced in 2017</blockquote><p>This technology is super impressive and is quickly proving how valuable it can be in our daily lives, from making reservations for us to eliminating the need for human powered call centers.</p><h4>Challenges of Machine Learning</h4><p>However, it’s not all rainbows and sunshines, in the process of training and integrating ML models into production applications, there comes many challenges. How do we test these models? How do we develop reliable models? How do we ensure biases in ML models are optimally mitigated? How easily can we build applications to scale that use these models? These are all questions to consider when developing ML solutions at scale.</p><h3>Let’s Build Our Own App!</h3><p>In this article, we are going to build a custom full stack application that utilizes <a href="https://www.tensorflow.org/tutorials/keras/text_classification_with_hub">Google’s TensorFlow</a> and<a href="https://www.ibm.com/cloud/watson-natural-language-understanding"> IBM’s Cloud Machine Learning as a Service (MLaaS) platform</a> to discover how competently engineers can develop maintainable, reliable, and scalable full stack ML solutions using Cloud-based tools.</p><p><strong>The application we will be building is a real-time chat application that is able to detect the tone of the users’ messages.</strong> As you can imagine the use cases for this can span greatly, from understanding customers’ interaction with customer service chats to understanding how well a production AI chatbot is performing.</p><h4>Architecture</h4><figure><img alt="Real-time Chat App Architecture" src="https://cdn-images-1.medium.com/max/1001/0*lC1Y1l-SsuqRrn4j.png" /><figcaption>At a high level, this is the architecture of the application.</figcaption></figure><p>The high level application architecture consists of utilizing React and TypeScript for building out our custom user interface. Using Node.JS and the Socket.IO library to enable real-time, bidirectional network communication between the end user and the application server. Since Socket.IO allows us to have event-based communication, we can make network calls to our ML services asynchronously upon a message that is being sent from an end user host.</p><h4>Backend</h4><p>As for as the ML services, we can make an HTTP request (that contains the content of the chat message being sent in the payload) to IBM’s Cloud based tone detection models. The response from IBM’s web service will be a JSON object containing an array of tones that the model classified that message having, such as</p><pre>[“Joy”, “Positive”, “Happy”]</pre><p>Asynchronously, our Node.JS web service can make a request to TensorFlow’s Sentiment API. TensorFlow’s ML model is a Convolutional Neural Network based Deep Learning architecture that has been trained on 50,000 labelled data points made up of IBMD movie reviews to be able to predict the sentiment of newly introduced inputted texts. We will send each new chat message through TensorFlow’s pre-trained model to get an average Sentiment score of the entire chat conversation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dac16f73062ebeb0758c013b58f49726/href">https://medium.com/media/dac16f73062ebeb0758c013b58f49726/href</a></iframe><p>In the above gist, you can see upon a client sending a new message, the server will call 2 functions, getTone and updateSentiment, while passing in the text value of the chat message into those functions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9ecd2030d2031054514d081b4d80b61/href">https://medium.com/media/e9ecd2030d2031054514d081b4d80b61/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b612eec0ee803444b7d77f20018e3f5d/href">https://medium.com/media/b612eec0ee803444b7d77f20018e3f5d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e7f22a05aecb4b06207113b7fb6dd7e/href">https://medium.com/media/1e7f22a05aecb4b06207113b7fb6dd7e/href</a></iframe><p>The predict function above is called in updateSentiment. This function loads the TensorFlow pre-trained model by using a network fetch, preprocesses the inputted data, and uses the model to evaluate a sentiment score. This all happens in the background parallel to processing other backend tasks.</p><h4>Frontend</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c2befb9881e5ca97850da3936f99ce0/href">https://medium.com/media/4c2befb9881e5ca97850da3936f99ce0/href</a></iframe><p>In the code above, we are building a functional React component to handle client side interaction with the Chat Application. Since we are using a functional component, we have access to React hooks, such as useState and useEffect. The <strong>message</strong> state holds the value of the current user’s inputed text. The <strong>messages</strong> state holds the array of all sent messages. You can see the connection to the Socket server in useEffect, which will be called upon every re-render/on-load of the component. When a new message is emitted from the server, and event is triggered for the UI to receive and render that new message to all online user instances.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/187f21ff1fc18d567537c0397feba6bf/href">https://medium.com/media/187f21ff1fc18d567537c0397feba6bf/href</a></iframe><p>The messageObject emitted from the sendMessage function will reach the server which will parse out the messageObject.body (the actual value of the user sent chat message) and process the data through the ML web services built out previously. It will then build and return a new object containing the message, username, and the tone of the message acquired from the ML model’s output.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7106e0ffef21d14738f34763d06467d4/href">https://medium.com/media/7106e0ffef21d14738f34763d06467d4/href</a></iframe><p>and the final results… <strong>TADA!</strong></p><figure><img alt="Demo of Real-time Chat App" src="https://cdn-images-1.medium.com/max/1024/1*KmVHS7miXDwxMc1ZRMKXqQ.gif" /><figcaption>A demonstration of the application we built in this article. Each chat bubble contains the tag of the tone of that given message. (Source: Author)</figcaption></figure><h4>Full Source Code</h4><p>To checkout the full code visit the Github repository:</p><p><a href="https://github.com/devalparikh/NLP_Chat_App">devalparikh/NLP_Chat_App</a></p><h4>Conclusion</h4><p>Through building this proof of concept project, I hope to demonstrate how seamless it is to develop a custom application that can integrate Machine Learning tools and techniques by utilizing Cloud-based Web Services to be scalable and maintainable. By using IBM’s Cloud Services and Google’s TensorFlow Pre-Trained Sentiment Model, we were able to build a chat application that can classify the tone of each chat message, as well as the overall sentiment of the conversation.</p><h4><strong>References</strong></h4><p>[1] E. Collins, Z. Ghahramani, <a href="https://blog.google/technology/ai/lamda/">LaMDA: our breakthrough conversation technology</a> (2021), <a href="https://blog.google/technology/ai">https://blog.google/technology/ai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce800e19cb2b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/building-a-real-time-chat-application-with-nlp-super-powers-ce800e19cb2b">Building a Real Time Chat Application with NLP Super Powers!</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>