Module Expr Str Assign NameStore Str ImportFrom alias alias ImportFrom alias FunctionDef arguments args NameParam defaults Num body Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call NameLoad Num BinOpAdd Str Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore Call NameLoad BinOpSub BinOpFloorDiv Call NameLoad NameLoad Num Num body Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad NameLoad Index BinOpMult NameLoad Num SubscriptLoad NameLoad Index BinOpAdd BinOpMult NameLoad Num Num Return NameLoad decorator_list If CompareEq NameLoad Str body Expr Call NameLoad Call NameLoad Str
N/A N/A 

Determine if the modules in a Network are always sorted in the same way, even if the connections
don't constrain a particular order.

Build a number of modules and connections, to be used for all constructions

    >>> from pybrain.structure.networks.network import Network
    >>> mods = buildSomeModules(10)
    >>> conns = buildSomeConnections(mods)

Construct a network, normally, and sort it
    >>> n = Network()
    >>> for m in mods:
    ...    n.addModule(m)
    ...
    >>> for c in conns:
    ...    n.addConnection(c)
    ...
    >>> n.sortModules()
    >>> ord = str(n.modulesSorted)

Is the order the same, if we sort it again?

    >>> n.sortModules()
    >>> ord2 = str(n.modulesSorted)
    >>> ord == ord2
    True

What if we construct it in a different order?

    >>> n = Network()
    >>> for m in reversed(mods):
    ...    n.addModule(m)
    ...
    >>> for c in reversed(conns):
    ...    n.addConnection(c)
    ...
    >>> n.sortModules()
    >>> ord3 = str(n.modulesSorted)
    >>> ord == ord3
    True

Is it the same ordering than our reference?
    >>> print(ord3)
    [<LinearLayer 'l0'>, <LinearLayer 'l2'>, <LinearLayer 'l3'>, <LinearLayer 'l5'>, <LinearLayer 'l6'>, <LinearLayer 'l7'>, <LinearLayer 'l8'>, <LinearLayer 'l9'>, <LinearLayer 'l1'>, <LinearLayer 'l4'>]

 N/A __author__ Tom Schaul, tom@idsia.ch pybrain LinearLayer FullConnection pybrain.tests runModuleTestSuite buildSomeModules N/A N/A number N/A 4 N/A N/A res N/A N/A i N/A range number N/A N/A N/A N/A res append N/A LinearLayer 1 N/A l N/A str i N/A res N/A buildSomeConnections N/A N/A modules N/A N/A N/A  add a connection from every second to every third module  N/A res N/A N/A i N/A range N/A N/A N/A len modules 3 1 N/A N/A N/A N/A res append N/A FullConnection N/A modules N/A N/A i 2 N/A modules N/A N/A N/A i 3 1 N/A res N/A N/A N/A __name__ __main__ N/A N/A N/A runModuleTestSuite N/A __import__ __main__