Question: Please write the solution in RStudio. I've added necessary datasets below. Solutions that posted previously are completely wrong, please add a proper solution. Thank you.

Please write the solution in RStudio. I've added necessary datasets below. Solutions that posted previously are completely wrong, please add a proper solution. Thank you.
Testing Set.
Temperature,Humidity,Light,CO2,HumidityRatio,Occupancy 21.89,31.55,436.5,1047,0.0051296601,0 21.89,31.36,434,1031,0.0050985151,0 21.89,31.125,432.75,977.5,0.005059998,0 21.7,28.5,279.3333333333,585,0.0045762473,1 20.6,21.865,454,652.5,0.003274764,0 20.6,22.2,442.75,681.75,0.0033252058,0 20.6,22.26,444,702.3333333333,0.003334241,0 20.6333333333,22.26,444,707,0.0033411368,0 23.675,22.745,289,795.75,0.0041141013,1 24.2,23.0225,497,722,0.004299052,0 24.39,23.3925,236.5,852.5,0.0044190169,1 24.2,23.7,630,734,0.0044264636,0 24.2,23.745,690.5,729,0.0044349282,0 23.7,24.43,87,599.6666666667,0.004427757,1 22.39,26,191.5,534.5,0.0043526661,1 21.89,27.89,279.3333333333,603.6666666667,0.0045302529,1
Training Dataset
Temperature,Humidity,Light,CO2,HumidityRatio,Occupancy 23.18,27.272,426,721.25,0.0047929882,1 23.15,27.2675,429.5,714,0.0047834409,1 23.15,27.245,426,713.5,0.0047794635,1 23.15,27.2,426,708.25,0.0047715088,1 23.1,27.2,426,704.5,0.0047569929,1 23.1,27.2,419,701,0.0047569929,1 23.1,27.2,419,701.6666666667,0.0047569929,1 23.1,27.2,419,699,0.0047569929,1 23.1,27.2,419,689.3333333333,0.0047569929,1 23.075,27.175,419,688,0.0047453507,1 23.075,27.15,419,690.25,0.0047409519,1 23.1,27.1,419,691,0.0047393707,1 23.1,27.1666666667,419,683.5,0.0047511188,1 23.05,27.15,419,687.5,0.0047337318,1 23,27.125,419,686,0.0047149421,1
I suppose these are the classes below. Because of datasets are too large I've added particularly.
Temperature, Humidity, Light, CO2, HumidityRatio, Occupancy
Predicting room occupancy by using decision tree and random forests classification algo- rithms. (a) Load the room occupancy training and testing datasets that are also used for the 1st coursework. Train a decision tree classifier and evaluate the predictive performance by reporting the classification accuracy obtained on the testing dataset. (b) Output and analyse the tree learned by the decision tree algorithm, i.e. plot the tree structure and make a discussion about it. (c) Train a random forests classifier and evaluate the predictive performance by reporting the classification accuracy obtained on the testing dataset. Define set.seed(1). (d) Output and analyse the feature importance obtained by the random forests classifier. Predicting room occupancy by using decision tree and random forests classification algo- rithms. (a) Load the room occupancy training and testing datasets that are also used for the 1st coursework. Train a decision tree classifier and evaluate the predictive performance by reporting the classification accuracy obtained on the testing dataset. (b) Output and analyse the tree learned by the decision tree algorithm, i.e. plot the tree structure and make a discussion about it. (c) Train a random forests classifier and evaluate the predictive performance by reporting the classification accuracy obtained on the testing dataset. Define set.seed(1). (d) Output and analyse the feature importance obtained by the random forests classifier
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
