Como he comentado, para dibujar los árboles y la SVM usé el paquete tikz de LaTeX, a continuación muestro el código que usé:

Dibujando un árbol de dependencias con Tikz



Ejemplo 1

El código es el siguiente:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-dependency}

\begin{document}

\begin{dependency}[edge slant=15pt,label theme = simple, edge theme = iron]
  \begin{deptext}[column sep=1em]
    This \& time \& around \& , \& they \& 're \& moving \& even \& faster \&
    . \\
  \end{deptext}
  \deproot{7}{ROOT}
  \depedge{2}{1}{DET}
  \depedge[edge height=1.9cm]{7}{2}{TMOD}
  \depedge{2}{3}{ADVMOD}
  \depedge{7}{6}{AUX}
  \depedge{7}{5}{NSUBJ}
  \depedge{7}{4}{PUNCT}
  \depedge{7}{10}{PUNCT}
  \depedge{7}{9}{ADVMOD}
  \depedge[edge start x offset=-4pt]{9}{8}{ADVMOD}
\end{dependency}

\end{document}

El resultado:

Dependenty tree in tikz

Ejemplo 2

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-qtree,tikz-qtree-compat}

\begin{document}

\tiny
\begin{tikzpicture}[every node/.style={align=center},scale=.9]
  \tikzset{
    edge from parent/.style={
      draw,edge from parent
      path={(\tikzparentnode.south)-- +(0,-8pt)-| (\tikzchildnode)}
    },
    frontier/.style={distance from root=208pt}, % Align leaf nodes
    level 1+/.style={level distance=18pt} % Distance between levels
  }

   \Tree [.S
             [.NP Rolls-Royce\\NNP Motor\\NNP Cars\\NNPS Inc\\NNP ]
             [.VP said\\VBD
                [.SBAR [.none ]
                   [.S
                      [.NP it\\PRP ]
                      [. VP expects\\VBZ
                         [.S
                            [.NP its\\PRP\$ U.S\\NNP sales\\NNS ]
                            [.VP to\\TO
                               [.VP remain\\VB
                                  [.ADJP steady\\JJ ]
                                  [.PP at\\IN
                                     [.NP
                                        [.QP about\\IN 1200\\CD ]
                                        cars\\NNS
                                     ]
                                  ]
                               ]
                            ]
                         ]
                      ]
                   ]
                ]
             ]
         ]
\end{tikzpicture}
\end{document}

Resultado:

Other Dependency Tree in tikz

Ejemplo 3

El último ejemplo de árbol:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-qtree,tikz-qtree-compat}

\begin{document}
  \begin{tikzpicture}[every node/.style={align=center},level distance=30pt]
    \tikzset{edge from parent/.append style={<-, >=latex,thick}}
   \Tree [.said\\VBD
             [.Inc.\\NNP Rolls-Royce\\NNP Motor\\NNP Cars\\NNPS ]
             [.expects\\VBZ it\\PRP
                [.remain\\VB
                   [.sales\\NNS its\\PRP\$ U.S\\NNP ]
                   to\\TO
                   steady\\JJ
                   [.at\\IN [.cars\\NNS [.about\\IN 1200\\CD ] ] ]
                ]
             ]
           ]
   \end{tikzpicture}
\end{document}
Yet another example of a Dependency tree in tikz

Dibujando una máquina de soporte vectorial (SVM) en Tikz

Para la explicación gráfica de lo que es una SVM:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-qtree,tikz-qtree-compat}
\usetikzlibrary{calc}

\begin{document}


  \tikzset{
    leftNode/.style={circle,minimum width=.5ex, fill=none,draw},
    rightNode/.style={circle,minimum width=.5ex, fill=black,thick,draw},
    rightNodeInLine/.style={solid,circle,minimum width=.7ex, fill=black,thick,draw=white},
    leftNodeInLine/.style={solid,circle,minimum width=.7ex, fill=none,thick,draw},
  }
  \begin{tikzpicture}[
        scale=2,
        important line/.style={thick}, dashed line/.style={dashed, thin},
        every node/.style={color=black},
    ]
    \draw[dashed line, yshift=.7cm]
       (.2,.2) coordinate (sls) -- (2.5,2.5) coordinate (sle)
       node[solid,circle,minimum width=2.8ex,fill=none,thick,draw] (name) at (2,2){}
       node[leftNodeInLine] (name) at (2,2){}
       node[solid,circle,minimum width=2.8ex,fill=none,thick,draw] (name) at (1.5,1.5){}
       node[leftNodeInLine] (name) at (1.5,1.5){}
       node [above right] {$w\cdot x + b > 1$};

    \draw[important line]
       (.7,.7) coordinate (lines) -- (3,3) coordinate (linee)
       node [above right] {$w\cdot x + b = 0$};

    \draw[dashed line, xshift=.7cm]
       (.2,.2) coordinate (ils) -- (2.5,2.5) coordinate (ile)
       node[solid,circle,minimum width=2.8ex,fill=none,thick,draw] (name) at (1.8,1.8){}
       node[rightNodeInLine] (name) at (1.8,1.8){}
       node [above right] {$w\cdot x + b < -1$};

    \draw[very thick,<->] ($(sls)+(.2,.2)$) -- ($(ils)+(.2,.2)$)
       node[sloped,above, near end] {Margen};

    \foreach \Point in {(.9,2.4), (1.3,2.5), (1.3,2.1), (2,3), (1,2.9)}{
      \draw \Point node[leftNode]{};
    }

    \foreach \Point in {(2.9,1.4), (2.3,.5), (3.3,.1), (2,0.9), (2.5,1)}{
      \draw \Point node[rightNode]{};
    }
  \end{tikzpicture}
\end{document}
Support Vector Machine in Latex with Tikz

Referencias

Cuando empecé a dibujar estas figuras en tikz se me presentaron algunas dudas que pregunté en tex.stackexchange.com. Estas fueron dichas preguntas:

Categorías: latex
Etiquetas: tikz latex