line 53, in FNN
b[n, m] = np.dot(w[m, :], np.r_[x[n, :], 1])

IndexError: too many indices for array

このようなエラーコードが発生してしまいます。コードは下に記載してあります。これはどういう意味のエラーコードなのでしょうか?また、解決策はありますでしょうか?まだプログラミング勉強中なので、回答はお手柔らかにお願いいたします。

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

data_dir = r"C:\Users\nagat\Documents"
data = pd.read_csv(data_dir + r"\usdjpy_d.csv")
data.head()

data2 = np.array(data)

K = 2
M = 2
N = 10
D = 25
X = np.zeros((N, D))
T = np.zeros((N, K), dtype=np.uint8)

for n in range(N):
    for d in range(D):
        X[n, d] = data2[len(data2) - n*D - (D - d) - 1, 4]

for n in range(N):
    tomorrow = data2[len(data2) - n*D - (D - d), 4]
    if tomorrow < X[n, D - 1]:
        T[n, :] = [1, 0]
    if tomorrow > X[n, D - 1]:
        T[n, :] = X[0, 1]

X_n = 8
X_train = X[:X_n, :]
T_train = T[:X_n, :]
X_test = X[X_n:, :]
T_test = T[X_n:, :]

def Sigmoid(x):
    z = 1 / np.exp(-x)
    return z

def FNN(wv, M, K, x):
    N, D = x.shape
    w = wv[:M * (D+1)]
    w.reshape(M, (D+1))
    v = wv[M * (D+1):]
    v.reshape((K, M+1))

    b = np.zeros((N, M+1))
    z = np.zeros((N, M+1))
    a = np.zeros((N, K))
    y = np.zeros((N, K))

    for n in range(N):
        for m in range(M):
            b[n, m] = np.dot(w[m, :], np.r_[x[n, :], 1])

    for m in range(M):
        for n in range(N-1):
            z[n, m] = (z[n, m] + Sigmoid(b[n+1, m])) / n

    for n in range(N):
        z[n, M-1] = 1
        for k in range(K):
            a[n, k] = np.dot(v[k, :], np.r_[z[n, :], 1])
        u = 0
        for k in range(K):
            u = u + np.exp(a[n, k])
            y[n, k] = np.exp(a[n, k]) / u
    return y, a, z, b

def CrossEntropy(wv, M, K, x, t):
    N, D = x.shape
    y, a, z, b = FNN(wv, M, K, x)
    ce = -np.dot(np.log(y.reshape(-1)), t.reshape(-1))
    return ce

nWV = M*(D + 1) + K*(M + 1)
np.random.seed(1)
WV = np.random.normal(0, 1, nWV)

CE = CrossEntropy(WV, M, K, X_train, T_train)
print(CE)