def __init__(self, numvis, numhid, vislayer=None, hidlayer=None, vishid=None): '''Initialize an RBM with numvis visible units and numhid hidden units. The weights are randomly initialized explicitly passed in as a parameter.''' self.numvis = numvis self.numhid = numhid weights = [vishid] if vishid is not None else None NeuralNet.__init__(self, [vislayer or BinaryStochasticLayer(numvis), hidlayer or BinaryStochasticLayer(numhid)], weights)
def __init__(self, numvis, numhid, vislayer=None, hidlayer=None, vishid=None): '''Initialize an RBM with numvis visible units and numhid hidden units. The weights are randomly initialized explicitly passed in as a parameter.''' self.numvis = numvis self.numhid = numhid weights = [vishid] if vishid is not None else None NeuralNet.__init__(self, [ vislayer or BinaryStochasticLayer(numvis), hidlayer or BinaryStochasticLayer(numhid) ], weights)