I am trying to understand this code. I do not understand how if you do:
x_validation, x_test, y_validation, y_test =
train_test_split(x_validation_and_test, y_validation_and_test...
you can later do:
(len(x_validation[y_validation == 0])
surely the train_test_split
means x_validation
and y_validation
aren't related. What am I missing?
EDIT:
There are some good answers already but I just want to clarify. Are x_validation
and y_validation
guaranteed to be in the correct order, and the same as each other. Obviously you could add a row to either and mess things up, but is there an underlying index that means order is preserved? I come from a non-python background and sometimes you could not guarantee order of things like SQL columns.