Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Here you will define dtrain, dtest, ytrain, and ytest. How many records do we have in the dataset d? We want to keep 80% of
Here you will define dtrain, dtest, ytrain, and ytest. How many records do we have in the dataset d? We want to keep 80% of the for the training set and the remaining 20% for the testing set. How many records do you keep in the training set (round this number to the closest integer below 80% of the original number of records in dataset d. You can use the floor function for that). we keep ? records in the training set. {r} n= 714 # number of records in d ns= floor (571) # apply the floor function to compute the number of training records print (ns) # print the number of training records AX [1] 571 set . seed (12356) # use sample to generate ns record numbers for training index=NA # extract the index rows from d to define dataframe dtrain dtrain=NA # extract the complement of index rows from d to define dataframe dtest dtest =NA # define ytrain as the y column of dtrain ytrain=NA # define ytest as the y column of dtest ytest =NA
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started