MCPcopy Create free account
hub / github.com/davisking/dlib / is_sequence_segmentation_problem

Function is_sequence_segmentation_problem

dlib/svm/svm.h:204–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202 typename sequence_type
203 >
204 bool is_sequence_segmentation_problem (
205 const std::vector<sequence_type>& samples,
206 const std::vector<std::vector<std::pair<unsigned long,unsigned long> > >& segments
207 )
208 {
209 if (is_learning_problem(samples, segments))
210 {
211 for (unsigned long i = 0; i < samples.size(); ++i)
212 {
213 // Make sure the segments are inside samples[i] and don't overlap with each
214 // other.
215 std::vector<bool> hits(samples[i].size(), false);
216 for (unsigned long j = 0; j < segments[i].size(); ++j)
217 {
218 const unsigned long begin = segments[i][j].first;
219 const unsigned long end = segments[i][j].second;
220 // if the segment is outside the sequence
221 if (end > samples[i].size())
222 return false;
223
224 if (begin >= end)
225 return false;
226
227 // check for overlap
228 for (unsigned long k = begin; k < end; ++k)
229 {
230 if (hits[k])
231 return false;
232 hits[k] = true;
233 }
234 }
235 }
236 return true;
237 }
238
239 return false;
240 }
241
242// ----------------------------------------------------------------------------------------
243

Callers 9

train_denseFunction · 0.85
train_sparseFunction · 0.85
test_sequence_segmenter1Function · 0.85
test_sequence_segmenter2Function · 0.85
test_sequence_segmenterFunction · 0.85
trainMethod · 0.85

Calls 2

is_learning_problemFunction · 0.85
sizeMethod · 0.45

Tested by 3

test_sequence_segmenter1Function · 0.68
test_sequence_segmenter2Function · 0.68
test_sequence_segmenterFunction · 0.68