FIT3152 Data analytics: Assignment 2
The objective of this assignment is to gain familiarity with classification models using R.
You will be using a modified version of the Kaggle competition data. The data contains a number of meteorological observations as attributes, and the class attribute “CloudTomorrow”. Details of the decision attributes follow the assignment description.
You are expected to use R for your analysis, and may use any R package. Clear your workspace, set the number of significant digits to a sensible value, and use ‘WAUS’ as the default data frame name for the whole data set. Read your data into R using the following code:
rm(list = ls())
WAUS <- read.csv("CloudPredict2021.csv") L <- as.data.frame(c(1:49))
set.seed(88888888) # Your Student ID is the random seed
L <- L[sample(nrow(L), 10, replace = FALSE),] # sample 10 locations WAUS <- WAUS[(WAUS$Location %in% L),]
WAUS <- WAUS[sample(nrow(WAUS), 2000, replace = FALSE),] # sample 2000 rows
We want to obtain a model that may be used to predict whether it is going to be cloudy tomorrow for 10 locations in Australia.
set.seed(XXXXXXXX) #Student ID as random seed train.row = sample(1:nrow(iris), 0.7*nrow(iris)) iris.train = iris[train.row,]
iris.test = iris[-train.row,
10. Use commenting (#) in your R script, where appropriate, to help a reader
understand your code. Alternatively combine working, comments and reporting in R Markdown. (2 Marks)
Description of the data:
Attributes 1:3, Day, Month, Year of the observation
Attribute 4, Location: the location of the observation
Attribute 5, MinTemp: the daily minimum temperature in degrees celsius Attribute 6, MaxTemp: the daily maximum temperature in degrees celsius Attribute 7, Rainfall: the rainfall recorded for the day in mm Attribute 8, Evaporation: the evaporation (mm) in the 24 hours to 9am Attribute 9, Sunshine: hours of bright sunshine over the day.
Attribute 10, WindGust: direction of the strongest wind gust over the day.
Attribute 11, WindGustSpeed: speed (km/h) of the strongest wind gust over the day.
Attribute 12, WindDir9am: direction of the wind at 9am
Attribute 13, WindDir3pm: direction of the wind at 3pm
Attribute 14, WindSpeed9am: speed (km/hr) averaged over 10 minutes prior to 9am
Attribute 15, WindSpeed3pm: speed (km/hr) averaged over 10 minutes prior to 3pm
Attribute 16, Humidity9am: humidity (percent) at 9am
Attribute 17, Humidity3pm: humidity (percent) at 3pm
Attribute 18, Pressure9am: atmospheric pressure (hpa) reduced to mean sea level at 9am
Attribute 19, Pressure3pm: atmospheric pressure (hpa) reduced to mean sea level at 3pm
Attribute 20, Temp9am: temperature (degrees C) at 9am
Attribute 21, Temp3pm: temperature (degrees C) at 3pm
Attribute 22, RainToday: boolean: 1 if precipitation (mm) in the 24 hours to 9am exceeds 1mm, otherwise 0
Attribute 23, CloudyTomorrow: the target variable. If the average fraction of sky obscured by cloud at 9am and 3pm is greater than 4 "oktas", the day is classified as cloudy. Otherwise the day is classified as not cloudy. (Oktas record how many eigths of the sky are obscured by cloud.)
For solution, connect with our online professionals.