Exemplo n.º 1
0
def printMatrix():
    name = input(
        'Input matrix\'s name to be printed. (Read from ".mtrx" file)\n>>>')
    raw = IO.RAWReader()
    raw.open(name + '.mtrx')
    matrix = IO.getAMatrix(raw)
    np.set_printoptions(threshold=np.nan)
    print(matrix)
 def loadfromFile(self, Filename):
     try:
         MyRAWReader = IO.RAWReader()
         MyRAWReader.open(Filename + '.node')
         self.Name = Filename
         self.LayersCount = int(MyRAWReader.pop())
         self.LayerNeuronsCount = []
         self.Weight = []
         self.Bias = []
         # Get the LayersCount first and Initlalize LayerNeuronsCount, Weight and Bias
         for layer in range(0, self.LayersCount):
             self.LayerNeuronsCount.append(int(MyRAWReader.pop()))
         # Get each layer's neurons count one by one
         for layer in range(0, self.LayersCount - 1):
             self.Weight.append(IO.getAMatrix(MyRAWReader))
         # Get each layer's weight one by one
         for layer in range(0, self.LayersCount - 1):
             self.Bias.append(IO.getAMatrix(MyRAWReader))
         # Get each layer's bias one by one
     except:
         print('warning: Loading ' + Filename + '.node error!')