memphis-iis / datawhys-content-notebooks-python

Content for DataWhys in the form of JupyterLab notebooks (.ipynb files)
Apache License 2.0
8 stars 2 forks source link

Renaming ‘splits’ as X_train, X_test, y_train, y_test #133

Closed gokyori closed 1 month ago

gokyori commented 11 months ago

Some notebooks consist of train, test split as ’splits’ as shown:

splits = model_selection.train_test_split(X, Y, random_state=1)

The splits are later referred to as splits[0], splits[1] so on. I believe it would be intuitive and easier to have X_train, X_test, y_train, y_test as X_train, X_test, y_train, y_test = model_selection.train_test_split(X, Y, random_state=1)

aolney commented 1 month ago

Apologies somehow did not get notified of this issue.

The reason we don't have blocks to destructure tuples is that this would require either blocks of fixed sizes with arbitrary tuple length or a generator style block with configurable variable slots. The later option would be so tedious from a user perspective that I think it's easier to deal with the array (though not ideal).

Feel free to reopen if you'd like to discuss further.