Пример #1
0
def processCollisionLayer(bumps : list):
    # COLLISIONS_INPUT, PROXIMITY -> COLLISION -------------------------- LAYER 1
    
    i = {i:bumps[i] for i in nns.active_ts}

    layer = 1 

    w = nns.connectivities[layer]
    # Proximity Layer Output
    o = nns.outputs[layer - 1]
    hf = nns.compositionFunction[layer]
    g = nns.activationFunction[layer]
    f = nns.outputFunction[layer]

    h_collision = annutils.sparseLayerInputComposition(i, o, w, hf)
    a_collision = annutils.layerActivationLevel(h_collision, g)
    nns.outputs[layer] = annutils.sparseArray(
        list(nns.outputs[layer].keys()), 
        annutils.layerOutput(a_collision, f)
    )

    logger.info(f"Collision Layer Composed Input: {h_collision}")
    logger.info(f"Weights Proximity to Collision:")
    for n, conn in w.items(): logger.info(f"{n}->{conn}")
    logger.info(f"Collision Layer Output: {nns.outputs[layer]}")
Пример #2
0
def processMotorLayer():
    # COLLISION -> MOTORS -----------------------------  LAYER 3

    i = []

    layer = 3

    w = nns.connectivities[layer]
    o = nns.outputs[layer - 2]  # Collision Layer Output
    hf = nns.compositionFunction[layer]
    g = nns.activationFunction[layer]
    f = nns.outputFunction[layer]

    h_motor = annutils.sparseLayerInputComposition(i, o, w, hf)
    a_motor = annutils.layerActivationLevel(h_motor, g)
    nns.outputs[layer] = annutils.sparseArray(list(nns.outputs[layer].keys()),
                                              annutils.layerOutput(a_motor, f))

    logger.info(f"Motor Layer Composed Input: {h_motor}")
    logger.info(f"Motor Layer Output: {nns.outputs[layer]}")
Пример #3
0
def processReverseLayer():
    # COLLISION -> REVERSE -----------------------------  LAYER 2

    i = []

    layer = 2

    w = nns.connectivities[layer]
    # Collision Layer Output
    o = nns.outputs[layer - 1]
    hf = nns.compositionFunction[layer]
    g = nns.activationFunction[layer]
    f = nns.outputFunction[layer]

    h_reverse = annutils.sparseLayerInputComposition(i, o, w, hf)
    a_reverse = annutils.layerActivationLevel(h_reverse, g)
    nns.outputs[layer] = annutils.sparseArray(
        list(nns.outputs[layer].keys()), annutils.layerOutput(a_reverse, f))

    logger.info(f"Reverse Layer Composed Input: {h_reverse}")
    logger.info(f"Reverse Layer Output: {nns.outputs[layer]}")