How to devide data into 10 fold and save in an array in Python -


i have data set don't know number of records in it. want implement cross validation manually, make long story short want devide data 10 fold , save each fold in array or list. should do? appreciate help.

you can use this:

length = int(len(data)/10) #length of each fold folds = [] in range(9):     folds += [data[i*length:(i+1)*length]] folds += [data[9*length:len(data)]] 

to list of lists containing 1/10th of array or list, last containing remainder.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -