[Dclib-devel] Random forest model: DLIB_ASSERT(trees[i].size() > 0, "A tree can't have 0 leaves.");
Brought to you by:
davisking
|
From: Vishal K. S. <vis...@gm...> - 2019-05-16 08:05:58
|
Hi,
I am trying to train random forest regression model.
I am getting an error.
*DLIB_ASSERT(trees[i].size() > 0, "A tree can't have 0 leaves.");*
Please find the code below:
std::vector<sample_type> samples;
std::vector<double> labels;
*// Here I fill the dataset;*
cout << "Starting... " << endl;
random_forest_regression_trainer<dense_feature_extractor> trainer;
trainer.set_num_trees(100);
trainer.set_seed("random forest");
cout << "Training..." << endl;
auto df = trainer.train(samples, labels); * // While training it crashes.*
cout << "Saving the model..." << endl;
serialize("model.dat") << df;
random_forest_regression_trainer<dense_feature_extractor>::trained_function_type
df1;
cout << "Loading the model..." << endl;
deserialize("model.dat") >> df1;
Can anyone point out to what I am doing wrong ?
Any help will be highly appreciated.
Best Regards,
Vishal.
|