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

Function testKNNValidatorLinearIndex

mlmodel/tests/KNNValidatorTests.cpp:235–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235int testKNNValidatorLinearIndex() {
236
237 Specification::Model m1;
238
239 KNNValidatorTests::generateInterface(m1);
240
241 auto *knnClassifier = m1.mutable_knearestneighborsclassifier();
242 KNNValidatorTests::setNumberOfNeighbors(knnClassifier, 3, true);
243 knnClassifier->mutable_uniformweighting();
244
245 auto *nnIndex = knnClassifier->mutable_nearestneighborsindex();
246 nnIndex->mutable_linearindex();
247 nnIndex->mutable_squaredeuclideandistance();
248
249 KNNValidatorTests::addDataPoints(knnClassifier);
250 KNNValidatorTests::addStringLabels(knnClassifier);
251
252 Result res = validate<MLModelType_kNearestNeighborsClassifier>(m1);
253 ML_ASSERT_GOOD(res);
254
255 return 0;
256
257}
258
259int testKNNValidatorSingleKdTreeIndex() {
260

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