📜  ANN –双向联想记忆(BAM)学习算法

📅  最后修改于: 2021-04-17 02:18:08             🧑  作者: Mango

先决条件: ANN |双向联想记忆(BAM)

构造BAM模型的主要步骤分为三个步骤。

  1. 学习
  2. 测验
  3. 恢复

在ANN |文章中已通过数学公式描述了每个步骤。双向关联内存(BAM)。

在此,通过示例迭代地解释该学习算法。
认为,
设置A:输入模式

    \[$\operatorname{Set} \boldsymbol{A}: X_{1}=\left[\begin{array}{c}1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1\end{array}\right] \quad X_{2}=\left[\begin{array}{c}-1 \\ -1 \\ -1 \\ -1 \\ -1 \\ -1\end{array}\right] \quad X_{3}=\left[\begin{array}{r}1 \\ 1 \\ -1 \\ -1 \\ 1 \\ 1\end{array}\right] \quad X_{4}=\left[\begin{array}{r}-1 \\ -1 \\ 1 \\ 1 \\ -1 \\ -1\end{array}\right]$\]

集合B:对应的目标模式

    \[$\operatorname{Set} \mathbf{B}: Y_{1}=\left[\begin{array}{l}1 \\ 1 \\ 1\end{array}\right] \quad Y_{2}=\left[\begin{array}{r}-1 \\ -1 \\ -1\end{array}\right] \quad Y_{3}=\left[\begin{array}{r}1 \\ -1 \\ 1\end{array}\right] \quad Y_{4}=\left[\begin{array}{r}-1 \\ 1 \\ -1\end{array}\right]$\]

步骤1:在这里,M的值(不包含模式对)为4。
步骤2:在输入和输出层中分配神经元。在这里,输入层的神经元是6,输出层的神经元是3

步骤3:现在,计算权重矩阵(W):

    \[$\begin{aligned} W=\left[\begin{array}{l}1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1\end{array}\right]\left[\begin{array}{lll}1 & 1 & 1\end{array}\right]+\left[\begin{array}{lll}-1 \\ -1 \\ -1 \\ -1 \\ -1 \\ -1\end{array}\right]\left[\begin{array}{lll}-1 & -1 & -1\end{array}\right]+\left[\begin{array}{r}1 \\ 1 \\ -1 \\ -1 \\ 1 \\ 1\end{array}\right]\left[\begin{array}{llll}1 & -1 & 1\end{array}\right]+\left[\begin{array}{r}-1 \\ -1 \\ 1 \\ 1 \\ -1 \\ -1\end{array}\right]\left[\begin{array}{lll}-1 & 1 & -1\end{array}\right]\] \[=\left[\begin{array}{lll}4 & 0 & 4 \\ 4 & 0 & 4 \\ 0 & 4 & 0 \\ 0 & 4 & 0 \\ 4 & 0 & 4 \\ 4 & 0 & 4\end{array}\right] \end{aligned}$\]

