def __init__ (self, Neurons, AddBias=False, Name=None): gobject.GObject.__init__ (self) ListPool.__init__ (self) # Unique id self.Id = Layer.__nextId () # Name self.Name = Name # The total number of neurons self.numberOfNeurons = Neurons # The list of neurons self.neurons = list () self._pool = self.neurons # self.hasBiasLayer = False # self.biasLayer = None # Total Number of Weights self.numberOfWeights = 0 # Total Number Of Bias Weights self.numberOfBiasWeights = 0
def __init__ (self, Inputs, Outputs, Layers=None, NeuronsPerLayer=None, Name=""): gobject.GObject.__init__ (self) ListPool.__init__ (self) # Name self.Name = Name # Are our layers symmetric? if Layers is not None and NeuronsPerLayer is not None: self.SymmetricLayers = True else: self.SymmetricLayers = False # The number of inputs self.NumberOfInputs = Inputs # The number of outputs (the Neurons). self.NumberOfOutputs= Outputs # The number of layers, excluding the Input and Ouput. self.NumberOfLayers = Layers # The number of neurons that each layer will have. self.NumberOfNeuronsPerLayer = NeuronsPerLayer # Input/Output/Hidden layers. # Input layer is always at index 0. # Output layes is always at the end of the list. self.Layers = list () self._pool = self.Layers # Some flags self.NetworkCreated = False # All weights self.Weights = None # All inputs self.Inputs = None # Output values self.Output = list () # Total number of weights self.NumberOfWeights = 0 # Does this network has an extra bias layer attached # to each hidden layer? self.HasBiasLayer = False # Store times for different methods. Used for benchmarking. self.keepTime = dict ()