1.Loading libraries

library(tidyverse)
library(tidymodels)
library(rpart.plot)
library(DT)

2.Loading the data

bikes <- read_csv("~/Desktop/R/csv/bikes.csv")
df <- bikes %>% slice_head(n = 700)
new_data <- bikes %>% slice_tail(n = 30)

3.EDA

Taking a look at the dataset

Checking for missing values

## # A tibble: 1 × 10
##    date season holiday weekday weather tempera…¹ realf…² humid…³ winds…⁴ rentals
##   <int>  <int>   <int>   <int>   <int>     <int>   <int>   <int>   <int>   <int>
## 1     0      0       0       0       0         0       0       0       0       0
## # … with abbreviated variable names ¹​temperature, ²​realfeel, ³​humidity,
## #   ⁴​windspeed

Plotting the numerical (predictor) variables

Plotting the numerical (target) variable

4.MODELLING

4.1 Desicion Trees

Predicting on new data

## # A tibble: 30 × 2
##    rentals .pred
##      <dbl> <dbl>
##  1    4649 2961.
##  2    6234 4151.
##  3    6606 5323.
##  4    5729 4108.
##  5    5375 4108.
##  6    5008 2961.
##  7    5582 2961.
##  8    3228 2961.
##  9    5170 2961.
## 10    5501 4108.
## # … with 20 more rows

4.2 Random Forest

Predicting on new data

## # A tibble: 30 × 2
##    rentals .pred
##      <dbl> <dbl>
##  1    4649 3008.
##  2    6234 4532.
##  3    6606 5149.
##  4    5729 4710.
##  5    5375 3302.
##  6    5008 3454.
##  7    5582 3185.
##  8    3228 3028.
##  9    5170 3409.
## 10    5501 3832.
## # … with 20 more rows

4.3 Support Vector Machine

Predicting on new data

## # A tibble: 30 × 2
##    rentals .pred
##      <dbl> <dbl>
##  1    4649 3457.
##  2    6234 4455.
##  3    6606 4374.
##  4    5729 5085.
##  5    5375 3983.
##  6    5008 2929.
##  7    5582 2184.
##  8    3228 2991.
##  9    5170 2931.
## 10    5501 4406.
## # … with 20 more rows

5.COMPARING RESULTS

6.PLOTTING THE DECISION TREE