I am trying to validate and calibrate the conditional inference tree model using the crop yield data, and I started by splitting my dataset into training and test sets. After splitting, I had to predict the test set to see if the test set results were the same as the predicted ones, but unfortunately the predicted results are not true since almost all the values are similar
Importing the dataset
dataset = read.csv("D:/DISSERTATION/MOMBA,MBOZI/Extracted_csv_data/Extracted_data_new2.csv")
#Splitting the dataset into the Training set and Test set
install.packages('caTools')
library(caTools) set.seed(123)
split = sample.split(dataset $Yield, SplitRatio = 0.7) training_set = subset(dataset, split == TRUE) test_set = subset(dataset, split == FALSE)
#Fitting ctree Regression to the Training set
regressor =ctree(Yield~ppt.resample+tavg.resample+SRD.resample+WOCBA.momba.resample+ppn.density2018.momba2.resample+ph.250.sd13+N.250.sd13+CEC.250.sd13+ORCDRC.250.sd13+BLD.250.sd13+slope,data=training_set)
Predicting the Test set results
y_pred = predict(regressor, newdata = test_set) y_pred
This predicted yield results is what I am getting