MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AddExample

Method AddExample

tensorflow/contrib/tensor_forest/kernels/v4/grow_stats.cc:183–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183void ClassificationStats::AddExample(
184 const std::unique_ptr<TensorDataSet>& input_data, const InputTarget* target,
185 int example) {
186 const int64 int_label = target->GetTargetAsClassIndex(example, 0);
187 const float weight = target->GetTargetWeight(example);
188
189 for (int i = 0; i < num_splits(); ++i) {
190 auto& eval = evaluators_[i];
191 if (eval->Decide(input_data, example) == LEFT_INDEX) {
192 if (left_gini_ != nullptr) {
193 left_gini_->update(i, left_count(i, int_label), weight);
194 }
195 ClassificationAddLeftExample(i, int_label, weight);
196 } else {
197 if (right_gini_ != nullptr) {
198 right_gini_->update(i, right_count(i, int_label), weight);
199 }
200 ClassificationAddRightExample(i, int_label, weight);
201 }
202 }
203
204 ClassificationAddTotalExample(int_label, weight);
205
206 weight_sum_ += weight;
207
208 CheckFinishEarly();
209 CheckPrune();
210}
211
212void ClassificationStats::CheckPrune() {
213 if (params_.pruning_type().type() == SPLIT_PRUNE_NONE || IsFinished() ||

Callers 3

RunBatchFunction · 0.45
TESTFunction · 0.45

Calls 7

num_splitsFunction · 0.85
GetTargetAsClassIndexMethod · 0.45
GetTargetWeightMethod · 0.45
DecideMethod · 0.45
updateMethod · 0.45
num_outputsMethod · 0.45
GetTargetAsContinuousMethod · 0.45

Tested by 2

RunBatchFunction · 0.36
TESTFunction · 0.36