All problems

Sizing a Train/Test Split

easyPythonFeature Engineering

Before Quillon Energy trains anything, the rows have to be divided in two: a set the model learns from and a set held back to judge it on afterwards. Nothing is being shuffled or moved here -- the planners only want the sizes, so the pipeline knows where to cut. The held-back side is the one the requested share applies to, and it is sized first: take the share of the total and discard any fraction, so a side that works out at 4.25 rows is 4 rows. Whatever is left over is the learning side, which means the two always add back to the total exactly.

Task: Print the size of each side.

Input

One line holding two values separated by a single space: the total number of rows, then the share going to the held-back side, as a number between 0 and 1.

Output

Two lines. First the word train, a single space, and the size of the learning side. Then the word test, a single space, and the size of the held-back side. Both are whole numbers of rows.

Example:

Input:
80 0.25

Output:
train 60
test 20

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…