VOOZH about

URL: https://www.analyticsvidhya.com/blog/2018/04/python-library-visualizes-artificial-neural-networks/

⇱ This Python Library Visualizes Artificial Neural Networks (ANNs) with just One Line of Code


India's Most Futuristic AI Conference Is Back – Bigger, Sharper, Bolder

  • d
  • :
  • h
  • :
  • m
  • :
  • s

This Python Library Visualizes Artificial Neural Networks (ANNs) with just One Line of Code

Pranav Dar Last Updated : 03 Apr, 2018
2 min read

Overview

  • Visualize your ANN with just a line of code, using the ‘ANN Visualizer’ python library
  • It works with Keras and makes use of the ‘graphviz’ library
  • Check out the installation instructions and a sneak peak of how the visualization looks like below

Introduction

Vizualizing data lies at the core of any good data scientist’s skillset. It gives a holistic view of what could be hidden in the data. But with advanced in deep learning, you can visualise the entire deep learning process or just the Convolutional Neural Network you’ve built.

Now, you can even visualize an Artificial Neural Network using just a line of code. ANN Visualizer is a visualization library used to work with Keras. It makes use of python’s ‘graphviz’ library to create a neat and presentable graph of the neural network you’re building.

👁 Image

You can install the library using the below command:

pip install ann_visualizer

To generate the visualization, you need to follow the below command structure:

ann_viz(model, view=True, filename=”network.gv”, title=”MyNeural Network”)

  • model – Your Keras sequential model
  • view – If set to true, it opens the graph preview after the command has been executed
  • filename – Where to save the graph. (it’s saved in a ‘.gv’ file format)
  • title – The title for the visualized ANN

Below is an example of what the final visualization looks like:

👁 Image

Beautifully done, isn’t it? You can go through this GitHub repository here to look at a demo of how a model is created and visualized.

Our take on this

This is useful in a lot of ways. It can be used for teaching purposes when you want to explain how your NN looks like without having to run a lot of code. There have been previous efforts in this area but with the ease of effort and the beautifully optimised output, this is a library worth checking out.

It currently only visualizes dense layers but the developers has indicated that convolution and LSTM layers might be added soon. Keep in mind that this is still an unstable release so you might encounter a bug here and there but don’t let that put you off from trying it out!

Subscribe to AVBytes here to get regular data science, machine learning and AI updates in your inbox!

Senior Editor at Analytics Vidhya.Data visualization practitioner who loves reading and delving deeper into the data science and machine learning arts. Always looking for new ways to improve processes using ML and AI.

Login to continue reading and enjoy expert-curated content.

Free Courses

Generative AI - A Way of Life

Explore Generative AI for beginners: create text and images, use top AI tools, learn practical skills, and ethics.

Getting Started with Large Language Models

Master Large Language Models (LLMs) with this course, offering clear guidance in NLP and model training made simple.

Building LLM Applications using Prompt Engineering

This free course guides you on building LLM apps, mastering prompt engineering, and developing chatbots with enterprise data.

Improving Real World RAG Systems: Key Challenges & Practical Solutions

Explore practical solutions, advanced retrieval strategies, and agentic RAG systems to improve context, relevance, and accuracy in AI-driven applications.

Microsoft Excel: Formulas & Functions

Master MS Excel for data analysis with key formulas, functions, and LookUp tools in this comprehensive course.

Responses From Readers

Flagship Programs

GenAI Pinnacle Program| GenAI Pinnacle Plus Program| AI/ML BlackBelt Program| Agentic AI Pioneer Program

Free Courses

Generative AI| DeepSeek| OpenAI Agent SDK| LLM Applications using Prompt Engineering| DeepSeek from Scratch| Stability.AI| SSM & MAMBA| RAG Systems using LlamaIndex| Building LLMs for Code| Python| Microsoft Excel| Machine Learning| Deep Learning| Mastering Multimodal RAG| Introduction to Transformer Model| Bagging & Boosting| Loan Prediction| Time Series Forecasting| Tableau| Business Analytics| Vibe Coding in Windsurf| Model Deployment using FastAPI| Building Data Analyst AI Agent| Getting started with OpenAI o3-mini| Introduction to Transformers and Attention Mechanisms

Popular Categories

AI Agents| Generative AI| Prompt Engineering| Generative AI Application| News| Technical Guides| AI Tools| Interview Preparation| Research Papers| Success Stories| Quiz| Use Cases| Listicles

Generative AI Tools and Techniques

GANs| VAEs| Transformers| StyleGAN| Pix2Pix| Autoencoders| GPT| BERT| Word2Vec| LSTM| Attention Mechanisms| Diffusion Models| LLMs| SLMs| Encoder Decoder Models| Prompt Engineering| LangChain| LlamaIndex| RAG| Fine-tuning| LangChain AI Agent| Multimodal Models| RNNs| DCGAN| ProGAN| Text-to-Image Models| DDPM| Document Question Answering| Imagen| T5 (Text-to-Text Transfer Transformer)| Seq2seq Models| WaveNet| Attention Is All You Need (Transformer Architecture) | WindSurf| Cursor

Popular GenAI Models

Llama 4| Llama 3.1| GPT 4.5| GPT 4.1| GPT 4o| o3-mini| Sora| DeepSeek R1| DeepSeek V3| Janus Pro| Veo 2| Gemini 2.5 Pro| Gemini 2.0| Gemma 3| Claude Sonnet 3.7| Claude 3.5 Sonnet| Phi 4| Phi 3.5| Mistral Small 3.1| Mistral NeMo| Mistral-7b| Bedrock| Vertex AI| Qwen QwQ 32B| Qwen 2| Qwen 2.5 VL| Qwen Chat| Grok 3

AI Development Frameworks

n8n| LangChain| Agent SDK| A2A by Google| SmolAgents| LangGraph| CrewAI| Agno| LangFlow| AutoGen| LlamaIndex| Swarm| AutoGPT

Data Science Tools and Techniques

Python| R| SQL| Jupyter Notebooks| TensorFlow| Scikit-learn| PyTorch| Tableau| Apache Spark| Matplotlib| Seaborn| Pandas| Hadoop| Docker| Git| Keras| Apache Kafka| AWS| NLP| Random Forest| Computer Vision| Data Visualization| Data Exploration| Big Data| Common Machine Learning Algorithms| Machine Learning| Google Data Science Agent
👁 Av Logo White

Continue your learning for FREE

Forgot your password?
👁 Av Logo White

Enter OTP sent to

Edit

Wrong OTP.

Enter the OTP

Resend OTP

Resend OTP in 45s

👁 Popup Banner
👁 AI Popup Banner