Skip to content

Commit

Permalink
First commmit
Browse files Browse the repository at this point in the history
  • Loading branch information
aochoae committed Feb 14, 2019
0 parents commit 695c07a
Show file tree
Hide file tree
Showing 27 changed files with 1,679 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
images/
396 changes: 396 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This is LuaTeX, Version 0.95.0 (TeX Live 2016/Debian)
#
# Luis A. Ochoa

TEX = lualatex
TEXFLAGS = --shell-escape --output-directory=images

IMAGES_TEX = $(wildcard *.tex)
IMAGES_PDF = $(subst tex,pdf,$(IMAGES_TEX))

build: $(IMAGES_PDF)

%.pdf: %.tex
$(TEX) $(TEXFLAGS) $<

clean:
$(RM) images/*.aux images/*.log images/*.pdf

$(shell mkdir -p images)
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Support-Vector Machine with TikZ

## Requirements

* LuaTeX, Version 0.95.0
* Pack­age fontspec
* Pack­age unicode-math
* Pack­age tikz
* Pack­age pgfplots
* Font TeX Gyre Heros
* Font TeX Gyre Termes Math

## Build

make build

## License

Copyright 2019 Luis A. Ochoa

Support-Vector Machine with TikZ is licensed under a
Creative Commons Attribution 4.0 International License.
See [LICENSE](LICENSE) for the full lecense text.
21 changes: 21 additions & 0 deletions SVM-C.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
x y label
1 1 a
1 5 a
1.5 9 a
2 7.5 a
2.5 3 a
3 6 a
3.5 4 a
3.5 8 a
4.5 2 a
4.5 7 a
5.5 3 b
5.5 9 b
6.5 1 b
6.5 5 b
6.5 8 b
7.5 6 b
8 9.5 b
8.5 3.5 b
9 1.5 b
9 8.5 b
58 changes: 58 additions & 0 deletions SVM-R2.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
\RequirePackage{luatex85}
\documentclass{standalone}

\usepackage{amsmath}

\usepackage{fontspec, unicode-math}
\setsansfont[Scale=MatchLowercase]{TeX Gyre Heros}
\setmathfont{TeX Gyre Termes Math}

% https://material.io/design/color/the-color-system.html
\usepackage[svgnames, table]{xcolor}
\definecolor{Black}{HTML}{000000}% D'oh!
\definecolor{White}{HTML}{FFFFFF}% D'oh!
\definecolor{Red}{HTML}{F44336}
\definecolor{Pink}{HTML}{E91E63}
\definecolor{Purple}{HTML}{9C27B0}
\definecolor{DeepPurple}{HTML}{673AB7}
\definecolor{Indigo}{HTML}{3F51B5}
\definecolor{Blue}{HTML}{2196F3}
\definecolor{LightBlue}{HTML}{03A9F4}
\definecolor{Cyan}{HTML}{00BCD4}
\definecolor{Teal}{HTML}{009688}
\definecolor{Green}{HTML}{4CAF50}
\definecolor{LightGreen}{HTML}{8BC34A}
\definecolor{Lime}{HTML}{CDDC39}
\definecolor{Yellow}{HTML}{FFEB3B}
\definecolor{Amber}{HTML}{FFC107}
\definecolor{Orange}{HTML}{FF9800}
\definecolor{DeepOrange}{HTML}{FF5722}
\definecolor{Brown}{HTML}{795548}
\definecolor{Gray}{HTML}{9E9E9E}
\definecolor{BlueGray}{HTML}{607D8B}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\tikzset{
every picture/.style={font={\sffamily\normalsize}, >=stealth},
every pin edge/.style={black}}

\begin{document}

\begin{tikzpicture}
\begin{axis}[ticks=none,
scatter/classes={
a={mark=triangle*, Blue, fill=Blue, fill opacity=0.6},
b={mark=*, Red, fill=Red, fill opacity=0.6},
ao={mark=triangle*, Blue, fill=Blue, fill opacity=0.6},
bo={mark=*, Red, fill=Red, fill opacity=0.6}
}]

\addplot[scatter, only marks, point meta=explicit symbolic]
table[meta=label] {kernel.dat};
\end{axis}
\end{tikzpicture}

\end{document}
60 changes: 60 additions & 0 deletions SVM-R3.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
\RequirePackage{luatex85}
\documentclass{standalone}

\usepackage{amsmath}

\usepackage{fontspec, unicode-math}
\setsansfont[Scale=MatchLowercase]{TeX Gyre Heros}
\setmathfont{TeX Gyre Termes Math}

% https://material.io/design/color/the-color-system.html
\usepackage[svgnames, table]{xcolor}
\definecolor{Black}{HTML}{000000}% D'oh!
\definecolor{White}{HTML}{FFFFFF}% D'oh!
\definecolor{Red}{HTML}{F44336}
\definecolor{Pink}{HTML}{E91E63}
\definecolor{Purple}{HTML}{9C27B0}
\definecolor{DeepPurple}{HTML}{673AB7}
\definecolor{Indigo}{HTML}{3F51B5}
\definecolor{Blue}{HTML}{2196F3}
\definecolor{LightBlue}{HTML}{03A9F4}
\definecolor{Cyan}{HTML}{00BCD4}
\definecolor{Teal}{HTML}{009688}
\definecolor{Green}{HTML}{4CAF50}
\definecolor{LightGreen}{HTML}{8BC34A}
\definecolor{Lime}{HTML}{CDDC39}
\definecolor{Yellow}{HTML}{FFEB3B}
\definecolor{Amber}{HTML}{FFC107}
\definecolor{Orange}{HTML}{FF9800}
\definecolor{DeepOrange}{HTML}{FF5722}
\definecolor{Brown}{HTML}{795548}
\definecolor{Gray}{HTML}{9E9E9E}
\definecolor{BlueGray}{HTML}{607D8B}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\tikzset{
every picture/.style={font={\sffamily\normalsize}, >=stealth},
every pin edge/.style={black}}

\begin{document}

\begin{tikzpicture}
\begin{axis}[ticks=none, view = {15}{6},
scatter/classes={
a={mark=triangle*, Blue, fill=Blue, fill opacity=0.6},
b={mark=*, Red, fill=Red, fill opacity=0.6},
ao={mark=triangle*, Blue, opacity=0.5, fill=Blue, fill opacity=0.25},
bo={mark=*, Red, opacity=0.5, fill=Red, fill opacity=0.25}
}]

\addplot3[scatter, only marks, point meta=explicit symbolic]
table[meta=label, z expr=1 + (x^2)+(y^2)] {kernel.dat};

\addplot3[opacity=0.25, surf, color=BlueGray, domain=-1:1, samples=2]{1.5};
\end{axis}
\end{tikzpicture}

\end{document}
40 changes: 40 additions & 0 deletions binarization-allone.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
\RequirePackage{luatex85}
\documentclass{standalone}

\usepackage{amsmath}

\usepackage{fontspec, unicode-math}
\setsansfont[Scale=MatchLowercase]{TeX Gyre Heros}
\setmathfont{TeX Gyre Termes Math}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\tikzset{
every picture/.style={font={\sffamily\normalsize}, >=stealth},
every pin edge/.style={black}}

\begin{document}

\begin{tikzpicture}
\begin{axis}[class/.style={color=black, dashed}]

\addplot[class] coordinates {(1, 8.5) (3, 6.5) (7, 7) (8.5, 8.5)};

\addplot[
scatter,
only marks,
point meta=explicit symbolic,
scatter/classes={
a={mark=square*, draw=white, fill=black},
b={mark=o, black},
c={mark=triangle*, black},
d={mark=*, black},
e={mark=diamond*, black}
}] table[meta=label] {binarization.dat};

\end{axis}
\end{tikzpicture}

\end{document}
44 changes: 44 additions & 0 deletions binarization-multiclass.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
\RequirePackage{luatex85}
\documentclass{standalone}

\usepackage{amsmath}

\usepackage{fontspec, unicode-math}
\setsansfont[Scale=MatchLowercase]{TeX Gyre Heros}
\setmathfont{TeX Gyre Termes Math}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\tikzset{
every picture/.style={font={\sffamily\normalsize}, >=stealth},
every pin edge/.style={black}}

\begin{document}

\begin{tikzpicture}
\begin{axis}[class/.style={color=black, dashed}]

\addplot[class] coordinates {(3, 6.5) (4, 3.5) (6.5, 3.5) (7, 7) (3, 6.5)};
\addplot[class] coordinates {(3, 6.5) (1, 8.5)};
\addplot[class] coordinates {(4, 3.5) (3, 1)};
\addplot[class] coordinates {(6.5, 3.5) (9, 2.5)};
\addplot[class] coordinates {(7, 7) (8.5, 8.5)};

\addplot[
scatter,
only marks,
point meta=explicit symbolic,
scatter/classes={
a={mark=square*, draw=white, fill=black},
b={mark=o, black},
c={mark=triangle*, black},
d={mark=*, black},
e={mark=diamond*, black}
}] table[meta=label] {binarization.dat};

\end{axis}
\end{tikzpicture}

\end{document}
40 changes: 40 additions & 0 deletions binarization-oneone.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
\RequirePackage{luatex85}
\documentclass{standalone}

\usepackage{amsmath}

\usepackage{fontspec, unicode-math}
\setsansfont[Scale=MatchLowercase]{TeX Gyre Heros}
\setmathfont{TeX Gyre Termes Math}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\tikzset{
every picture/.style={font={\sffamily\normalsize}, >=stealth},
every pin edge/.style={black}}

\begin{document}

\begin{tikzpicture}
\begin{axis}[class/.style={color=black, dashed}]

\addplot[class] coordinates {(0.5, 4) (9.5, 6)};

\addplot[
scatter,
only marks,
point meta=explicit symbolic,
scatter/classes={
a={mark=square*, white, opacity=0},
b={mark=o, black},
c={mark=triangle*, white, opacity=0},
d={mark=*, black},
e={mark=diamond*, white, opacity=0}
}] table[meta=label] {binarization.dat};

\end{axis}
\end{tikzpicture}

\end{document}
51 changes: 51 additions & 0 deletions binarization.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
x y label
4 6 a
4.5 4 a
4.5 5 a
5 6.25 a
5 5.5 a
5 4.5 a
5.5 5.5 a
6 6 a
6 5 a
6 4 a
2.5 8 b
3 9 b
3.5 8.5 b
3.5 7.5 b
4.5 9 b
4.5 8.25 b
5 8 b
5.25 7.5 b
6 8 b
6.5 9 b
0.5 5 c
1 6.5 c
1.5 4.5 c
1.5 5.5 c
2 3 c
2 6 c
2.5 2.5 c
2.5 4 c
2.5 5 c
3 3.5 c
4 1.5 d
4.5 2 d
4.5 3 d
5 2.5 d
5.5 1.5 d
5.75 1 d
6 2.5 d
6.5 1.75 d
6.75 2.5 d
8 2 d
7.5 4 e
7.5 6 e
8 5 e
8 6.5 e
8.5 3.5 e
8.5 4 e
8.5 5 e
8.5 7 e
9 6 e
9.5 4.5 e
Loading

0 comments on commit 695c07a

Please sign in to comment.