Esempio n. 1
0
    def __init__(self, patternSet):
        inputLayer = Layer(NetLayerType.Input, None, patternSet.inputMagnitude())
        ruleLayer = Layer(NetLayerType.Rules, inputLayer, patternSet.inputMagnitude())
        prodNormLayer = Layer(NetLayerType.ProdNorm, ruleLayer, patternSet.outputMagnitude())
        consequentLayer = Layer(NetLayerType.Consequent, prodNormLayer, patternSet.outputMagnitude())

        consequentLayer.consequences = [[randomInitialWeight() for _ in range(patternSet.inputMagnitude() + 1)] for _ in range(len(prodNormLayer.neurons))]

        self.layers = [inputLayer, ruleLayer, prodNormLayer, consequentLayer]
        self.patternSet = patternSet
        self.absError = 100
        self.buildRules()
Esempio n. 2
0
 def __init__(self, patternSet):
     inputLayer = Layer(NetLayerType.Input, None, patternSet.inputMagnitude())
     hiddenLayer = Layer(NetLayerType.Hidden, inputLayer, patternSet.outputMagnitude())
     outputLayer = Layer(NetLayerType.Output, hiddenLayer, patternSet.outputMagnitude())
     self.layers = [inputLayer, hiddenLayer, outputLayer]
     self.patternSet = patternSet
     self.absError = 100
     self.buildCenters()