How does numpy vstack
work in numpy
while I am splitting the data into 10 folds.
X_set = np.split(X, 10)
Y_set = np.split(Y, 10)
for i in range(len(X_set)):
X_test= ?
Y_test= ?
It's possible to do what you've started in Numpy, but I think it's too low-level for this sort of stuff. I'd suggest you install sklearn . Then, you can do the following
from sklearn import cross_validation
for tr, te in cross_validation.KFold(len(Y_set), 10):
x_train, y_train = X_set[tr], Y_set[tr]
x_test, y_test = X_set[te], Y_set[te]
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.