Commit b6869df5 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #5127 from LorenaGdL:data.cpp-(ml-module)

parents 622301c7 c545857e
......@@ -636,9 +636,18 @@ public:
vtypes[ninputvars] = VAR_CATEGORICAL;
}
Mat(nsamples, noutputvars, CV_32F, &allresponses[0]).copyTo(tempResponses);
setData(tempSamples, ROW_SAMPLE, tempResponses, noArray(), noArray(),
noArray(), Mat(vtypes).clone(), tempMissing);
//If there are responses in the csv file, save them. If not, responses matrix will contain just zeros
if (noutputvars != 0){
Mat(nsamples, noutputvars, CV_32F, &allresponses[0]).copyTo(tempResponses);
setData(tempSamples, ROW_SAMPLE, tempResponses, noArray(), noArray(),
noArray(), Mat(vtypes).clone(), tempMissing);
}
else{
Mat zero_mat(nsamples, 1, CV_32F, Scalar(0));
zero_mat.copyTo(tempResponses);
setData(tempSamples, ROW_SAMPLE, tempResponses, noArray(), noArray(),
noArray(), noArray(), tempMissing);
}
bool ok = !samples.empty();
if(ok)
std::swap(tempNameMap, nameMap);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment