rdkit.ML.Neural.Network module

Contains the class _Network_ which is used to represent neural nets

Network Architecture:

A tacit assumption in all of this stuff is that we’re dealing with feedforward networks.

The network itself is stored as a list of _NetNode_ objects. The list is ordered in the sense that nodes in earlier/later layers than a given node are guaranteed to come before/after that node in the list. This way we can easily generate the values of each node by moving sequentially through the list, we’re guaranteed that every input for a node has already been filled in.

Each node stores a list (_inputNodes_) of indices of its inputs in the main node list.

class rdkit.ML.Neural.Network.Network(nodeCounts, nodeConnections=None, actFunc=<class 'rdkit.ML.Neural.ActFuncs.Sigmoid'>, actFuncParms=(), weightBounds=1)

Bases: object

a neural network

ClassifyExample(example, appendExamples=0)

classifies a given example and returns the results of the output layer.

Arguments

  • example: the example to be classified

NOTE:

if the output layer is only one element long, a scalar (not a list) will be returned. This is why a lot of the other network code claims to only support single valued outputs.
ConstructNodes(nodeCounts, actFunc, actFuncParms)

build an unconnected network and set node counts

Arguments

  • nodeCounts: a list containing the number of nodes to be in each layer.
    the ordering is:

    (nInput,nHidden1,nHidden2, ... , nHiddenN, nOutput)

ConstructRandomWeights(minWeight=-1, maxWeight=1)

initialize all the weights in the network to random numbers

Arguments

  • minWeight: the minimum value a weight can take
  • maxWeight: the maximum value a weight can take
FullyConnectNodes()

Fully connects each layer in the network to the one above it

Note
this sets the connections, but does not assign weights
GetAllNodes()

returns a list of all nodes

GetHiddenLayerNodeList(which)

returns a list of hidden nodes in the specified layer

GetInputNodeList()

returns a list of input node indices

GetLastOutputs()

returns the complete list of output layer values from the last time this node classified anything

GetNode(which)

returns a particular node

GetNumHidden()

returns the number of hidden layers

GetNumNodes()

returns the total number of nodes

GetOutputNodeList()

returns a list of output node indices