Question: Write a loop in Python that would be able to set train_cols equal to all possible combinations of features. The purpose of this is to
Write a loop in Python that would be able to set train_cols equal to all possible combinations of features. The purpose of this is to be able to run a confusion matrix on each combination of train_cols and save the train_cols with the best value later on.
train_cols = ["feature1", "feature2", "feature3", "feature4", "feature5", "feature6", "feature7", "feature8", "feature9", "feature10"]
For example, if the contents of train_cols was ["a", "b", "c"] the correct code would set train_cols equal to the following possibilities during the loop (order does not matter):
train_cols = ["a"]
train_cols = ["b"]
train_cols = ["c"]
train_cols = ["a", "b"]
train_cols = ["a", "c"]
train_cols = ["b", "c"]
train_cols = ["a", "b", "c"]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
