如何为我的神经网络修复<模块>错误?

时间:2019-05-25 15:13:19

标签: python module neural-network

我收到以下错误文件“ C:/Users/xx/Desktop/xxx/ost.py”,行213,在     main(),同时尝试启动神经网络训练

这是有关图片分类的最终实验作业

if __name__ == '__main__':
     main() 

主要功能是

def main():
    with open('train.pkl', 'rb') as f:
        data = pickle.load(f)

    x = data[0]
    y = data[1]

    # x=feature_extraction_hog(x)

    D = x.shape[1]

    hidden_size = 55
    output_size = 36

    w1 = np.random.uniform(low=-0.1, high=0.1, size=(hidden_size, (D + 1)))
    w2 = np.random.uniform(low=-0.1, high=0.1, size=(output_size, (hidden_size + 1)))

    w1, w2 = fit(x, y, True, output_size, hidden_size, w1, w2, 0.2, 0.2)

    np.savetxt('weights1.txt', w1)
    np.savetxt('weights2.txt', w2)

    y_train_pred = predict(x, w1, w2)

    print(classification_error(y_train_pred, y))

1 个答案:

答案 0 :(得分:0)

我设法解决了这个问题,问题在于一行接收了太多索引!还是谢谢