I have a rather unbalanced data set and want to use rpart to build a classification tree. After building the full tree, I prune it back using the 1-SE rule. On average, only 1-2 splits are suggested. I was wondering, as far as I understood, cp is basically picked to maximise accuracy. However, this is suboptimal since accuracy is not a good performance measure for unbalanced data sets. My initial plan was basically to adjust the classification threshold eventually and pick the one which maximises for example the F1-score. But this is somehow inconsistent in my view. Running a tree first and pick cp so that accuracy is maximised although I know that cannot be the ultimate goal here. I would really appreciate some help here? I'm a little bit stuck here. Thank you!