mlpack train weighted DecisionTree using sample frequency

109 views Asked by At

Following the example from the official documentation, I am at this point in training a DecisionTree classifier:

arma::rowvec weights = arma::randu<arma::mat>(1, labels.size());
size_t numClasses = 2;

KFoldCV<DecisionTree<>, Accuracy> cv2(5, data, labels, numClasses, weights);
size_t minimumLeafSize = 12;
double weightedDecisionTreeAccuracy = cv2.Evaluate(minimumLeafSize);

My question: does DecisionTree work well if the samples from the 2 classes are not evenly distributed? How should I modify my code to take into account that in the training set there is a 75% samples from class 1 which narrowly distribute around a single value, while the remaining 25% are from class 2 and are quite sparse?

0

There are 0 answers