0
0
ML Pythonprogramming~10 mins

Train-test split in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the function that splits data into training and testing sets.

ML Python
from sklearn.model_selection import [1]
Drag options to blanks, or click blank then click option'
Atrain_test_split
Btest_train_split
Csplit_train_test
Dtrain_test
Attempts:
3 left
2fill in blank
medium

Complete the code to split features X and labels y into training and testing sets with 30% test size.

ML Python
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=[1])
Drag options to blanks, or click blank then click option'
A3
B0.3
C30
D0.03
Attempts:
3 left
3fill in blank
hard

Fix the error in the code to correctly split data with a fixed random state for reproducibility.

ML Python
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=[1])
Drag options to blanks, or click blank then click option'
A42
BNone
C'random'
D0.25
Attempts:
3 left
4fill in blank
hard

Fill both blanks to split data with 20% test size and shuffle enabled.

ML Python
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=[1], shuffle=[2])
Drag options to blanks, or click blank then click option'
A0.2
BTrue
CFalse
D0.8
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to split data with 25% test size, shuffle disabled, and random state 123.

ML Python
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=[1], shuffle=[2], random_state=[3])
Drag options to blanks, or click blank then click option'
ATrue
BFalse
C123
D0.25
Attempts:
3 left