@mohitlearns wrote:
Hello,
I have one (“single”) data file with approx 20K features (rows / fields).
I want to split this file between training data and test data in the ratio of 80:20 using Stratified Shuffle Split
In this file there is an attributes named “Income” and I would like train and test data - each of these file to retain the percentage distribution of income from the original file
I converted Income to Income discreet values under income_cat field
Here is the code snippet:
SSS = StratifiedShuffleSplit(housing[“income_cat”], test_size=0.2)
train_indices, test_indices = next(iter(SSS)) I get the following error on running this command
TypeError: ‘StratifiedShuffleSplit’ object is not iterableI also tried
for train_index,test_index enumerate(SSS.split(housing[“income_cat”])
however I still get the same errorHow can I get indexes from SSS when I just have one file to work with
Thanks,
Mohit
Posts: 2
Participants: 2