| 337 | } |
| 338 | |
| 339 | int testKNNValidatorGood() { |
| 340 | |
| 341 | Specification::Model m1; |
| 342 | |
| 343 | KNNValidatorTests::generateInterface(m1); |
| 344 | |
| 345 | auto *knnClassifier = m1.mutable_knearestneighborsclassifier(); |
| 346 | KNNValidatorTests::setNumberOfNeighbors(knnClassifier, 3, true); |
| 347 | knnClassifier->mutable_uniformweighting(); |
| 348 | |
| 349 | auto *nnIndex = knnClassifier->mutable_nearestneighborsindex(); |
| 350 | nnIndex->mutable_squaredeuclideandistance(); |
| 351 | auto *kdTree = nnIndex->mutable_singlekdtreeindex(); |
| 352 | kdTree->set_leafsize(30); |
| 353 | |
| 354 | KNNValidatorTests::addDataPoints(knnClassifier); |
| 355 | KNNValidatorTests::addStringLabels(knnClassifier); |
| 356 | |
| 357 | Result res = validate<MLModelType_kNearestNeighborsClassifier>(m1); |
| 358 | ML_ASSERT_GOOD(res); |
| 359 | |
| 360 | return 0; |
| 361 | |
| 362 | } |
| 363 | |
| 364 | int testEmptyKNNValidationGood() { |
| 365 |
nothing calls this directly
no test coverage detected