Question: Use train_test_split from sklearn on your House votes data. Use 70% of the data for training and the rest for testing. Add the following arguments
Use train_test_split from sklearn on your House votes data. Use 70% of the data for training and the rest for testing. Add the following arguments to train_test_split: random_state = 21, stratify = y. Print out the predictions for the test set and the model score. Note: use Jupyter notebook (Python)
the dataset is too long since it contains 233 rows and 16 columns, so i can't copy and paste it here. But this is what (part of) the dataset looks like (what's important is the code/process, i don't mind if the output is different):


water 0 0 1 D E F budget phys_fee el_sal 1 1 0 1 0 1 1 1 0 1 1 0 P Q duty_free south_africa 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 0 0 1 1 1 1 0 1 0 1 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 0 1 0 1 0 0 A B 1 party infants 2 democrat 3 republicar 4 democrat 5 democrat 6 democrat 7 democrat 8 democrat 9 republicar 10 democrat 11 republicat 12 democrat 13 republicar 14 democrat 15 republicar 16 republicar 17 republicar 18 democrat 19 democrat 20 democrat 21 democrat 22 democrat 23 democrat G H I K M N o religion sat_test nic_aid mx_missil immigrati synfuels education superfunc crime 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 0 0 1 1 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 0 1 0 0 1 0 1 1 1 0 0 1 1 0 1 1 1 0 1 0 0 1 1 0 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 1 0 1 1 0 0 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 0 0 1 1 0 1 1 0 1 0 1 0 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 0 o 1 1 1 1 0 1 B C D E F H 1 K M N O R 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 1 0 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 1 1 0 1 1 1 1 1 0 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 0 1 1 0 1 0 0 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 1 1 1 0 1 0 0 1 1 0 1 0 0 1 1 0 1 1 0 0 0 1 A 24 republica 25 republicar 26 republicar 27 republicar 28 republicar 29 republicar 30 democrat 31 republicat 32 republicar 33 republicar 34 democrat 35 republicat 36 republicar 37 democrat 38 democrat 39 democrat 40 democrat 41 republicar 42 republicar 43 republicar 44 democrat 45 republicar 46 republicar 1 1 1 1 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 0 1 1 0 1 1 1 0 1 0 0 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 1 0 1 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 0 0 0 1 1 0 1 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
