R

Car Sales. Consider the data on used cars (mlba::ToyotaCorolla ) with 1436 recor

By admin

Car Sales. Consider the data on used cars (mlba::ToyotaCorolla ) with 1436 records and details on 38 variables, including Price, Age, KM, HP, and other specifications. The goal is to predict the price of a used Toyota Corolla based on its specifications.
Use predictors Age_08_04, KM, Fuel_Type, HP, Automatic, Doors, Quarterly_Tax, Mfr_Guarantee, Guarantee_Period, Airco, Automatic_airco, CD_Player, Powered_Windows, Sport_Model, and Tow_Bar.
To ensure everyone gets the same results, use the following code to convert categorical predictors to dummies, create training and holdout data sets, and normalize the training set and holdout set. Note the holdout set is normalized by using the training set.
# load the data and preprocess
toyota.df %
mutate(
Fuel_Type_CNG = ifelse(Fuel_Type == “CNG”, 1, 0),
Fuel_Type_Diesel = ifelse(Fuel_Type == “Diesel”, 1, 0)
)

# partition
set.seed(1)
idx

Exit mobile version