Let's continue by building another model so we can compare the accuracy of both models and decide which model is better.
Create a new linear regression model for the 'train' set, but this time drop the 'x' and 'y' columns from the independent variables. That is, the 'price' of a diamond is all columns except 'x' and 'y'.
The prediction results are stored in 'result_regress2'.
예측 (mod_regress2, test)-> result_regress2
The actual and predicted values are combined and stored in 'Final_Data2'.
cbind (Actual = test $ price, Predicted = result_regress2)-> Final_Data2 as.data.frame (Final_Data2)-> Final_Data2
We will also add prediction errors to 'Final_Data2'.
Take a look at “Final_Data2”:
Creating an Array of Java Objects
Find the root mean square error to mexico phone number material get the aggregate error: rmse2<-sqrt(mean(Final_Data2$error^2))
We can see that the second model is slightly better than the first model, as 'rmse2' is slightly smaller than 'rmse1'.
Passing by reference in Java
classification:
This is a recursive partitioning classification algorithm working with the 'car_purchase' dataset.
Let's split the data into 'train' and 'test' sets using the 'sample.split()' function from the 'caTools' package.
65% of the observations in the 'Purchased' column are labeled 'TRUE' and the rest are labeled 'FALSE'.
sample.split (car_purchase $ Purchased, SplitRatio = 0.65)-> split_values All observations with the 'TRUE' label are stored in the 'train' data and observations with the 'FALSE' label are assigned to the 'test' data.
The built model is saved in 'mod_regress2
-
- Posts: 18
- Joined: Tue Dec 03, 2024 3:38 am