Skip to content

GitAd7/R_Data_Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Bike Rental Prediction Analysis

This R script performs exploratory data analysis (EDA) and predicts bike rental counts based on environmental and seasonal settings using the random forest algorithm. The analysis involves loading the dataset, exploring its structure, handling missing values, visualizing patterns, and building a predictive model.

How to run the code

  1. Install Required Packages: Make sure to install the necessary R packages as shown in code

  2. Accessing Packages: Load the required libraries for the analysis

  3. Reading the Data: Read the dataset from an Excel file.

  4. Exploratory Data Analysis: Explore the dataset structure, perform data type conversion, check for missing values, and visualize key attributes. Also plotted a Correlation Matrix image

image In the above visulaization, I have shown a scatter plot between the humidity and temprature. From the plot we can easily see that count of rented bikes is less (dark blue dots) for the high range of humidity and low range of temprature. The reverse can be also be seen that when the temprature is high and the humidity is low the count of rented bikes increses (light blue dots).

image In the above grpah I have plotted a Bar Graph to show Seasonal Distribution of Bike Rented. The graph has Different seasons (in numeric) on the x-axis and Count of bikes rented on the y-axis. Each Number on x-axis represent a season in the following order: 1 -> Spring, 2 -> Summer, 3 -> Fall, 4 -> Winter. As we can see that the count of bikes rented has continously increasing from spring to fall but drops a little in winter.

image In the above graph i have plotted a bar plot to show the bikes rented on the basis of the weather situation. The 1 represent the clear and sunny weather, 2 represents the Cloudy weather, 3 represents the Light snow or rain weather. As we can see that when the weahter is clear and sunny the most number of bikes are rented and this number drops rapidly as the weather changes. So we can say that the weather the bike is going to be rented or not is totally depends on weather situation.

image In the baove graph, i have plotted a bar chart to show the distrbution of rented bikes throughout the week. From the plot it is clearly indicated that the number of bikes rented do not change in a recordable manner throughout the week. image In the above plot, I have made a Bar graph to show the Monthly Distribution of bike Rented. From the plot it is clealry seen that the month with most bikes rented is August and the month with least bikes rented is January. This result totally support our analysis done for the weather situation, as during januray the cold weather is at peak with snow all around because of which less bikes are rented. image In the above plot, I have made a bar graph to show the Yearly Distribution of Bikes rented. As clealr seen that from the 2011 (representes as 0) the number of bikes rented are increases singnificantly in the year 2012. image In the above plot, since the data we have is numeric so I plotted a box plot check if there are any outliers present in our data or not. As clealry seen from the plot that there are no outliers present in our data.

  1. Data Splitting and Model Building: Split the data into training and testing sets, and build a Random Forest model.

  2. Model Evaluation: Make predictions on the test dataset and evaluate model performance using Mean Absolute Error (MAE) and Root Mean Squared Error (RMSE).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages