<?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 Armam Karimpanah on Medium]]></title>
        <description><![CDATA[Stories by Armam Karimpanah on Medium]]></description>
        <link>https://medium.com/@karimpanaharman?source=rss-707a99da2558------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*X8OeplZBKZKBan2Z</url>
            <title>Stories by Armam Karimpanah on Medium</title>
            <link>https://medium.com/@karimpanaharman?source=rss-707a99da2558------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:13:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@karimpanaharman/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[Stop Guessing, Start Seeing: A Complete 3D t-SNE Visualization Toolkit for PyTorch]]></title>
            <link>https://medium.com/@karimpanaharman/title-stop-guessing-start-seeing-a-complete-3d-t-sne-visualization-toolkit-for-pytorch-ac3056ddbf84?source=rss-707a99da2558------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac3056ddbf84</guid>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[t-sne-visualization]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[snet]]></category>
            <dc:creator><![CDATA[Armam Karimpanah]]></dc:creator>
            <pubDate>Fri, 27 Feb 2026 20:27:21 GMT</pubDate>
            <atom:updated>2026-02-27T20:33:10.574Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to look inside your Neural Network’s black box and visualize feature clusters with just 3 lines of code.</h3><h4>The “Black Box” Problem</h4><p>You’ve built a PyTorch image classifier. The validation accuracy is over 90%, and everything looks great on paper. But when you plot the standard 2D t-SNE to see how the model separates the classes, it looks like a tangled mess of overlapping dots.</p><p>Does the model <em>actually</em> understand the features, or is it just memorizing the dataset?</p><p>Standard 2D scatter plots are useful, but they often fail to capture the complex, high-dimensional manifolds our deep learning models learn. When simple plots can’t justify high accuracy, we need a better lens to look inside the black box.</p><h4>Enter jd_tsne_cl: The All-in-One Visualization Engine</h4><p>I faced this exact frustration, so I built jd_tsne_cl—a custom Python toolkit designed to automate and elevate feature visualization for PyTorch classification models.</p><p>Instead of manually ripping out layers and writing endless boilerplate Matplotlib code, this tool automatically extracts features from your DataLoader and generates a complete diagnostic suite in one go.</p><h4>What You Get (The 7-in-1 Output)</h4><p>By running this module, you instantly get:</p><ul><li><strong>Smart Feature Extraction:</strong> It automatically detects your model’s feature layers (whether it’s a ResNet, VGG, or custom CNN) and extracts the embeddings seamlessly.</li></ul><pre># 1. Initialization (Replace &#39;model&#39; with your actual model object)<br># Example: if your model is named &#39;tea_model&#39;, write model=tea_model<br>visualizer = jd_tsne_cl(model=model) <br><br># 2. Feature Extraction (Replace &#39;test_loader&#39; with your actual data loader)<br>visualizer.extract_and_compute(test_loader)<br><br># 3. Generate Generic Class Names (Class 1, Class 2, ...)<br># This automatically counts your classes and generates names<br>num_of_classes = len(np.unique(visualizer.labels)) <br>my_generic_names = [f&quot;Class {i+1}&quot; for i in range(num_of_classes)]<br><br># 4. Final Plotting<br>visualizer.plot(class_names=my_generic_names, modes=[&#39;all&#39;], exclude=[])</pre><ul><li><strong>Interactive 3D HTML (Plotly):</strong> Hover over any data point in your browser to see the filename, predicted class, and confidence score.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*PY1C-utvU2ftP0E0HUyMGw.png" /><figcaption>t-SNE_interactive plot</figcaption></figure><ul><li><strong>Misclassified Data Highlighting:</strong> Automatically isolates and marks incorrect predictions with a red ‘X’. This is an absolute game-changer for debugging and finding out <em>where</em> your model is confused.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*eaM9rKjWO__unndj6N2H7g.png" /><figcaption><strong>Misclassified Data</strong></figcaption></figure><ul><li><strong>3-View Engineering Plots:</strong> Analyzes the 3D clusters from Top, Front, and Side perspectives simultaneously with auto-generated legends.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pyjAHfcHKxJqeJ-pxnKG1Q.png" /><figcaption>3views plots</figcaption></figure><ul><li><strong>360° Rotating GIFs:</strong> Generates smooth, presentation-ready 3D animations of your clusters.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*XbxOQb2ykFKodLCUIGc7aQ.gif" /><figcaption>t-SNE_rotation</figcaption></figure><ul><li><strong>Density Heatmaps:</strong> To identify high-density regions and cluster centers.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*HUTEMQEJj7-HnPumKeRplA.png" /><figcaption>t-SNE <strong>Density Heatmaps plot</strong></figcaption></figure><ul><li><strong>Standard 2D Scatter Plots.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*X72OVgkS5z1NHSxxlBlQlg.png" /><figcaption>t-SNE <strong>Standard 2D plot</strong></figcaption></figure><h4>Talk is Cheap, Show Me the Code</h4><p>I designed this tool to be as user-friendly as possible. You don’t need to rewrite your training loop. Here is how you generate all 7 visualizations with just three steps:</p><pre>from tsne_viz import jd_tsne_cl<br><br># 1. Initialize with your trained PyTorch model<br>visualizer = jd_tsne_cl(model=my_model, device=&#39;cuda&#39;)<br><br># 2. Extract features directly from your DataLoader<br>visualizer.extract_and_compute(test_loader)<br><br># 3. Generate all plots! (You can exclude specific ones if needed)<br>my_generic_names = [&quot;Cats&quot;, &quot;Dogs&quot;, &quot;Birds&quot;] <br>visualizer.plot(class_names=my_generic_names, modes=[&#39;all&#39;])<br></pre><h4>Stop Guessing</h4><p>Deep learning doesn’t have to be a blind process. By visualizing how our models separate classes in 3D space, we can debug more efficiently, present our results more confidently to stakeholders, and build actual trust in our AI systems.</p><p>The complete source code is open-source and available on my GitHub. Feel free to use it in your next Computer Vision project.</p><p><a href="https://github.com/karimpanah/deeplearning_visualization">GitHub - karimpanah/deeplearning_visualization: &quot;A Comprehensive Deep Learning Visualization Toolkit for PyTorch. Currently featuring: Advanced 3D &amp; other t-SNE plots for Classification.</a></p><p>If this tool saves you time, I’d appreciate a ⭐ on GitHub! Let me know in the comments how you visualize your model’s features.</p><p>#pytorch #deep_learning #data_Visualization #python #t-SNE #</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac3056ddbf84" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>