Branch Coverage

blib/lib/Algorithm/DecisionTree.pm
Criterion Covered Total %
branch 201 708 28.3


line true false branch
22 1 0 if (@_ % 2 != 0) { }
27 0 0 unless $eval_or_boosting_mode eq 'evalmode' or $eval_or_boosting_mode eq 'boostingmode'
28 0 0 if @_
30 1 0 unless ($eval_or_boosting_mode)
32 0 1 if check_for_illegal_params2(@params) == 0
48 0 1 exists $args{'max_depth_desired'} ? :
83 0 0 unless $self->check_names_used(\@features_and_values)
94 0 0 if not $_ =~ /^$numregex$/
95 0 0 if (not contained_in($feature, keys %{$$self{'_prob_distribution_numeric_features_hash'};}) and $not_all_values_float == 0)
102 0 0 if $self->{'_debug3'}
111 0 0 if ($self->{'_debug3'})
119 0 0 if ($item ne 'solution_path') { }
140 0 0 if (@children == 0)
150 0 0 if $self->{'_debug3'}
156 0 0 if $feature_tested_at_node eq $1
159 0 0 unless (defined $value_for_feature)
167 0 0 if ($value_for_feature)
168 0 0 if (contained_in($feature_tested_at_node, keys %{$$self{'_prob_distribution_numeric_features_hash'};})) { }
169 0 0 if $self->{'_debug3'}
175 0 0 if ($last_feature_and_value_on_branch =~ /$pattern1/)
177 0 0 if ($value_for_feature <= $threshold)
185 0 0 if ($last_feature_and_value_on_branch =~ /$pattern2/)
187 0 0 if ($value_for_feature > $threshold)
196 0 0 if $path_found
200 0 0 if $self->{'_debug3'}
203 0 0 if $self->{'_debug3'}
205 0 0 if ($last_feature_and_value_on_branch eq $feature_value_combo)
213 0 0 if $path_found
216 0 0 unless ($path_found)
247 0 0 if ($item ne 'solution_path') { }
271 0 0 if (@children == 0)
288 0 0 if (contained_in($feature_tested_at_node, keys %{$$self{'_prob_distribution_numeric_features_hash'};})) { }
289 0 0 if ($scratchpad_for_numerics{$feature_tested_at_node}) { }
300 0 0 if ($user_value_for_feature >= $valuerange[0] and $user_value_for_feature <= $valuerange[1])
304 0 0 if $answer_found
311 0 0 if ($branch_attribute =~ /$pattern1/)
313 0 0 if ($user_value_for_feature <= $threshold)
321 0 0 if ($branch_attribute =~ /$pattern2/)
323 0 0 if ($user_value_for_feature > $threshold)
332 0 0 if $path_found
342 0 0 if (contained_in($user_value_for_feature, @possible_values_for_feature))
346 0 0 if $answer_found
352 0 0 if ($branch_attribute eq $feature_value_combo)
360 0 0 if $path_found
362 0 0 unless ($path_found)
381 0 1 if ($self->{'_debug3'})
386 0 1 if ($self->{'_debug3'})
391 0 1 if $self->{'_debug3'}
407 0 26 if $self->{'_debug3'}
411 0 26 if ($self->{'_debug3'})
418 8 18 if ($existing_node_entropy < $self->{'_entropy_threshold'})
419 0 8 if $self->{'_debug3'}
426 0 18 if $self->{'_debug3'}
427 0 18 if (defined $self->{'_max_depth_desired'} and @features_and_values_or_thresholds_on_branch >= $self->{'_max_depth_desired'})
429 0 0 if $self->{'_debug3'}
432 0 18 unless defined $best_feature
433 0 18 if ($self->{'_debug3'})
440 0 18 if $self->{'_debug3'}
441 12 6 if ($entropy_gain > $self->{'_entropy_threshold'}) { }
442 0 12 if (exists $self->{'_numeric_features_valuerange_hash'}{$best_feature} and $self->{'_feature_values_how_many_uniques_hash'}{$best_feature} > $self->{'_symbolic_to_numeric_cardinality_threshold'}) { }
457 0 0 if ($self->{'_debug3'})
469 0 0 if ($self->{'_debug3'})
473 0 0 if ($best_entropy_for_less < $existing_node_entropy - $self->{'_entropy_threshold'})
480 0 0 if ($best_entropy_for_greater < $existing_node_entropy - $self->{'_entropy_threshold'})
489 0 12 if $self->{'_debug3'}
491 0 12 if $self->{'_debug3'}
496 0 40 if $self->{'_debug3'}
498 4 36 if (not @features_and_values_or_thresholds_on_branch) { }
513 0 40 if ($self->{'_debug3'})
517 25 15 if ($existing_node_entropy - $class_entropy_for_child > $self->{'_entropy_threshold'}) { }
523 0 15 if $self->{'_debug3'}
529 0 6 if $self->{'_debug3'}
555 72 0 unless exists $self->{'_prob_distribution_numeric_features_hash'}{$feature_name}
559 47 0 if $feature_and_value_or_threshold =~ /$pattern1/
563 25 47 unless contained_in($x, @symbolic_features_already_used)
570 0 47 if ($item =~ /$pattern2/) { }
0 47 elsif ($item =~ /$pattern3/) { }
47 0 elsif ($item =~ /$pattern1/) { }
584 0 0 if not $seen{$_}++
586 47 0 if not $seen{$_}++
598 0 0 if ($feature_grouping->[1] eq '>') { }
617 0 72 if $self->{'_debug3'}
618 47 25 if (contained_in($feature_name, @symbolic_features_already_used)) { }
0 25 elsif (contained_in($feature_name, keys %{$$self{'_numeric_features_valuerange_hash'};}) and $self->{'_feature_values_how_many_uniques_hash'}{$feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'}) { }
624 0 0 if $self->{'_debug3'}
626 0 0 if (contained_in($feature_name, @true_numeric_types_feature_names)) { }
627 0 0 if (defined $upperbound{$feature_name} and defined $lowerbound{$feature_name} and $lowerbound{$feature_name} >= $upperbound{$feature_name}) { }
0 0 elsif (defined $upperbound{$feature_name} and defined $lowerbound{$feature_name} and $lowerbound{$feature_name} < $upperbound{$feature_name}) { }
0 0 elsif (defined $upperbound{$feature_name}) { }
0 0 elsif (defined $lowerbound{$feature_name}) { }
633 0 0 if $x > $lowerbound{$feature_name} and $x <= $upperbound{$feature_name}
637 0 0 if $x <= $upperbound{$feature_name}
641 0 0 if $x > $lowerbound{$feature_name}
649 0 0 if @newvalues == 0
656 0 0 if (@features_and_values_or_thresholds_on_branch) { }
678 0 0 if ($min_entropy < $existing_node_entropy)
683 0 25 if $self->{'_debug3'}
684 0 25 if $self->{'_debug3'}
686 82 0 if $_ ne 'NA'
689 0 25 if $self->{'_debug3'}
694 0 82 if $self->{'_debug3'}
696 68 14 if (@features_and_values_or_thresholds_on_branch) { }
705 0 82 if $self->{'_debug3'}
708 25 0 if ($entropy < $existing_node_entropy)
716 18 54 if (not defined $best_feature_name) { }
720 13 41 if ($entropy_values_for_different_features{$feature_nom} < $min_entropy_for_best_feature)
727 18 0 if (exists $partitioning_point_threshold{$best_feature_name}) { }
735 0 18 if (exists $self->{'_numeric_features_valuerange_hash'}{$best_feature_name} and $self->{'_feature_values_how_many_uniques_hash'}{$best_feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'}) { }
743 18 0 if (exists $partitioning_point_threshold{$best_feature_name}) { }
749 0 18 if $self->{'_debug3'}
759 0 1 if exists $self->{'_entropy_cache'}{'priors'}
764 2 0 if $prob >= 0.0001 and $prob <= 0.999
765 0 2 if $prob < 0.0001
766 0 2 if $prob > 0.999
767 1 1 unless (defined $entropy)
806 0 0 if exists $self->{'_entropy_cache'}{$sequence}
815 0 0 if ($prob >= 0.0001 and $prob <= 0.999) { }
0 0 elsif ($prob < 0.0001) { }
0 0 elsif ($prob > 0.999) { }
826 0 0 if (abs $entropy < 1e-07)
842 0 0 if exists $self->{'_entropy_cache'}{$sequence}
851 0 0 if ($prob >= 0.0001 and $prob <= 0.999) { }
0 0 elsif ($prob < 0.0001) { }
0 0 elsif ($prob > 0.999) { }
862 0 0 if (abs $entropy < 1e-07)
874 40 82 if exists $self->{'_entropy_cache'}{$sequence}
880 138 26 if ($prob >= 0.0001 and $prob <= 0.999) { }
13 13 elsif ($prob < 0.0001) { }
13 0 elsif ($prob > 0.999) { }
891 13 69 if (abs $entropy < 1e-07)
906 4 0 if exists $self->{'_probability_cache'}{$class_name_in_cache}
920 0 1 if scalar keys %{$$self{'_class_priors_hash'};} > 1
931 0 1 if ($self->{'_debug1'})
943 0 4 if ($self->{'_debug2'})
944 0 0 if (exists $self->{'_prob_distribution_numeric_features_hash'}{$feature}) { }
968 0 190 if defined $value and $value =~ /^\d+$/
969 0 186 if (defined $value and exists $self->{'_sampling_points_for_numeric_feature_hash'}{$feature_name})
974 186 4 if (defined $value)
977 186 0 if (defined $value and exists $self->{'_probability_cache'}{$feature_and_value})
981 0 4 if (exists $self->{'_numeric_features_valuerange_hash'}{$feature_name})
982 0 0 if ($self->{'_feature_values_how_many_uniques_hash'}{$feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'})
984 0 0 unless (exists $self->{'_sampling_points_for_numeric_feature_hash'}{$feature_name})
988 0 0 if $_ ne 'NA' and not $seen{$_}++
994 0 0 if ($histogram_delta < $diffrange / 500)
995 0 0 if (defined $self->{'_number_of_histogram_bins'}) { }
1011 0 4 if (exists $self->{'_numeric_features_valuerange_hash'}{$feature_name}) { }
1012 0 0 if ($self->{'_feature_values_how_many_uniques_hash'}{$feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'}) { }
1021 0 0 if (abs $sampling_points_for_feature[$i] - $actual_values_for_feature[$j] < $histogram_delta)
1039 0 0 if (defined $value and exists $self->{'_probability_cache'}{$feature_and_value}) { }
1046 0 0 if $_ ne 'NA' and not $seen{$_}++
1055 0 0 if $values_for_feature[$i] eq $current_value
1061 0 0 if $total_counts == 0
1067 0 0 if (defined $value and exists $self->{'_probability_cache'}{$feature_and_value}) { }
1083 1526 18074 if $values_for_feature[$i] eq $current_value
1091 0 4 if (defined $value and exists $self->{'_probability_cache'}{$feature_and_value}) { }
1104 0 380 if defined $feature_value and $feature_value =~ /^\d+$/
1105 0 380 if (defined $feature_value and exists $self->{'_sampling_points_for_numeric_feature_hash'}{$feature_name})
1110 380 0 if (defined $feature_value)
1113 372 8 if (defined $feature_value and exists $self->{'_probability_cache'}{$feature_value_class})
1115 0 372 if $self->{'_debug2'}
1120 0 8 if (exists $self->{'_numeric_features_valuerange_hash'}{$feature_name})
1121 0 0 if ($self->{'_feature_values_how_many_uniques_hash'}{$feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'})
1132 140 140 if ($self->{'_samples_class_label_hash'}{$sample_name} eq $class_name)
1136 0 8 if (exists $self->{'_numeric_features_valuerange_hash'}{$feature_name}) { }
1137 0 0 if ($self->{'_feature_values_how_many_uniques_hash'}{$feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'}) { }
1148 0 0 if ($feature eq $feature_name and $value ne 'NA')
1155 0 0 if (abs $sampling_points_for_feature[$i] - $actual_feature_values_for_samples_in_class[$j] < $histogram_delta)
1163 0 0 if $total_counts == 0
1171 0 0 if (exists $self->{'_probability_cache'}{$feature_value_class}) { }
1179 0 0 if $_ ne 'NA' and not $seen{$_}++
1187 0 0 if $values_for_feature[$i] eq $current_value
1193 0 0 if $total_counts == 0
1201 0 0 if (exists $self->{'_probability_cache'}{$feature_value_class}) { }
1211 28 252 if $_ ne 'NA' and not $seen{$_}++
1219 140 1820 if $values_for_feature[$i] eq $current_value
1225 0 8 if $total_counts == 0
1233 8 0 if (exists $self->{'_probability_cache'}{$feature_value_class}) { }
1247 0 0 if exists $self->{'_probability_cache'}{$feature_threshold_combo}
1248 0 0 if $_ ne 'NA'
1249 0 0 if $_ <= $threshold
1262 0 0 if exists $self->{'_probability_cache'}{$feature_threshold_class_combo}
1267 0 0 if $self->{'_samples_class_label_hash'}{$sample_name} eq $class_name
1275 0 0 if $feature eq $feature_name and $value ne 'NA'
1279 0 0 if $_ <= $threshold
1281 0 0 @actual_feature_values_for_samples_in_class > 0 ? :
1292 0 233 if scalar @array_of_features_and_values_or_thresholds == 0
1294 165 68 if exists $self->{'_probability_cache'}{$sequence}
1304 0 186 if ($item =~ /$pattern2/) { }
0 186 elsif ($item =~ /$pattern3/) { }
1320 0 0 if not $seen1{$_}++
1322 186 0 if not $seen2{$_}++
1325 0 68 if $self->{'_debug2'}
1335 0 0 if ($feature_grouping->[1] eq '>') { }
1343 0 0 if (defined $lowerbound{$feature_name} and defined $upperbound{$feature_name} and $upperbound{$feature_name} <= $lowerbound{$feature_name}) { }
0 0 elsif (defined $lowerbound{$feature_name} and defined $upperbound{$feature_name}) { }
0 0 elsif (defined $upperbound{$feature_name} and not defined $lowerbound{$feature_name}) { }
0 0 elsif (defined $lowerbound{$feature_name} and not defined $upperbound{$feature_name}) { }
1347 0 0 if (not $probability) { }
1357 0 0 if (not $probability) { }
1365 0 0 if (not $probability) { }
1377 186 0 if ($feature_and_value =~ /$pattern1/)
1379 68 118 if (not $probability) { }
1397 0 164 if scalar @array_of_features_and_values_or_thresholds == 0
1401 20 144 if exists $self->{'_probability_cache'}{$sequence_with_class}
1411 0 380 if ($item =~ /$pattern2/) { }
0 380 elsif ($item =~ /$pattern3/) { }
1427 0 0 if not $seen1{$_}++
1429 380 0 if not $seen2{$_}++
1432 0 144 if $self->{'_debug2'}
1442 0 0 if ($feature_grouping->[1] eq '>') { }
1450 0 0 if ($lowerbound{$feature_name} and $upperbound{$feature_name} and $upperbound{$feature_name} <= $lowerbound{$feature_name}) { }
0 0 elsif (defined $lowerbound{$feature_name} and defined $upperbound{$feature_name}) { }
0 0 elsif (defined $upperbound{$feature_name} and not defined $lowerbound{$feature_name}) { }
0 0 elsif (defined $lowerbound{$feature_name} and not defined $upperbound{$feature_name}) { }
1454 0 0 if (not $probability) { }
1467 0 0 if (not $probability) { }
1475 0 0 if (not $probability) { }
1487 380 0 if ($feature_and_value =~ /$pattern1/)
1489 144 236 if (not $probability) { }
1508 162 82 if exists $self->{'_probability_cache'}{$class_and_sequence}
1514 13 151 if ($prob < 1e-06)
1524 151 0 if ($prob_of_feature_sequence) { }
1532 0 82 if ($sum_probability == 0) { }
1561 0 230 if $self->{'_debug2'}
1566 0 0 if @$x > 0 and $x->[0] eq $feature_name
1568 0 920 if @temp > 0
1570 0 230 if $self->{'_debug2'}
1577 0 230 if $self->{'_debug2'}
1583 0 0 if ($inner->[1] eq '<') { }
1589 0 0 if (@temp1 > 0 and @temp2 > 0) { }
0 0 elsif (@temp1 > 0) { }
1597 0 230 if $self->{'_debug2'}
1607 0 230 if $self->{'_debug2'}
1612 0 0 if ($alist->[0][1] eq '<') { }
1617 0 0 if ($alist->[0][1] ne $alist->[-1][1])
1623 0 230 if $self->{'_debug2'}
1638 0 0 unless defined $feature and defined $value
1639 0 0 unless contained_in($feature, @{$$self{'_feature_names'};})
1656 0 0 unless contained_in($feature, keys %{$$self{'_numeric_features_valuerange_hash'};})
1659 0 0 unless @values
1670 0 0 if ($estimated_number_of_nodes > 10000)
1682 0 0 unless $answer =~ /y(es)?/i
1692 0 1 unless $self->{'_training_datafile'} =~ /\.csv$/
1702 0 36 if /^[ ]*\r?\n?$/
1704 0 36 $self->{'_csv_cleanup_needed'} ? :
1705 1 35 if ($record_index == 0)
1717 0 35 if $record_index % 10000 == 0
1723 0 1 if $self->{'_debug1'}
1730 0 140 $data_hash{$sampleID}[$_ - 1] =~ /^\d+$/ ? :
1731 0 140 $b =~ /^\d+$/ ? :
1738 14 126 if $_ ne 'NA' and not $seen1{$_}++
1742 14 0 if not $_ =~ /^$numregex$/
1743 0 4 if ($not_all_values_float == 0)
1749 0 1 if ($self->{'_debug1'})
1826 0 0 if $value eq $array[$i]
1847 0 0 if (not defined $min or $arr->[$i] < $min)
1860 0 0 if (not defined $min or $arr->[$i] < $min)
1863 0 0 if (not defined $max or $arr->[$i] > $max)
1875 94 282 if $ele eq $_
1883 15 121 if scalar @$ref_in == 0
1908 3 7 if ($param eq $legal)
1913 0 3 if $found_match_flag == 0
1930 0 0 if (ref $item) { }
1991 0 0 unless $self->{'_training_datafile'} =~ /\.csv$/
2040 0 0 if $value ne 'NA'
2045 0 0 if $_ ne 'NA' and not $seen{$_}++
2047 0 0 if (Algorithm::DecisionTree::contained_in($feature, keys %{$$self{'_numeric_features_valuerange_hash'};})) { }
2060 0 0 if ($evaldebug)
2079 0 0 if $evaldebug
2083 0 0 if $evaldebug
2086 0 0 if $evaldebug
2087 0 0 if $_ and not $_ =~ /=NA$/
2088 0 0 if $evaldebug
2095 0 0 if ($evaldebug)
2108 0 0 if $evaldebug
2130 0 0 if ($row_class_name eq $col_class_name) { }
2139 0 0 if ($data_quality_index <= 80) { }
0 0 elsif ($data_quality_index > 80 and $data_quality_index <= 90) { }
0 0 elsif ($data_quality_index > 90 and $data_quality_index <= 95) { }
0 0 elsif ($data_quality_index > 95 and $data_quality_index <= 98) { }
2176 25 1 unless defined $root_or_not
2177 1 25 if ($root_or_not eq 'root')
2289 0 0 if (@{$self->get_children;} > 0) { }
2341 0 0 if check_for_illegal_params3(@params) == 0
2377 0 0 if ($param eq $legal)
2382 0 0 if $found_match_flag == 0
2411 0 0 if ($self->{'_debug'})
2427 0 0 if ($self->{'_debug'})
2452 0 0 if ($self->{'_debug'})
2458 0 0 if ($x eq 'mean') { }
2461 0 0 if ($x eq 'covariance')
2502 0 0 if ($self->{'_debug'})
2533 0 0 if ($self->{'_debug'})
2590 0 1 if check_for_illegal_params4(@params) == 0
2620 3 3 if ($param eq $legal)
2625 0 3 if $found_match_flag == 0
2639 0 1 unless defined $input_parameter_file
2651 3 0 if defined $_
2653 3 0 if defined $_
2658 9 0 if defined $_
2660 4 4 if $item =~ /feature/
2662 27 0 if defined $_
2664 4 18 if ($i == 0) { }
2667 4 14 if $splits[$i] =~ /values/
2675 5 0 if defined $_
2677 2 2 if $item =~ /bias/
2679 18 0 if defined $_
2682 2 14 if ($i == 0) { }
8 6 elsif ($splits[$i] =~ /(^.+)[:]$/) { }
2688 0 6 unless defined $feature_name
2689 6 0 if defined $feature_name
2695 0 1 if ($debug)
2732 0 1 if ($self->{'_debug'})
2748 35 11 if ($roll_the_dice >= $v->[0] and $roll_the_dice <= $v->[1])
2759 35 105 unless defined $bias_string
2766 280 0 if defined $_
2769 140 350 if ($values[$i] eq $chosen_for_bias_value) { }
2783 140 172 if ($roll_the_dice >= $v->[0] and $roll_the_dice <= $v->[1])
2791 0 140 if ($self->{'_debug'})
2804 0 1 if ($self->{'_debug'})
2811 0 1 if $self->{'_debug'}
2891 0 0 unless ref $dt eq 'Algorithm::DecisionTree'
2908 0 0 unless $self->{'_root_dtnode'}
2917 0 0 if $self->{'_debug'}
2923 0 0 if (not @samples_at_node) { }
2928 0 0 if Algorithm::DecisionTree::contained_in($sample, @$samples_for_feature_value_combo)
2932 0 0 unless @samples_at_node
2935 0 0 if $self->{'_debug'}
2937 0 0 if (@samples_at_node)
2939 0 0 if (not exists $self->{'_sample_to_node_mapping_direct_hash'}{$sample}) { }
2955 0 0 unless $self->{'_root_dtnode'}
2964 0 0 if (exists $self->{'_samples_at_nodes_hash'}{$node_serial_number})
2965 0 0 if $self->{'_debug'}
2974 0 0 if (exists $self->{'_sample_to_node_mapping_direct_hash'}{$sample})
2992 0 0 if (@children_affected)
3003 0 0 if ($op eq '=') { }
0 0 elsif ($op eq '<') { }
0 0 elsif ($op eq '>') { }
3010 0 0 if ($val_data ne 'NA' and $feature eq $feature_data and $val_data <= $value)
3021 0 0 if ($val_data ne 'NA' and $feature eq $feature_data and $val_data > $value)
3040 0 0 if ($feature_value_combo =~ /$pattern2/) { }
0 0 elsif ($feature_value_combo =~ /$pattern3/) { }
0 0 elsif ($feature_value_combo =~ /$pattern1/) { }
3054 0 0 unless $self->{'_samples_at_nodes_hash'}
3062 0 0 unless $ans =~ /^ye?s?$/
3071 0 0 if $ans =~ /^exit$/
3072 0 0 if Algorithm::DecisionTree::contained_in($ans, keys %{$$self{'_samples_at_nodes_hash'};})
3084 0 0 unless $self->{'_samples_at_nodes_hash'}
3085 0 0 unless (exists $self->{'_samples_at_nodes_hash'}{$node_id})
3089 0 0 unless ($self->{'_awareness_raising_msg_shown'})
3097 0 0 unless $ans =~ /^ye?s?$/
3105 0 0 @samples_at_node == 0 ? :
3114 0 0 if ($ans =~ /^ye?s?$/)
3124 0 0 if ($ans =~ /^ye?s?$/) { }