ValueError: too many values to unpack (expected 2) solution (python 3.7)

Asked 2 years ago, Updated 2 years ago, 45 views

import sys
sys.path.append('..')
from optimizer import SGD
from trainer import trainer
import numpy as np
from two_layer_net import TwoLayerNet

max_epoch=4395
batch_size=500
hidden_size=2000
learning_rate = 1.0

x,t=np.genfromtxt(fname="1ghdenn.csv", encoding='UTF-8', dtype=None, delimiter='\t')
model=TwoLayerNet(input_size=4395, hidden_size=hidden_size, output_size=24)
optimizer=SGD(lr=learning_rate)

trainer=Trainer(model, optimizer)
trainer.fit(x,t,max_epoch,batch_size,val_interval=10)
trainer.plot()

If you type this code, you will get a title-like error.
Please let me know how to solve it.

python python3

2022-09-30 21:37

1 Answers

"unpack" means "unpacked sequence", and this error is "np.genfromtxt() function return value is x,t=np.genfromtxt() more than 2 unpacked variables.

np.genfromtxt() The return value of the function is NumPyarray, so I think it is common to take it as an array and then process it.

 data=np.genfromtxt


2022-09-30 21:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.