Restricting the values predicted by Decison trees in R to certain columns -
i have dataset related cricket following structure:
(matchid,venue,team1,team2,mr,mrn,mw,or,orn,ow,winner) mr : runs scored home team after 14 overs. or : runs scored away team after 14 overs. mrn: run rate of home team after 14 overs. orn: run rate of away team after 14 overs. mw: number of wickets lost home team after 14 overs. ow : number of wickets lost away team after 14 overs.
convention: team1 home team , team2 away team.
i trying predict winner of match above data. using 70% of data training data frame train_data , other 30% testing data frame test_data using decision trees in r. test_data has been stripped off winner column. function calls follows:
output.tree <- ctree(winner ~ venue + team1 + team2 + mr + mrn + mw + or+ orn + ow, data = train_data) #to create decision tree. testpred <- predict(output.tree, newdata = test_data[,1:(ncol(test_data) - 1)]) #use decision tree prediction
note obviously, winner of match has 1 of team1 or team2. on analyzing predicted values, found out predicted winner match maybe team neither team1 nor team2.
how enforce constraint predicted value must 1 of team1 or team2?
Comments
Post a Comment