Merge pull request #6103 from mshabunin:add-get-samples
This commit is contained in:
commit
1aeff45631
@ -224,6 +224,9 @@ public:
|
||||
CV_WRAP virtual void setTrainTestSplitRatio(double ratio, bool shuffle=true) = 0;
|
||||
CV_WRAP virtual void shuffleTrainTest() = 0;
|
||||
|
||||
/** @brief Returns matrix of test samples */
|
||||
CV_WRAP Mat getTestSamples() const;
|
||||
|
||||
CV_WRAP static Mat getSubVector(const Mat& vec, const Mat& idx);
|
||||
|
||||
/** @brief Reads the dataset from a .csv file and returns the ready-to-use training data.
|
||||
|
@ -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() )
|
||||
|
Loading…
Reference in New Issue
Block a user