步骤4:测试BAM模型学习算法-对于输入模式BAM将返回相应的目标模式作为输出。对于每个目标模式,BAM将返回相应的输入模式。

  • 使用-测试输入模式(A组)

        \[Y_{m}=\operatorname{sign}\left(W^{T} X_{m}\right), \quad m=1.2, \ldots, M\]

         \[$\boldsymbol{Y}_{1}=\operatorname{sign}\left(\boldsymbol{W}^{T} \boldsymbol{X}_{1}\right)=\operatorname{sign}\left\{\left[\begin{array}{cccccc}\mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4} \\ \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} \\ \mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4}\end{array}\right]\left[\begin{array}{c}\mathbf{1} \\ \mathbf{1} \\ \mathbf{1} \\ \mathbf{1} \\ \mathbf{1} \\ \mathbf{1}\end{array}\right]\right\}=\left[\begin{array}{c}\mathbf{1} \\ \mathbf{1} \\ \mathbf{1}\end{array}\right]$\] \[$\boldsymbol{Y}_{2}=\operatorname{sign}\left(\boldsymbol{W}^{T} \boldsymbol{X}_{2}\right)=\operatorname{sign}\left\{\left[\begin{array}{cccccc}\mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4} \\ \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} \\ \mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4}\end{array}\right]\left[\begin{array}{c}\mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1}\end{array}\right]\right\}=\left[\begin{array}{c}\mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1}\end{array}\right]$\] \[$\boldsymbol{Y}_{3}=\operatorname{sign}\left(\boldsymbol{W}^{T} \boldsymbol{X}_{3}\right)=\operatorname{sign}\left\{\left[\begin{array}{cccccc}\mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4} \\ \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} \\ \mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4}\end{array}\right]\left[\begin{array}{c}\mathbf{1} \\ \mathbf{1} \\ \mathbf{-1} \\ \mathbf{-1} \\ \mathbf{1} \\ \mathbf{1}\end{array}\right]\right\}=\left[\begin{array}{c}\mathbf{1} \\ \mathbf{-1} \\ \mathbf{1}\end{array}\right]$\] \[$\boldsymbol{Y}_{4}=\operatorname{sign}\left(\boldsymbol{W}^{T} \boldsymbol{X}_{4}\right)=\operatorname{sign}\left\{\left[\begin{array}{cccccc}\mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4} \\ \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} \\ \mathbf{4} & \mathbf{4} & \mathbf{0} & \mathbf{0} & \mathbf{4} & \mathbf{4}\end{array}\right]\left[\begin{array}{c}\mathbf{-1} \\ \mathbf{-1} \\ \mathbf{1} \\ \mathbf{1} \\ \mathbf{-1} \\ \mathbf{-1}\end{array}\right]\right\}=\left[\begin{array}{c}\mathbf{-1} \\ \mathbf{1} \\ \mathbf{-1}\end{array}\right]$\]

  • 使用-测试目标模式(设置B)

        \[X_{m}=\operatorname{sign}\left(W Y_{m}\right), \quad m=1.2, \ldots, M\]

         \[$\boldsymbol{X}_{1}=\operatorname{sign}\left(\boldsymbol{W} \boldsymbol{Y}_{1}\right)=\operatorname{sign}\left\{\left[\begin{array}{ccc}\mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{0} & \mathbf{4} & \mathbf{0} \\ \mathbf{0} & \mathbf{4} & \mathbf{0} \\ \mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{0} & \mathbf{4} & \mathbf{0}\end{array}\right]\left[\begin{array}{c}\mathbf{1} \\ \mathbf{1} \\ \mathbf{1}\end{array}\right]\right\}=\left[\begin{array}{c}\mathbf{1} \\ \mathbf{1} \\ \mathbf{1} \\ \mathbf{1} \\ \mathbf{1} \\ \mathbf{1}\end{array}\right]$\] \[$\boldsymbol{X}_{2}=\operatorname{sign}\left(\boldsymbol{W} \boldsymbol{Y}_{2}\right)=\operatorname{sign}\left\{\left[\begin{array}{ccc}\mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{0} & \mathbf{4} & \mathbf{0} \\ \mathbf{0} & \mathbf{4} & \mathbf{0} \\ \mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{0} & \mathbf{4} & \mathbf{0}\end{array}\right]\left[\begin{array}{c}\mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1}\end{array}\right]\right\}=\left[\begin{array}{c}\mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1} \\ \mathbf{-1}\end{array}\right]$\] \[$\boldsymbol{X}_{3}=\operatorname{sign}\left(\boldsymbol{W} \boldsymbol{Y}_{3}\right)=\operatorname{sign}\left\{\left[\begin{array}{ccc}\mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{0} & \mathbf{4} & \mathbf{0} \\ \mathbf{0} & \mathbf{4} & \mathbf{0} \\ \mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{0} & \mathbf{4} & \mathbf{0}\end{array}\right]\left[\begin{array}{c}\mathbf{1} \\ \mathbf{-1} \\ \mathbf{1}\end{array}\right]\right\}=\left[\begin{array}{c}\mathbf{1} \\ \mathbf{1} \\ \mathbf{-1} \\ \mathbf{-1} \\ \mathbf{1} \\ \mathbf{1}\end{array}\right]$\] \[$\boldsymbol{X}_{4}=\operatorname{sign}\left(\boldsymbol{W} \boldsymbol{Y}_{4}\right)=\operatorname{sign}\left\{\left[\begin{array}{ccc}\mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{0} & \mathbf{4} & \mathbf{0} \\ \mathbf{0} & \mathbf{4} & \mathbf{0} \\ \mathbf{4} & \mathbf{0} & \mathbf{4} \\ \mathbf{0} & \mathbf{4} & \mathbf{0}\end{array}\right]\left[\begin{array}{c}\mathbf{-1} \\ \mathbf{1} \\ \mathbf{-1}\end{array}\right]\right\}=\left[\begin{array}{c}\mathbf{-1} \\ \mathbf{-1} \\ \mathbf{1} \\ \mathbf{1} \\ \mathbf{-1} \\ \mathbf{-1}\end{array}\right]$\]

在这里,对于每个输入模式,BAM模型将给出正确的目标模式,对于目标模式,该模型还将给出相应的输入模式。
这表示内存或模型网络中的双向关联。