<?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 VISHAL V COOL on Medium]]></title>
        <description><![CDATA[Stories by VISHAL V COOL on Medium]]></description>
        <link>https://medium.com/@Vishal_v_cool?source=rss-701540829f79------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TSCl8eGQONqHbX27</url>
            <title>Stories by VISHAL V COOL on Medium</title>
            <link>https://medium.com/@Vishal_v_cool?source=rss-701540829f79------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 14:42:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Vishal_v_cool/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[How to Use TPU v3–8 on Kaggle with TensorFlow 2.18.0]]></title>
            <link>https://medium.com/@Vishal_v_cool/how-to-use-tpu-v3-8-on-kaggle-with-tensorflow-2-18-0-e40d590f64b9?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/e40d590f64b9</guid>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Wed, 05 Mar 2025 09:37:27 GMT</pubDate>
            <atom:updated>2025-03-05T09:37:27.162Z</atom:updated>
            <content:encoded><![CDATA[<h3>Step 1: Setting Up the Kaggle Environment</h3><ol><li><strong>Go to your Kaggle notebook.</strong></li></ol><p>2. Click on <strong>“Settings”</strong> (gear icon in the top right).</p><p>3. Under <strong>“Accelerator”</strong>, select <strong>TPU</strong>.</p><h3><strong>Code:</strong><br>Initializing TPU in TensorFlow 2.18.0</h3><pre>import tensorflow as tf<br><br># Detect and initialize TPU<br>try:<br>    tpu = tf.distribute.cluster_resolver.TPUClusterResolver(tpu=&quot;local&quot;)  <br>    tf.config.experimental_connect_to_cluster(tpu)<br>    tf.tpu.experimental.initialize_tpu_system(tpu)<br>    strategy = tf.distribute.TPUStrategy(tpu)<br>    print(f&quot;Running on TPU: {tpu.master()}&quot;)<br>except Exception as e:<br>    print(f&quot;Could not initialize TPU: {e}&quot;)<br>    strategy = tf.distribute.get_strategy()  # Fallback to default CPU/GPU<br>    print(&quot;Running on CPU or single GPU&quot;)<br><br># Print number of available TPU cores<br>print(&quot;Number of devices:&quot;, strategy.num_replicas_in_sync, &quot;🚀&quot;)</pre><p>Output of this code will probably look like this:</p><pre>Running on TPU: grpc://10.xxx.xxx.xxx:8470<br>Number of devices: 8 🚀</pre><p>If you seee the rocket (🚀) at the end, you are good to go.</p><blockquote>now under strategy.scope(): do the compile and training parts.</blockquote><pre>#just an example.<br><br><br>with strategy.scope():<br>    model = tf.keras.models.Sequential([<br>        tf.keras.layers.Dense(128, activation=&quot;relu&quot;),<br>        tf.keras.layers.Dense(10, activation=&quot;softmax&quot;)<br>    ])<br>    model.compile(optimizer=&quot;adam&quot;, loss=&quot;sparse_categorical_crossentropy&quot;, metrics=[&quot;accuracy&quot;])<br><br>with strategy.scope():<br>    model.fit(....)</pre><blockquote>After training Save it as .h5 model</blockquote><pre>model.save(&quot;my_model.h5&quot;)</pre><blockquote>To load it:</blockquote><pre>with strategy.scope():<br>    model = tf.keras.models.load_model(&quot;path_to_model.h5&quot;)</pre><p>Error Message:Could not initialize TPU: Please provide a TPU Name to connect to</p><p>Possible Fix: Ensure TPU is selected in <strong>Kaggle Settings</strong> and use tpu=&quot;local&quot; in the code.</p><p>Thank-you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e40d590f64b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Hidden Math Behind Matplotlib: Understanding Projection Matrices ]]></title>
            <link>https://medium.com/@Vishal_v_cool/the-hidden-math-behind-matplotlib-understanding-projection-matrices-2de1f0ede8d5?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/2de1f0ede8d5</guid>
            <category><![CDATA[linear-algebra-and-python]]></category>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 08:53:30 GMT</pubDate>
            <atom:updated>2024-11-17T08:53:30.073Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>When you use Matplotlib to create visualizations, have you ever wondered how your data is transformed to fit the screen? It all boils down to a mathematical tool called a <strong>projection matrix</strong>. This matrix is what helps map your data points from the real world onto your 2D computer screen.</p><p>In this article, we’ll explore how projection matrices work in the context of plotting with Matplotlib. We’ll also demonstrate the concepts with Python code, so you can see these transformations in action!</p><h3>What is a Projection Matrix? 🧮</h3><p>A <strong>projection matrix</strong> is used in computer graphics to convert points from a higher-dimensional space (like 3D) to a lower-dimensional one (like 2D). It essentially “flattens” the points, allowing us to see a 3D scene on a 2D surface, such as a monitor or a piece of paper.</p><p>In simpler terms, it’s the math behind making 3D objects look realistic on your screen. It decides where each point should appear based on its position and distance from the viewer.</p><h3>Types of Projections</h3><ol><li><strong>Orthographic Projection</strong>:</li></ol><ul><li>This type of projection maps objects directly onto the screen without adjusting for depth.</li><li>It makes objects appear the same size, regardless of their distance from the camera.</li></ul><p><strong>2. Perspective Projection</strong>:</p><ul><li>This is how we naturally see things in the real world.</li><li>Objects farther away appear smaller, creating the illusion of depth.</li></ul><p>Both projections have their uses in Matplotlib, particularly when creating 2D and 3D plots.</p><h3>How Matplotlib Uses Projections</h3><p>Matplotlib relies on projections to convert your data into visuals. For <strong>2D plots</strong>, it uses simple scaling transformations to fit your data within the plotting window. In <strong>3D plots</strong>, it uses a perspective projection to give a sense of depth.</p><h3>Example 1: 2D Plot 🖼️</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jqrF30SueInqSCmg163BXA.png" /></figure><p><strong>Explanation</strong>:</p><ul><li>Here, we plot a quadratic function y = x².</li><li>Matplotlib takes the (x, y) coordinates and maps them directly onto the screen using a process similar to orthographic projection.</li><li>It scales the data to fit within the visible area but does not alter the size based on “depth” since it’s a 2D plot.</li></ul><h3>Example 2: Visualizing with a 3D Plot 🌐</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RU-5k15M5Oxoy2gHr8W2Jw.png" /></figure><p><strong>Explanation</strong>:</p><ul><li>We created a 3D surface plot using the sine function.</li><li>Matplotlib applies a <strong>perspective projection matrix</strong> to convert the 3D coordinates (x,y,z)(x, y, z)(x,y,z) into 2D coordinates for display.</li><li>This projection gives us a realistic depth effect, where parts of the surface farther away appear smaller.</li></ul><h3>Perspective Projection Matrix Explained 🎥</h3><p>The simplified form of a <strong>perspective projection matrix</strong> looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*ab9QGJvld8sW67ebb5KM7g.png" /></figure><p><strong>θ — </strong>is the field of view angle — it controls how much of the scene is visible.</p><ul><li><strong>Aspect ratio</strong> ensures the image doesn’t look stretched.</li><li><strong>Near</strong> and <strong>Far</strong> planes define the range of depth that is visible on the screen.</li></ul><p>This matrix helps determine how 3D points should appear on a 2D surface, making distant objects appear smaller, which enhances the 3D effect.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2de1f0ede8d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Hidden Power of Taylor Series Behind Plotting in ML and DL]]></title>
            <link>https://medium.com/@Vishal_v_cool/the-hidden-power-of-taylor-series-behind-plotting-in-ml-and-dl-46c871668e79?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/46c871668e79</guid>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Fri, 08 Nov 2024 12:11:47 GMT</pubDate>
            <atom:updated>2024-11-08T12:11:47.055Z</atom:updated>
            <content:encoded><![CDATA[<p>Taylor series, a fundamental concept in mathematical analysis, play a crucial yet often overlooked role in the data visualizations we encounter in machine learning (ML) and deep learning (DL) applications. While the intricacies of Taylor series may seem esoteric, understanding their influence can provide valuable insights into the smooth, continuous curves that are central to data visualization and function approximation.</p><p>At their core, Taylor series represent a way to approximate a function using its derivatives at a specific point. The general formula for a Taylor series expansion of a function f(x) around a point x = a is:</p><pre>f(x) = f(a) + f&#39;(a)(x-a) + f&#39;&#39;(a)(x-a)^2/2! + f&#39;&#39;&#39;(a)(x-a)^3/3! + ...</pre><p>Where f’(a), f’’(a), f’’’(a), and so on, are the first, second, third, and higher-order derivatives of the function evaluated at x = a.</p><p>This mathematical representation is powerful because it allows us to capture the local behavior and curvature of a function using just the function’s value and derivatives at a single point. By including more derivative terms, the Taylor series approximation can become increasingly accurate near the expansion point.</p><p>So how do Taylor series come into play with data visualization and function approximation in ML and DL? Let’s explore a few key connections:</p><ol><li>Curve Fitting and Interpolation Many curve fitting and interpolation techniques, such as polynomial regression and spline interpolation, leverage the properties of Taylor series to construct smooth, continuous curves that approximate the underlying data. These polynomial or spline-based functions are often derived from local Taylor series expansions around strategically chosen points.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YlsovvgH6J-7f-NNYuMlLQ.png" /></figure><p>2. Smooth Visualization of Data When you plot a function or dataset in a tool like Matplotlib, the smooth, continuous curves you see are typically the result of applying Taylor series-based approximation methods. These techniques allow the visualization to capture the local curvature and behavior of the data, rather than just connecting discrete points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l3IK-aZFM0B7PWT8PG-gtQ.png" /></figure><p>3. Function Modeling in ML and DL In machine learning and deep learning, model architectures like neural networks often rely on activation functions that are inspired by the mathematical properties of Taylor series. These functions, such as sigmoid, tanh, and ReLU, allow the models to approximate complex, nonlinear relationships in the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nPnLUD4sPN6e8eFHYupjkA.png" /></figure><p>The sigmoid function, a common activation function in neural networks, has a smooth, S-shaped curve that can be well-approximated by a Taylor series expansion.</p><p>4. Numerical Optimization Taylor series expansions also play a crucial role in numerical optimization techniques like gradient descent, which are central to training ML and DL models. By using the derivatives captured in the Taylor series, these optimization methods can efficiently navigate the complex landscapes of model parameters and loss functions.</p><p>While the intricacies of Taylor series may not be immediately apparent in the final data visualizations and model outputs, their mathematical influence is pervasive. Understanding this connection can deepen your appreciation for the elegance and power of Taylor series as a fundamental tool in the world of data analysis and machine learning.</p><p>So the next time you see a smooth, continuous curve in a data visualization or an activation function in a neural network, remember the hidden power of Taylor series — the unsung heroes behind the scenes of modern ML and DL.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46c871668e79" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhancing Model Training with Keras EarlyStopping Callback]]></title>
            <link>https://medium.com/@Vishal_v_cool/enhancing-model-training-with-keras-earlystopping-callback-1d6725a43b70?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d6725a43b70</guid>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Thu, 12 Sep 2024 00:07:54 GMT</pubDate>
            <atom:updated>2024-09-12T00:07:54.718Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is EarlyStopping?</h3><p>The <strong>EarlyStopping</strong> callback in Keras monitors a specific metric (like validation accuracy or loss) during training and stops the process once the metric has stopped improving for a certain number of epochs. This prevents unnecessary training, reduces overfitting, and saves time and computational resources.</p><pre>from tensorflow.keras import callbacks<br><br>early_stopping = callbacks.EarlyStopping(<br>    monitor=&#39;val_accuracy&#39;,<br>    min_delta=0,<br>    patience=40,<br>    verbose=0,<br>    mode=&#39;max&#39;,<br>    restore_best_weights=True<br>)<br><br>model.fit(<br>...<br>...<br>...<br>callbacks = [early_stopping])</pre><h3>How EarlyStopping Helps</h3><p><strong>Prevents Overfitting</strong>: By stopping when the model stops improving on the validation set, you prevent overfitting to the training data.</p><p><strong>Saves Time and Resources</strong>: EarlyStopping helps avoid wasting resources on training epochs that won’t improve model performance.</p><p><strong>Restores Best Model</strong>: With restore_best_weights=True, you can ensure that the final model is the one with the best validation performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d6725a43b70" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Save Your Best Model with Keras ModelCheckpoint Callback]]></title>
            <link>https://medium.com/@Vishal_v_cool/how-to-save-your-best-model-with-keras-modelcheckpoint-callback-091677e5214e?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/091677e5214e</guid>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Thu, 12 Sep 2024 00:05:41 GMT</pubDate>
            <atom:updated>2024-09-12T00:05:41.381Z</atom:updated>
            <content:encoded><![CDATA[<p>When training deep learning models, it’s important to save the best version of your model during the training process. This ensures that even if your model overfits or fails to improve, you’ll still have the version that performed best on a validation metric. The Model checkpoint callback in Keras makes this easy by saving model weights at specified intervals, typically based on performance metrics like validation accuracy.</p><pre>from tensorflow.keras import callbacks<br>import os<br><br>model_checkpoint = callbacks.ModelCheckpoint(<br>    os.path.join(OUTPUT_DIR, &#39;checkpoints&#39;, &#39;your_best_model.h5&#39;),<br>    monitor=&#39;val_accuracy&#39;,<br>    verbose=0,<br>    save_best_only=True,<br>    save_weights_only=False,<br>    mode=&#39;max&#39;,<br>    save_freq=&#39;epoch&#39;<br>)</pre><h3>Why Use ModelCheckpoint?</h3><p><strong>Prevents Data Loss</strong>: If your training session crashes, you won’t lose progress. The best model is saved even if training is incomplete.</p><p><strong>Best Model Selection</strong>: It automatically saves the version of the model with the highest accuracy (or lowest loss) based on your monitored metric.</p><p><strong>Flexible Saving</strong>: You can choose whether to save the entire model or just the weights. You can also control when and how often to save.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=091677e5214e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implement Learning Rate Scheduling in Keras]]></title>
            <link>https://medium.com/@Vishal_v_cool/implement-learning-rate-scheduling-in-keras-e14e957f218f?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/e14e957f218f</guid>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Thu, 12 Sep 2024 00:02:23 GMT</pubDate>
            <atom:updated>2024-09-12T00:02:23.891Z</atom:updated>
            <content:encoded><![CDATA[<p>Learning rate scheduling is an easy way to boost model training, and Keras makes it straightforward with its built-in tools. Experimenting with different schedules can lead to faster convergence and better performance.</p><pre>from tensorflow.keras import callbacks<br>def lr_schedule(epoch):<br>    return 0.001 if epoch &lt;= 40 else 0.0001 #you can change if and else values as per your need.<br><br>learning_rate_scheduler = callbacks.LearningRateScheduler(lr_schedule, verbose=0)<br><br>model.fit(<br>...<br>...<br>...<br>callbacks = [learning_rate_scheduler])</pre><p><strong>Why Use a Learning Rate Scheduler?</strong></p><p><strong>Faster Convergence</strong>: High initial learning rates accelerate training.</p><p><strong>Better Accuracy</strong>: Gradual reduction helps models settle into a better optimum.</p><p><strong>Avoid Overshooting</strong>: Adjustments prevent the model from skipping optimal solutions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e14e957f218f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Saving Model training in “.csv file”]]></title>
            <link>https://medium.com/@Vishal_v_cool/saving-model-training-in-csv-file-55c613848564?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/55c613848564</guid>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Tue, 03 Sep 2024 11:42:04 GMT</pubDate>
            <atom:updated>2024-09-03T11:42:04.104Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi there Vishal this side, I hope you’re consuming enough water daily.</p><p>Today’s article is about how you can save your model’s training history in a .csv file for future use.</p><pre>from tensorflow.keras import callbacks<br>csv_logger = callbacks.CSVLogger(os.path.join(OUTPUT_DIR, &#39;training_log.csv&#39;), append=True, separator=&#39;;&#39;)</pre><blockquote>In our case OUTPUT_DIR is “/kaggle/working/”, cases may vary.</blockquote><p><strong>Model training part:</strong></p><pre>with strategy.scope():<br>    trainHistory = model.fit(<br>        &quot;Your code for training&quot;<br>        callbacks=[csv_logger..]<br>    )<br><br>    </pre><p>Hope this code helps you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55c613848564" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10-DAY GUIDE TO SUBMISSION]]></title>
            <link>https://medium.com/@Vishal_v_cool/10-day-guide-to-submission-70fa5c1772ec?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/70fa5c1772ec</guid>
            <category><![CDATA[projects]]></category>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Tue, 06 Aug 2024 09:57:48 GMT</pubDate>
            <atom:updated>2024-08-06T09:57:48.675Z</atom:updated>
            <content:encoded><![CDATA[<p>Greetings of the day everyone, I Hope you guys are going for evening walks and drinking enough water daily.</p><p>This article I am posting this for people who are into ML and AI Projects (Student Version) see, I’m not going to lie, we all know how we start our projects and how we submit them and it’s also known to our teachers as well.</p><p>This is a 10-day guide for understanding and submitting projects</p><p><strong>Day 1: </strong>Gather everything you need for your project, especially the code.</p><p><strong>Day 2–3: </strong>Read all the literature your caliber allows you.</p><p><strong>Day 4–6:</strong> Make the code work on your system here is a quick look at how you can achieve it:</p><p><a href="https://medium.com/@Vishal_v_cool/project-environment-for-data-science-and-artificial-intelligence-students-hpu-97f34dbf89ed">Project Environment for Data Science and Artificial Intelligence Students HPU</a></p><p><strong>Day 7–8:</strong> Make necessary modifications and eye-catching efforts. Example:</p><p><a href="https://medium.com/@Vishal_v_cool/visualizing-model-during-training-1c54fd21f348">VISUALIZING MODEL DURING TRAINING</a></p><p><strong>Day 9:</strong> Prepare the ppt. Since you’re a university-level student one day is enough for a small project according to your experience.</p><p><strong>Day 10: </strong>Revise and Submit your efforts.</p><p>Thank you for your valuable time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70fa5c1772ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project Environment for Data Science and Artificial Intelligence Students HPU]]></title>
            <link>https://medium.com/@Vishal_v_cool/project-environment-for-data-science-and-artificial-intelligence-students-hpu-97f34dbf89ed?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/97f34dbf89ed</guid>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Sun, 30 Jun 2024 07:34:00 GMT</pubDate>
            <atom:updated>2024-06-30T07:34:00.440Z</atom:updated>
            <content:encoded><![CDATA[<p>Greetings of the day to the readers, I am writing this article for the students in their final year Project for data science and AI. You will need a platform for your project when you are in your final year. Here I am with some suggestions:</p><p>Go for Kaggle, Yes go for Kaggle Where you’ll find some very interesting and helpful environments like GPU P100, GPU T4*2, and much more important TPU V3–8 with 20 hrs of hourly usage.</p><p>To set up Kaggle TPU follow:</p><p><a href="https://medium.com/@Vishal_v_cool/setting-up-kaggle-notebook-for-tpu-95d0dd7ebaf4">SETTING UP KAGGLE NOTEBOOK FOR TPU</a></p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97f34dbf89ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[VISUALIZING MODEL DURING TRAINING]]></title>
            <link>https://medium.com/@Vishal_v_cool/visualizing-model-during-training-1c54fd21f348?source=rss-701540829f79------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c54fd21f348</guid>
            <dc:creator><![CDATA[VISHAL V COOL]]></dc:creator>
            <pubDate>Sat, 25 May 2024 17:12:01 GMT</pubDate>
            <atom:updated>2024-05-25T17:12:01.715Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever thought of visualizing your results during the training of your model? well here is the solution I’m providing a function which will help you to the desired need.</p><pre>class PlotLearning(keras.callbacks.Callback):<br>    &quot;&quot;&quot;<br>    Callback to plot the learning curves of the model during training.<br>    &quot;&quot;&quot;<br>    def on_train_begin(self, logs={}):<br>        try:<br>            del logs[&quot;lr&quot;]<br>        except:<br>            pass <br>        self.metrics = {}<br>        for metric in logs:<br>            self.metrics[metric] = []<br><br>    def on_epoch_end(self, epoch, logs={}):<br>        try:<br>            del logs[&quot;lr&quot;]<br>        except:<br>            pass<br>          <br>        # Storing metrics<br>        for metric in logs:<br>            if metric in self.metrics:<br>                self.metrics[metric].append(logs.get(metric))<br>            else:<br>                self.metrics[metric] = [logs.get(metric)]<br>        <br>        # Plotting<br>        metrics = [x for x in logs if &#39;val&#39; not in x and x != &#39;val_learning_rate&#39;]  # Exclude &#39;val_learning_rate&#39;<br>        <br>        f, axs = plt.subplots(1, len(metrics), figsize=(15,5))<br>        clear_output(wait=True)<br><br>        for i, metric in enumerate(metrics):<br>            axs[i].plot(range(1, epoch + 2), <br>                        self.metrics[metric], <br>                        label=metric)<br>            if logs.get(&#39;val_&#39; + metric):  # Check if &#39;val_&#39; + metric exists<br>                axs[i].plot(range(1, epoch + 2), <br>                            self.metrics[&#39;val_&#39; + metric], <br>                            label=&#39;val_&#39; + metric)<br>                <br>            axs[i].legend()<br>            axs[i].grid()<br><br>        plt.tight_layout()<br>        plt.show()</pre><p>keep in mind to use this function in your callbacks, for example:</p><pre>model.fit(...<br>          ...<br>           callbacks=[csv_logger, lr_scheduler_callback,model_checkpoint_callback,PlotLearning()],)</pre><p>the code will result like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DWjyfaZuqjh9gn7PKrEqbA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c54fd21f348" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>