def __init__(self, in_size, out_size, **kwargs): self.in_size = in_size self.out_size = out_size if "statsHandler" in kwargs: self.statsHandler = kwargs["statsHandler"] else: self.statsHandler = StatsHandler()
def __init__(self, out_size, in_out_table: Dict, null_output=None, **kwargs): super().__init__(0, out_size, **kwargs) self.in_out_table = in_out_table self.null_output = null_output if null_output is not None else numpy.zeros( out_size) if "statsHandler" in kwargs: self.statsHandler = kwargs["statsHandler"] else: self.statsHandler = StatsHandler()
import sys import numpy import matplotlib.pyplot as plt from MLLibrary.Models.MatrixNet import MatrixNet from MLLibrary.Models.SequenceNet import SequenceNet from MLLibrary.StatsHandler import StatsHandler I = 2 O = 1 statsHandler = StatsHandler() NET = SequenceNet([MatrixNet(I, I), MatrixNet(I, O)],statsHandler=statsHandler) MAX_ITER = 1000000 BATCH = 100 LEARNING_RATIO = 0.01 def get_X(): index = 1 while True: index += 1 numpy.random.seed(index) yield [[numpy.random.choice([0.0, 1.0]), numpy.random.choice([0.0, 1.0])]] def get_Y(): index = 1 while True:
import sys import numpy import matplotlib.pyplot as plt from MLLibrary.Models.MatrixNet import MatrixNet from MLLibrary.Models.SequenceNet import SequenceNet from MLLibrary.StatsHandler import StatsHandler I = 2 O = 1 statsHandler = StatsHandler() NET = SequenceNet([MatrixNet(I, I), MatrixNet(I, O)], statsHandler=statsHandler) MAX_ITER = 1000000 BATCH = 50 LEARNING_RATIO = 0.1 def get_X(): index = 1 while True: index += 1 numpy.random.seed(index) yield [[ numpy.random.choice([0.0, 1.0]), numpy.random.choice([0.0, 1.0]) ]]