ml: moved getTestSamples implementation to src

This commit is contained in:
Maksim Shabunin 2016-02-12 12:32:26 +03:00
parent 15793b1301
commit 54abb83c82
2 changed files with 9 additions and 5 deletions

View File

@ -224,11 +224,8 @@ public:
CV_WRAP virtual void setTrainTestSplitRatio(double ratio, bool shuffle=true) = 0;
CV_WRAP virtual void shuffleTrainTest() = 0;
CV_WRAP Mat getTestSamples() const {
Mat idx = getTestSampleIdx();
Mat samples = getSamples();
return idx.empty() ? Mat() : getSubVector(samples, idx);
}
/** @brief Returns matrix of test samples */
CV_WRAP Mat getTestSamples() const;
CV_WRAP static Mat getSubVector(const Mat& vec, const Mat& idx);

View File

@ -50,6 +50,13 @@ static const int VAR_MISSED = VAR_ORDERED;
TrainData::~TrainData() {}
Mat TrainData::getTestSamples() const
{
Mat idx = getTestSampleIdx();
Mat samples = getSamples();
return idx.empty() ? Mat() : getSubVector(samples, idx);
}
Mat TrainData::getSubVector(const Mat& vec, const Mat& idx)
{
if( idx.empty() )