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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.