Login using Social Account
     Continue with GoogleLogin using your credentials
Let us use the Final Model to make predictions on the 'Test' data set and calculate the RMSE. Then compare the predicted values to the actual values.
Please follow the below steps:
Make the predictions using the final_model on X_test data set and store the output in a new column predictedCounts_test in the test_set dataframe.
test_set.loc[:,<<your code comes here>>] = final_model.<<your code comes here>>(X_test)
Calculate the mean squared error using mean_squared_error() function by passing to it the Test 'target' dataset (y_test) and the Test dataset predictions ('predictedCounts_test' column data of test_set dataframe) to it, and store the output in 'mse' variable
mse = <<your code comes here>>(<<your code comes here>>, test_set.loc[:,'predictedCounts_test'])
Calculate the 'root mean square error' from the 'mse' and store it in final_mse variable.
Print final_mse
For a better understanding, you can have a look at the data inside test_set dataframe.
Please plot the predicted values v/s actual values using the below code:
times = [9,18]
for time in times:
fig = plt.figure(figsize=(8, 6))
fig.clf()
ax = fig.gca()
test_set_freg_time = test_set[test_set.hr == time]
test_set_freg_time.plot(kind = 'line', x = 'dayCount', y = 'cnt', ax = ax)
test_set_freg_time.plot(kind = 'line', x = 'dayCount', y = 'predictedCounts_test', ax =ax)
plt.show()
Taking you to the next topic in seconds...
Want to create exercises like this yourself? Click here.
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...