相互抑制

Neurocean大约 3 分钟案例案例

抑制性神经元之间的交流可以赋予回路有趣的特性。例如,如果抑制神经元A直接抑制抑制神经元B, 那么A的激活将解除对B的靶神经元的抑制。如果B也抑制A,那么它们就形成了相互(互惠)的抑制。 相互抑制被广泛应用于表现出节律性活动的电路中,例如涉及运动的回路。 甲壳类动物的口胃神经节就是一个典型的例子。在更长的时间范围内,相互抑制也可以用来调节大脑状态,如睡眠-觉醒周期。

简要拓扑图

相互抑制
相互抑制

代码示例

#
#   Copyright (c) 2022 Neurocean Group
#   All rights reserved.
#   Created by damone
#

import numpy as np

import ocean
from ocean import Session, CompileOption
from matplotlib import pyplot as plt
from ocean.utils.VisualizeHelper import visualizeHelper


def randomInput(number, timezone):
    return np.random.randint(2, size=(timezone, number), dtype=np.int8)


def visualizeResults(session, hidden1, hidden2):
    POTENTIALS = ["potentials", "output", "firePotentials"]

    plt.figure()
    # Hidden1
    plt.subplot(2, 1, 1)
    plt.title("Hidden1 potentials")
    captures = session.getCaptures(hidden1, POTENTIALS)
    visualizeHelper.plotPotentials(captures, [0])

    # output
    plt.subplot(2, 1, 2)
    plt.title("Hidden2 potentials")
    captures = session.getCaptures(hidden2, POTENTIALS)
    visualizeHelper.plotPotentials(captures, [0])
    plt.show()


def MutualInhibition():
    # Session
    session = Session("session")

    # Make input group
    input = session.makeNeuronGroup(
        "SequenceInput",
        number=2,
        totalTime=512,
        inputBuffer=randomInput(2, 512)
    )

    # Make hidden1 group
    hidden1 = session.makeNeuronGroup(
        "General",
        number=1,
        thresholds=-25,
        restingPotentials=-70,
        decays=0.8,
        potentials=-70
    )

    # Make hidden1 reduce
    hidden1Reduce = session.makeModel(
        "Reduce",
        number=2
    )
    hidden1Reduce.output("output").connect(hidden1.input("input"))

    # Make hidden2 group
    hidden2 = session.makeNeuronGroup(
        "General",
        number=1,
        thresholds=-25,
        restingPotentials=-70,
        decays=0.1,
        potentials=-70
    )

    # Make hidden2 reduce
    hidden2Reduce = session.makeModel(
        "Reduce",
        number=2
    )
    hidden2Reduce.output("output").connect(hidden2.input("input"))

    # Make edge1
    edge1 = session.makeSynapseGroup(
        "SimpleSynapse",
        inputNumber=2,
        outputNumber=1,
        weights=9
    )
    input.output("output").connect(edge1.input("input"))
    edge1.output("output").connect(hidden1Reduce.input("input0"))
    edge1.connect(0, 0)

    # Make edge2
    edge2 = session.makeSynapseGroup(
        "SimpleSynapse",
        inputNumber=2,
        outputNumber=1,
        weights=6
    )
    input.output("output").connect(edge2.input("input"))
    edge2.output("output").connect(hidden2Reduce.input("input0"))
    edge2.connect(1, 0)

    # Make edge3
    edge3 = session.makeSynapseGroup(
        "SimpleSynapse",
        inputNumber=1,
        outputNumber=1,
        weights=-18
    )
    hidden1.output("output").connect(edge3.input("input"))
    edge3.output("output").connect(hidden2Reduce.input("input1"))
    edge3.connect()

    # Make edge4
    edge4 = session.makeSynapseGroup(
        "SimpleSynapse",
        inputNumber=1,
        outputNumber=1,
        weights=-18
    )
    hidden2.output("output").connect(edge4.input("input"))
    edge4.output("output").connect(hidden1Reduce.input("input1"))
    edge4.connect()

    # Add monitor
    POTENTIALS = ["potentials", "output", "firePotentials"]
    session.addMonitors(hidden1, POTENTIALS)
    session.addMonitors(hidden2, POTENTIALS)

    # Run model
    option = ocean.RunOption(False, False, 512)
    if not (session.run(CompileOption.cpu(), option)):
        print("Run Model failed")
        return

    # Get captures, visualize it
    visualizeResults(session, hidden1, hidden2)


if __name__ == "__main__":
    MutualInhibition()

电位变化图

相互抑制
相互抑制
上次编辑于:
贡献者: damone