Skip to content
DeepForgeby svx
All problems

Behavior Cloning Dataset Split

Problem

Split n demonstration episodes into train and validation sets.

The validation size is int(n * val_fraction) using truncation, and the training set gets the rest. Return [n_train, n_val].

Hint

Truncation keeps the split deterministic for odd episode counts.

Test cases

case 1
in: [10,0.2]
expected: [8,2]
case 2
in: [7,0.3]
expected: [5,2]
case 3
in: [5,0]
expected: [5,0]
case 4
in: [3,1]
expected: [0,3]
Starter codePython
def bc_dataset_split(n_episodes, val_fraction):
    # Your code here
    pass

4 test cases · run your code against them in the editor