MCPcopy Create free account
hub / github.com/apple/coremltools / testKNNValidatorNoDistanceFunction

Function testKNNValidatorNoDistanceFunction

mlmodel/tests/KNNValidatorTests.cpp:316–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316int testKNNValidatorNoDistanceFunction() {
317
318 Specification::Model m1;
319
320 KNNValidatorTests::generateInterface(m1);
321
322 auto *knnClassifier = m1.mutable_knearestneighborsclassifier();
323 KNNValidatorTests::setNumberOfNeighbors(knnClassifier, 3, true);
324 knnClassifier->mutable_uniformweighting();
325
326 auto *nnIndex = knnClassifier->mutable_nearestneighborsindex();
327 nnIndex->mutable_linearindex();
328
329 KNNValidatorTests::addDataPoints(knnClassifier);
330 KNNValidatorTests::addStringLabels(knnClassifier);
331
332 Result res = validate<MLModelType_kNearestNeighborsClassifier>(m1);
333 ML_ASSERT_BAD(res);
334
335 return 0;
336
337}
338
339int testKNNValidatorGood() {
340

Callers

nothing calls this directly

Calls 4

generateInterfaceFunction · 0.85
setNumberOfNeighborsFunction · 0.85
addDataPointsFunction · 0.85
addStringLabelsFunction · 0.85

Tested by

no test coverage detected