* FindGoodProtos finds all protos whose normalized proto-evidence * exceed classify_adapt_proto_thresh. The list is ordered by increasing * proto id number. * * Globals: * - local_matcher_multiplier_ Normalization factor multiplier * param ClassTemplate Prototypes & tables for a class * param ProtoMask AND Mask for proto word * param ConfigMask AND Mask for config word * param BlobLen
| 555 | * @note History: Tue Mar 12 17:09:26 MST 1991, RWM, Created |
| 556 | */ |
| 557 | int IntegerMatcher::FindGoodProtos( |
| 558 | INT_CLASS ClassTemplate, |
| 559 | BIT_VECTOR ProtoMask, |
| 560 | BIT_VECTOR ConfigMask, |
| 561 | uinT16 BlobLength, |
| 562 | inT16 NumFeatures, |
| 563 | INT_FEATURE_ARRAY Features, |
| 564 | PROTO_ID *ProtoArray, |
| 565 | int AdaptProtoThreshold, |
| 566 | int Debug) { |
| 567 | ScratchEvidence *tables = new ScratchEvidence(); |
| 568 | int NumGoodProtos = 0; |
| 569 | |
| 570 | /* DEBUG opening heading */ |
| 571 | if (MatchDebuggingOn (Debug)) |
| 572 | cprintf |
| 573 | ("Find Good Protos -------------------------------------------\n"); |
| 574 | |
| 575 | tables->Clear(ClassTemplate); |
| 576 | |
| 577 | for (int Feature = 0; Feature < NumFeatures; Feature++) |
| 578 | UpdateTablesForFeature( |
| 579 | ClassTemplate, ProtoMask, ConfigMask, Feature, &(Features[Feature]), |
| 580 | tables, Debug); |
| 581 | |
| 582 | #ifndef GRAPHICS_DISABLED |
| 583 | if (PrintProtoMatchesOn (Debug) || PrintMatchSummaryOn (Debug)) |
| 584 | DebugFeatureProtoError(ClassTemplate, ProtoMask, ConfigMask, *tables, |
| 585 | NumFeatures, Debug); |
| 586 | #endif |
| 587 | |
| 588 | /* Average Proto Evidences & Find Good Protos */ |
| 589 | for (int proto = 0; proto < ClassTemplate->NumProtos; proto++) { |
| 590 | /* Compute Average for Actual Proto */ |
| 591 | int Temp = 0; |
| 592 | for (int i = 0; i < ClassTemplate->ProtoLengths[proto]; i++) |
| 593 | Temp += tables->proto_evidence_[proto][i]; |
| 594 | |
| 595 | Temp /= ClassTemplate->ProtoLengths[proto]; |
| 596 | |
| 597 | /* Find Good Protos */ |
| 598 | if (Temp >= AdaptProtoThreshold) { |
| 599 | *ProtoArray = proto; |
| 600 | ProtoArray++; |
| 601 | NumGoodProtos++; |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | if (MatchDebuggingOn (Debug)) |
| 606 | cprintf ("Match Complete --------------------------------------------\n"); |
| 607 | delete tables; |
| 608 | |
| 609 | return NumGoodProtos; |
| 610 | } |
| 611 | |
| 612 | /** |
| 613 | * FindBadFeatures finds all features with maximum feature-evidence < |
no test coverage detected