.. index:: Input Node

.. _Input_Node:

Input Node
==========

In order for an instance, I, of a network, C,  to be applied in another network, N, (via an :ref:`instance node<instance_node>` in N representing I), a mechanism is required for connecting I (or rather nodes of I) to other nodes of N.  As we wish to enforce modularity and information hiding, we cannot allow nodes of I to have parents outside I, as that would violate the modularity constraint (the domain of a CPT could then contain nodes from several networks).  Therefore, we need the concept of *input nodes*.  An input node of I (declared as such in the network class C) is to be considered a placeholder node for a node in N to be bound to that input node.

The network in Figure 1 contains an instance of a network class, Person, describing the relationships between some indicator parameters (say income, education, etc.) and how these affect the probability distribution over political sympathy, say Republican or Democrat, for a person.  The indicator variable Income, for example, might be a labelled discrete chance variable with three states, "High", "Medium", and "Low", and have associated with it the probability distribution P(Income) = (0.1, 0.7, 0.2), reflecting the population average. Now, for an instance of this network to be applied in our network, we need to be able to bind the indicator variable Income to a variable representing a different probability distribution, P(Income 1) = (0.3, 0.65, 0.05), which matches our specific sub-population of interest.  Therefore, the indicator variables of the Person network are declared as input variables, which should be bound to the actual variables of the networks in which instances of Person appears. Thus, we have created a :ref:`binding link<binding_link>` from the node labeled "Income 1" to the input variable "Income" of the instance node.  Similarly, the node "Edu. 1" is bound to the input node "Education".

.. figure:: images/inputnode.png

	Figure 1: The variables "Income 1" and "Edu. 1" are bound to input variables Income and Education of the instance node Person_1.

Input nodes shouldn't be confused with real nodes.  A real node, which is type consistent with an input node, can be bound to that input node.  That is, an input node becomes identical with the node that is bound to it.  However, if an input node hasn't got a binding associated with it, the network containing the input node can still be used (i.e., compiled in to a junction tree and used for inference).  In that case the input node is treated as a real node.  That is, each input node has a CPT associated with it just as any ordinary node, but this CPT is used only if no nodes have been bound to the input node in a network containing an instance of the network in which the input node is defined.

In the tutorial on :ref:`object-oriented networks<How_To_Build_An_Object_Oriented_Bayesian_Network>`, an example shows how to use input nodes.

See also the description of :ref:`output nodes<output_node>`.  Input nodes and output nodes are collectively referred to as interface nodes.