Ask Your Question

xavisuau's profile - activity

2015-11-03 03:11:11 -0500 asked a question RTrees regression to multiple output responses

I am using RTrees for regression. However, I don't find the way to make it work with multiple variables. I am using code similar to the tree_engine.cpp sample.

My features have dimension 300, and I want to do joint regression to 3 output variables, so I have 3 ordered responses per feature vector. For example, 1 data row has indices 0-299=features, 300-302=responses.

I have tried the following settings:

const char* filename = "my_data.csv";
int response_idx = 300;
int response_size = 3;
std::string typespec = "ord[0-302]";

Ptr<TrainData> data = TrainData::loadFromCSV(filename, 0, response_idx, response_idx+response_size, typespec);

However, I get the error:

OpenCV Error: Assertion failed (d == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0)) in create, file /Users/xavisuau/Downloads/opencv-3.0-2.0/modules/core/src/matrix.cpp, line 2294
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/xavisuau/Downloads/opencv-3.0-2.0/modules/core/src/matrix.cpp:2294: error: (-215) d == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0) in function create

Which looks quite deep...

Can anyone confirm regression is working using multiple response? Or is this maybe a bug?

Thanks!