Caches the indexed features of the canonical samples. ComputeCanonicalSamples must have been already called. TODO(rays) see note on ReliablySeparable and try restricting the canonical features to those that truly represent all samples.
| 789 | // TODO(rays) see note on ReliablySeparable and try restricting the |
| 790 | // canonical features to those that truly represent all samples. |
| 791 | void TrainingSampleSet::ComputeCanonicalFeatures() { |
| 792 | ASSERT_HOST(font_class_array_ != NULL); |
| 793 | int font_size = font_id_map_.CompactSize(); |
| 794 | for (int font_index = 0; font_index < font_size; ++font_index) { |
| 795 | int font_id = font_id_map_.CompactToSparse(font_index); |
| 796 | for (int c = 0; c < unicharset_size_; ++c) { |
| 797 | int num_samples = NumClassSamples(font_id, c, false); |
| 798 | if (num_samples == 0) |
| 799 | continue; |
| 800 | const TrainingSample* sample = GetCanonicalSample(font_id, c); |
| 801 | FontClassInfo& fcinfo = (*font_class_array_)(font_index, c); |
| 802 | fcinfo.canonical_features = sample->indexed_features(); |
| 803 | } |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | // Computes the combined set of features used by all the samples of each |
| 808 | // font/class combination. Use after ReplicateAndRandomizeSamples. |
no test coverage detected