使用latex绘制多层神经网络结构图
1,使用Tikz包;
2,参考官方例程单层神经网络结构,绘制了一个含有3隐藏层的BP神经网络节点图
代码如下:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}
\def\layersep{2.5cm}
\begin{tikzpicture}[shorten >=1pt,->,draw=black!50, node distance=\layersep]
\tikzstyle{every pin edge}=[<-,shorten <=1pt]
\tikzstyle{neuron}=[circle,fill=black!25,minimum size=17pt,inner sep=0pt]
\tikzstyle{input neuron}=[neuron, fill=green!50];
\tikzstyle{output neuron}=[neuron, fill=red!50];
\tikzstyle{hidden neuron1}=[neuron, fill=blue!50];
\tikzstyle{hidden neuron2}=[neuron, fill=blue!50];
\tikzstyle{hidden neuron3}=[neuron, fill=blue!50];
\tikzstyle{annot} = [text width=4em, text centered]
% Draw the input layer nodes
\foreach \name / \y in {1,...,4}
% This is the same as writing \foreach \name / \y in {1/1,2/2,3/3,4/4}
\node[input neuron, pin=left:Input \#\y] (I-\name) at (0,-\y) {};
% Draw the hidden layer1 nodes
\foreach \name / \y in {1,...,5}
\path[yshift=0.5cm]
node[hidden neuron1] (H1-\name) at (\layersep,-\y cm) {};
%Draw the hidden layer2 nodes
\foreach \name / \y in {1,...,5}
\path[yshift=0.5cm]
node[hidden neuron2,right of=H1] (H2-\name) at (\layersep,-\y cm){};
%Draw the hidden layer3 nodes
\foreach \name / \y in {1,...,5}
\path[yshift=0.5cm]
node[hidden neuron3,right of=H2] (H3-\name) at (2*\layersep,-\y cm){};
% Draw the output layer node
\node[output neuron,pin={[pin edge={->}]right:Output}, right of=H3-3] (O) {};
% Connect every node in the input layer with every node in the
% hidden layer.
\foreach \source in {1,...,4}
\foreach \dest in {1,...,5}
\path (I-\source) edge (H1-\dest);
%
\foreach \source in {1,...,5}
\foreach \dest in {1,...,5}
\path (H1-\source) edge (H2-\dest);
%
\foreach \source in {1,...,5}
\foreach \dest in {1,...,5}
\path (H2-\source) edge (H3-\dest);
% Connect every node in the hidden layer with the output layer
\foreach \source in {1,...,5}
\path (H3-\source) edge (O);
% Annotate the layers
\node[annot,above of=H1-1, node distance=1cm] (hl) {Hidden layer1};
\node[annot,left of=hl] {Input layer};
\node[annot,right of=hl] (h2){Hidden layer2};
\node[annot,right of=h2] (h3){Hidden layer3};
\node[annot,right of=h3] {Output layer};
\end{tikzpicture}
% End of code
\end{document}
效果如图:

使用latex绘制多层神经网络结构图的更多相关文章
- 使用NetworkX模块绘制深度神经网络(DNN)结构图
本文将展示如何利用Python中的NetworkX模块来绘制深度神经网络(DNN)结构图. 在文章Keras入门(一)搭建深度神经网络(DNN)解决多分类问题中,我们创建的DNN结构图如下: ...
- 用Tensorflow实现多层神经网络
用Tensorflow实现多层神经网络 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 Tensorflow机器学习实战指南 源代码请点击下方链接欢迎加星 ReLU激活函数/L1范数 ...
- 多层神经网络BP算法 原理及推导
首先什么是人工神经网络?简单来说就是将单个感知器作为一个神经网络节点,然后用此类节点组成一个层次网络结构,我们称此网络即为人工神经网络(本人自己的理解).当网络的层次大于等于3层(输入层+隐藏层(大于 ...
- TensorFlow 训练MNIST数据集(2)—— 多层神经网络
在我的上一篇随笔中,采用了单层神经网络来对MNIST进行训练,在测试集中只有约90%的正确率.这次换一种神经网络(多层神经网络)来进行训练和测试. 1.获取MNIST数据 MNIST数据集只要一行代码 ...
- Spark2.0机器学习系列之7: MLPC(多层神经网络)
Spark2.0 MLPC(多层神经网络分类器)算法概述 MultilayerPerceptronClassifier(MLPC)这是一个基于前馈神经网络的分类器,它是一种在输入层与输出层之间含有一层 ...
- ufldl学习笔记与编程作业:Multi-Layer Neural Network(多层神经网络+识别手写体编程)
ufldl学习笔记与编程作业:Multi-Layer Neural Network(多层神经网络+识别手写体编程) ufldl出了新教程,感觉比之前的好,从基础讲起,系统清晰,又有编程实践. 在dee ...
- ubuntu 绘制lenet网络结构图遇到的问题汇总
Couldn't import dot_parser, loading of dot files will not be possible的问题 1 .sudo pip uninstall pypar ...
- 使用Graphviz和Pyreverse绘制Python项目结构图
使用Graphviz和Pyreverse绘制Python项目结构图 简介 Graphviz开源的图形绘制工具包 Pyreverse分析Python代码和类关系的工具 安装 安装Graphviz 官网下 ...
- 学习笔记TF011:多层神经网络
线性回归.对数几率回归模型,本质上是单个神经元.计算输入特征加权和.偏置视为每个样本输入特征为1权重,计算特征线性组合.激活(传递)函数 计算输出.线性回归,恒等式(值不变).对数几率回归,sigmo ...
随机推荐
- 建议66,67 注意Arrays.asList()的使用
代码 public static void main(String[] args) { int[]data = {1,2,3,4,5}; List list = Arrays.asList(data) ...
- SetWindowsHookEx 其他进程的 记录
SetWindowsHookEx( WH_GETMESSAGE,CallWndProc, HInstance, h2); WH_GETMESSAGE 这个类型 hook 其他窗体的 线程是正常的 ...
- DLNA和UPNP
继之前一个人研究ONVIF协议,SSDP协议,现在又要跳DLNA的坑,说到DLNA,必须离不开UPNP,这俩关系特好 DLNA官网:http://www.dlna.org/ UPNP官网:http:/ ...
- 学习contiki需要知道的一些概念和注意事项
概念: 1.宏:所谓宏,就是一些命令组织在一起,作为一个单独命令完成一个特定任务.Microsoft Word中对宏定义为:“宏就是能组织到一起作为一独立的命令使用的一系列word命令,它能使日常工作 ...
- ubuntu 配置php环境
第一步:先更新 sudo apt-get update 第二步:安装 安装 Apache2: sudo apt-get install apache2 安装PHP模块: sudo apt-get in ...
- [心得]Ubuntu無法ssh登入
裝好ssh後,發覺無法用root登入,可是sshd_config接正確. 後來發現原因在於,Ubuntu沒有root帳號,但是可以透過sudo -s拿到root權限. su root 密碼怎樣打也行不 ...
- Compile Linux Kernel on Ubuntu 12.04 LTS (Detailed)
This tutorial will outline the process to compile your own kernel for Ubuntu. It will demonstrate bo ...
- 页面跳转到Area区域连接
@Html.ActionLink("主页", "Index", new { controller = "Test", Action = &q ...
- css识别空格回车符
新闻发布系统文字需要换行,后台返回数据包含空格.回车符号需要默认显示出来.在父元素加上css样式 :white-space:pre:即可. 例:<div class="white-sp ...
- mysql的几种锁
由于对于mysql的锁机制了解的并不深入,所以翻阅了资料,整理一下自己所理解的锁.以mysql数据库的InnoDB引擎为例,因为InnoDB支持事务.行锁.表锁:且现在大部分公司使用的都是InnoDB ...