I am trying to create a simple neural network structure and have the following:
\def\layersep{2.5cm}
\begin{tikzpicture}[shorten >=1pt,->,draw=black!50, node distance=\layersep]
\tikzstyle{every pin edge}=[<-,shorten <=1pt]
\tikzstyle{neuron}=[circle,draw=black!80,thick,minimum size=17pt,inner
sep=0pt]
\tikzstyle{annot} = [text width=4em, text centered]
\foreach \name / \y in {1,...,3}
\path[yshift=0.5cm]
node[neuron] (H-\name) at (\layersep,-\y cm) {$x_\y$};
\node[neuron,pin={[pin edge={->}]right:$h_\theta(x)$}, right of=H-2] (O) {};
\foreach \source in {1,...,3}
\path (H-\source) edge (O);
\end{tikzpicture}
Which, when rendered, produces the following:

I want to be able to label the \path, but everywhere I've looked talks only about labeling a \draw or \node. I thought I should be able to add:
\path (H-\source) edge (O) {Label Text};
Or set the label attribute in the edge:
\path (H-\source) edge[label=Label Text] (O);
But it doesn't seem to work.
I realize the this segment:
\foreach \source in {1,...,3}
\path (H-\source) edge (O);
sets the edges. I've also tried creating a new node inside the loop, but wasn't sure what how to position it relative to the edge, because the edge does not have an identifier.
Thanks so much for your help!


\path (H-\source) edge ["Label Text"] (O);(neededquoteslibrary) or\path (H-\source) edge node[above] {Label Text} (O);... is this what you looking for? – Zarko Apr 16 '17 at 21:17