[英]How to fix in <module> Error for my neural network?
I get the following error File "C:/Users/xx/Desktop/xxx/ost.py", line 213, in main(), while trying to initiate training of neural network 我在main()中获得以下错误文件“C:/Users/xx/Desktop/xxx/ost.py”,第213行,同时尝试启动神经网络的训练
This is for a final lab assignment about pictures classification 这是关于图片分类的最终实验室作业
if __name__ == '__main__':
main()
and the main function is 而主要功能是
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))
I managed to fix it, the problem was with a line that received too many indexes! 我设法修复它,问题是一条线接收了太多的索引! Thanks anyways 不管怎么说,多谢拉
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.