-
Notifications
You must be signed in to change notification settings - Fork 3
/
nn-SVM_manual+neuralnet.tex
54 lines (48 loc) · 1.77 KB
/
nn-SVM_manual+neuralnet.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
\documentclass{article}
\usepackage[paperwidth=4in,paperheight=4in]{geometry}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{arrows}
\begin{tikzpicture}
% Draw axes
\draw [thick] (0,5) node (yaxis) [above] {$y$}
|- (5,0) node (xaxis) [right] {$x$};
% draw line
\draw (0,-1) -- (5,4); % y=x-1
\draw[dashed] (-1,0) -- (4,5); % y=x+1
\draw[dashed] (2,-1) -- (6,3); % y=x-3
% \draw labels
\draw (3.5,3) node[rotate=45,font=\small]
{$\mathbf{w}\cdot \mathbf{x} + b = 0$};
\draw (2.5,4) node[rotate=45,font=\small]
{$\mathbf{w}\cdot \mathbf{x} + b = 1$};
\draw (4.5,2) node[rotate=45,font=\small]
{$\mathbf{w}\cdot \mathbf{x} + b = -1$};
% draw distance
\draw[dotted] (4,5) -- (6,3);
\draw (5.25,4.25) node[rotate=-45] {$\frac{2}{\Vert \mathbf{w} \Vert}$};
\draw[dotted] (0,0) -- (0.5,-0.5);
\draw (0,-0.5) node[rotate=-45] {$\frac{b}{\Vert \mathbf{w} \Vert}$};
\draw (2,1) -- (1.5,1.5);
\draw (1.85,1.35) node[rotate=-45] {$\mathbf{w}$};
% draw negative dots
\fill[red] (0.5,1.5) circle (3pt);
\fill[red] (1.5,2.5) circle (3pt);
\fill[black] (1,2.5) circle (3pt);
\fill[black] (0.75,2) circle (3pt);
\fill[black] (0.6,1.9) circle (3pt);
\fill[black] (0.77, 2.5) circle (3pt);
\fill[black] (1.5,3) circle (3pt);
\fill[black] (1.3,3.3) circle (3pt);
\fill[black] (0.6,3.2) circle (3pt);
% draw positive dots
\draw[red,thick] (4,1) circle (3pt);
\draw[red,thick] (3.3,.3) circle (3pt);
\draw[black] (4.5,1.2) circle (3pt);
\draw[black] (4.5,.5) circle (3pt);
\draw[black] (3.9,.7) circle (3pt);
\draw[black] (5,1) circle (3pt);
\draw[black] (3.5,.2) circle (3pt);
\draw[black] (4,.3) circle (3pt);
\end{tikzpicture}
\end{document}