Question: Complete the function below that takes in some data (as a dict) and the maximum percentage of the passed in data that should be in

 Complete the function below that takes in some data (as a

Complete the function below that takes in some data (as a dict) and the maximum percentage of the passed in data that should be in the test set. The function should split the passed in data into train and test sets and return them. Both train and test should be formatted as a dict that matches the passed in data (columns names are the keys and the values are the column values) Truncate when computing the exact number of test records. For example if there are 5 records and test_percentage =0.5, then the test set should have 2 records in it. In the cases the test_percentage is too low or high, the test set should always have at least one record and at most all except one record (the train set also needs to have at least one record). You may shuffle the resulting splits if you so choose, it will not affect scoring. Note how sklearn.model_selection.train_test_split does not work right away here, since your data is formatted differently. Sometimes you may have to either split your data yourself, or convert it into a format that sklearn.model_selection.train_test_split() understands

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!