Branch Coverage

blib/lib/Algorithm/DecisionTree.pm
Criterion Covered Total %
branch 200 708 28.2


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'} ? :
82 0 0 unless $self->check_names_used(\@features_and_values)
92 0 0 if not $_ =~ /^$numregex$/
93 0 0 if (not contained_in($feature, keys %{$$self{'_prob_distribution_numeric_features_hash'};}) and $not_all_values_float == 0)
100 0 0 if $self->{'_debug3'}
109 0 0 if ($self->{'_debug3'})
117 0 0 if ($item ne 'solution_path') { }
138 0 0 if (@children == 0)
148 0 0 if $self->{'_debug3'}
154 0 0 if $feature_tested_at_node eq $1
157 0 0 unless (defined $value_for_feature)
165 0 0 if ($value_for_feature)
166 0 0 if (contained_in($feature_tested_at_node, keys %{$$self{'_prob_distribution_numeric_features_hash'};})) { }
167 0 0 if $self->{'_debug3'}
173 0 0 if ($last_feature_and_value_on_branch =~ /$pattern1/)
175 0 0 if ($value_for_feature <= $threshold)
183 0 0 if ($last_feature_and_value_on_branch =~ /$pattern2/)
185 0 0 if ($value_for_feature > $threshold)
194 0 0 if $path_found
198 0 0 if $self->{'_debug3'}
201 0 0 if $self->{'_debug3'}
203 0 0 if ($last_feature_and_value_on_branch eq $feature_value_combo)
211 0 0 if $path_found
214 0 0 unless ($path_found)
245 0 0 if ($item ne 'solution_path') { }
269 0 0 if (@children == 0)
286 0 0 if (contained_in($feature_tested_at_node, keys %{$$self{'_prob_distribution_numeric_features_hash'};})) { }
287 0 0 if ($scratchpad_for_numerics{$feature_tested_at_node}) { }
298 0 0 if ($user_value_for_feature >= $valuerange[0] and $user_value_for_feature <= $valuerange[1])
302 0 0 if $answer_found
309 0 0 if ($branch_attribute =~ /$pattern1/)
311 0 0 if ($user_value_for_feature <= $threshold)
319 0 0 if ($branch_attribute =~ /$pattern2/)
321 0 0 if ($user_value_for_feature > $threshold)
330 0 0 if $path_found
340 0 0 if (contained_in($user_value_for_feature, @possible_values_for_feature))
344 0 0 if $answer_found
350 0 0 if ($branch_attribute eq $feature_value_combo)
358 0 0 if $path_found
360 0 0 unless ($path_found)
379 0 1 if ($self->{'_debug3'})
384 0 1 if ($self->{'_debug3'})
389 0 1 if $self->{'_debug3'}
405 0 30 if $self->{'_debug3'}
409 0 30 if ($self->{'_debug3'})
416 1 29 if ($existing_node_entropy < $self->{'_entropy_threshold'})
417 0 1 if $self->{'_debug3'}
424 0 29 if $self->{'_debug3'}
425 0 29 if (defined $self->{'_max_depth_desired'} and @features_and_values_or_thresholds_on_branch >= $self->{'_max_depth_desired'})
427 0 0 if $self->{'_debug3'}
430 0 29 unless defined $best_feature
431 0 29 if ($self->{'_debug3'})
438 0 29 if $self->{'_debug3'}
439 19 10 if ($entropy_gain > $self->{'_entropy_threshold'}) { }
440 0 19 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'}) { }
455 0 0 if ($self->{'_debug3'})
467 0 0 if ($self->{'_debug3'})
471 0 0 if ($best_entropy_for_less < $existing_node_entropy - $self->{'_entropy_threshold'})
478 0 0 if ($best_entropy_for_greater < $existing_node_entropy - $self->{'_entropy_threshold'})
487 0 19 if $self->{'_debug3'}
489 0 19 if $self->{'_debug3'}
494 0 61 if $self->{'_debug3'}
496 4 57 if (not @features_and_values_or_thresholds_on_branch) { }
511 0 61 if ($self->{'_debug3'})
515 29 32 if ($existing_node_entropy - $class_entropy_for_child > $self->{'_entropy_threshold'}) { }
521 0 32 if $self->{'_debug3'}
527 0 10 if $self->{'_debug3'}
553 116 0 unless exists $self->{'_prob_distribution_numeric_features_hash'}{$feature_name}
557 81 0 if $feature_and_value_or_threshold =~ /$pattern1/
561 35 81 unless contained_in($x, @symbolic_features_already_used)
568 0 81 if ($item =~ /$pattern2/) { }
0 81 elsif ($item =~ /$pattern3/) { }
81 0 elsif ($item =~ /$pattern1/) { }
582 0 0 if not $seen{$_}++
584 81 0 if not $seen{$_}++
596 0 0 if ($feature_grouping->[1] eq '>') { }
615 0 116 if $self->{'_debug3'}
616 81 35 if (contained_in($feature_name, @symbolic_features_already_used)) { }
0 35 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'}) { }
622 0 0 if $self->{'_debug3'}
624 0 0 if (contained_in($feature_name, @true_numeric_types_feature_names)) { }
625 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}) { }
631 0 0 if $x > $lowerbound{$feature_name} and $x <= $upperbound{$feature_name}
635 0 0 if $x <= $upperbound{$feature_name}
639 0 0 if $x > $lowerbound{$feature_name}
647 0 0 if @newvalues == 0
654 0 0 if (@features_and_values_or_thresholds_on_branch) { }
676 0 0 if ($min_entropy < $existing_node_entropy)
681 0 35 if $self->{'_debug3'}
682 0 35 if $self->{'_debug3'}
684 110 0 if $_ ne 'NA'
687 0 35 if $self->{'_debug3'}
692 0 110 if $self->{'_debug3'}
694 96 14 if (@features_and_values_or_thresholds_on_branch) { }
703 0 110 if $self->{'_debug3'}
706 35 0 if ($entropy < $existing_node_entropy)
714 29 87 if (not defined $best_feature_name) { }
718 30 57 if ($entropy_values_for_different_features{$feature_nom} < $min_entropy_for_best_feature)
725 29 0 if (exists $partitioning_point_threshold{$best_feature_name}) { }
733 0 29 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'}) { }
741 29 0 if (exists $partitioning_point_threshold{$best_feature_name}) { }
747 0 29 if $self->{'_debug3'}
757 0 1 if exists $self->{'_entropy_cache'}{'priors'}
762 2 0 if $prob >= 0.0001 and $prob <= 0.999
763 0 2 if $prob < 0.0001
764 0 2 if $prob > 0.999
765 1 1 unless (defined $entropy)
804 0 0 if exists $self->{'_entropy_cache'}{$sequence}
813 0 0 if ($prob >= 0.0001 and $prob <= 0.999) { }
0 0 elsif ($prob < 0.0001) { }
0 0 elsif ($prob > 0.999) { }
824 0 0 if (abs $entropy < 1e-07)
840 0 0 if exists $self->{'_entropy_cache'}{$sequence}
849 0 0 if ($prob >= 0.0001 and $prob <= 0.999) { }
0 0 elsif ($prob < 0.0001) { }
0 0 elsif ($prob > 0.999) { }
860 0 0 if (abs $entropy < 1e-07)
872 61 110 if exists $self->{'_entropy_cache'}{$sequence}
878 218 2 if ($prob >= 0.0001 and $prob <= 0.999) { }
1 1 elsif ($prob < 0.0001) { }
1 0 elsif ($prob > 0.999) { }
889 1 109 if (abs $entropy < 1e-07)
904 4 0 if exists $self->{'_probability_cache'}{$class_name_in_cache}
918 0 1 if scalar keys %{$$self{'_class_priors_hash'};} > 1
929 0 1 if ($self->{'_debug1'})
941 0 4 if ($self->{'_debug2'})
942 0 0 if (exists $self->{'_prob_distribution_numeric_features_hash'}{$feature}) { }
966 0 286 if defined $value and $value =~ /^\d+$/
967 0 282 if (defined $value and exists $self->{'_sampling_points_for_numeric_feature_hash'}{$feature_name})
972 282 4 if (defined $value)
975 282 0 if (defined $value and exists $self->{'_probability_cache'}{$feature_and_value})
979 0 4 if (exists $self->{'_numeric_features_valuerange_hash'}{$feature_name})
980 0 0 if ($self->{'_feature_values_how_many_uniques_hash'}{$feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'})
982 0 0 unless (exists $self->{'_sampling_points_for_numeric_feature_hash'}{$feature_name})
986 0 0 if $_ ne 'NA' and not $seen{$_}++
992 0 0 if ($histogram_delta < $diffrange / 500)
993 0 0 if (defined $self->{'_number_of_histogram_bins'}) { }
1009 0 4 if (exists $self->{'_numeric_features_valuerange_hash'}{$feature_name}) { }
1010 0 0 if ($self->{'_feature_values_how_many_uniques_hash'}{$feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'}) { }
1019 0 0 if (abs $sampling_points_for_feature[$i] - $actual_values_for_feature[$j] < $histogram_delta)
1037 0 0 if (defined $value and exists $self->{'_probability_cache'}{$feature_and_value}) { }
1044 0 0 if $_ ne 'NA' and not $seen{$_}++
1053 0 0 if $values_for_feature[$i] eq $current_value
1059 0 0 if $total_counts == 0
1065 0 0 if (defined $value and exists $self->{'_probability_cache'}{$feature_and_value}) { }
1081 1652 17948 if $values_for_feature[$i] eq $current_value
1089 0 4 if (defined $value and exists $self->{'_probability_cache'}{$feature_and_value}) { }
1102 0 572 if defined $feature_value and $feature_value =~ /^\d+$/
1103 0 572 if (defined $feature_value and exists $self->{'_sampling_points_for_numeric_feature_hash'}{$feature_name})
1108 572 0 if (defined $feature_value)
1111 564 8 if (defined $feature_value and exists $self->{'_probability_cache'}{$feature_value_class})
1113 0 564 if $self->{'_debug2'}
1118 0 8 if (exists $self->{'_numeric_features_valuerange_hash'}{$feature_name})
1119 0 0 if ($self->{'_feature_values_how_many_uniques_hash'}{$feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'})
1130 140 140 if ($self->{'_samples_class_label_hash'}{$sample_name} eq $class_name)
1134 0 8 if (exists $self->{'_numeric_features_valuerange_hash'}{$feature_name}) { }
1135 0 0 if ($self->{'_feature_values_how_many_uniques_hash'}{$feature_name} > $self->{'_symbolic_to_numeric_cardinality_threshold'}) { }
1146 0 0 if ($feature eq $feature_name and $value ne 'NA')
1153 0 0 if (abs $sampling_points_for_feature[$i] - $actual_feature_values_for_samples_in_class[$j] < $histogram_delta)
1161 0 0 if $total_counts == 0
1169 0 0 if (exists $self->{'_probability_cache'}{$feature_value_class}) { }
1177 0 0 if $_ ne 'NA' and not $seen{$_}++
1185 0 0 if $values_for_feature[$i] eq $current_value
1191 0 0 if $total_counts == 0
1199 0 0 if (exists $self->{'_probability_cache'}{$feature_value_class}) { }
1209 28 252 if $_ ne 'NA' and not $seen{$_}++
1217 140 1820 if $values_for_feature[$i] eq $current_value
1223 0 8 if $total_counts == 0
1231 8 0 if (exists $self->{'_probability_cache'}{$feature_value_class}) { }
1245 0 0 if exists $self->{'_probability_cache'}{$feature_threshold_combo}
1246 0 0 if $_ ne 'NA'
1247 0 0 if $_ <= $threshold
1260 0 0 if exists $self->{'_probability_cache'}{$feature_threshold_class_combo}
1265 0 0 if $self->{'_samples_class_label_hash'}{$sample_name} eq $class_name
1273 0 0 if $feature eq $feature_name and $value ne 'NA'
1277 0 0 if $_ <= $threshold
1279 0 0 @actual_feature_values_for_samples_in_class > 0 ? :
1290 0 329 if scalar @array_of_features_and_values_or_thresholds == 0
1292 233 96 if exists $self->{'_probability_cache'}{$sequence}
1302 0 282 if ($item =~ /$pattern2/) { }
0 282 elsif ($item =~ /$pattern3/) { }
1318 0 0 if not $seen1{$_}++
1320 282 0 if not $seen2{$_}++
1323 0 96 if $self->{'_debug2'}
1333 0 0 if ($feature_grouping->[1] eq '>') { }
1341 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}) { }
1345 0 0 if (not $probability) { }
1355 0 0 if (not $probability) { }
1363 0 0 if (not $probability) { }
1375 282 0 if ($feature_and_value =~ /$pattern1/)
1377 96 186 if (not $probability) { }
1395 0 220 if scalar @array_of_features_and_values_or_thresholds == 0
1399 20 200 if exists $self->{'_probability_cache'}{$sequence_with_class}
1409 0 572 if ($item =~ /$pattern2/) { }
0 572 elsif ($item =~ /$pattern3/) { }
1425 0 0 if not $seen1{$_}++
1427 572 0 if not $seen2{$_}++
1430 0 200 if $self->{'_debug2'}
1440 0 0 if ($feature_grouping->[1] eq '>') { }
1448 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}) { }
1452 0 0 if (not $probability) { }
1465 0 0 if (not $probability) { }
1473 0 0 if (not $probability) { }
1485 572 0 if ($feature_and_value =~ /$pattern1/)
1487 200 372 if (not $probability) { }
1506 232 110 if exists $self->{'_probability_cache'}{$class_and_sequence}
1512 1 219 if ($prob < 1e-06)
1522 219 0 if ($prob_of_feature_sequence) { }
1530 0 110 if ($sum_probability == 0) { }
1559 0 325 if $self->{'_debug2'}
1564 0 0 if @$x > 0 and $x->[0] eq $feature_name
1566 0 1300 if @temp > 0
1568 0 325 if $self->{'_debug2'}
1575 0 325 if $self->{'_debug2'}
1581 0 0 if ($inner->[1] eq '<') { }
1587 0 0 if (@temp1 > 0 and @temp2 > 0) { }
0 0 elsif (@temp1 > 0) { }
1595 0 325 if $self->{'_debug2'}
1605 0 325 if $self->{'_debug2'}
1610 0 0 if ($alist->[0][1] eq '<') { }
1615 0 0 if ($alist->[0][1] ne $alist->[-1][1])
1621 0 325 if $self->{'_debug2'}
1636 0 0 unless defined $feature and defined $value
1637 0 0 unless contained_in($feature, @{$$self{'_feature_names'};})
1654 0 0 unless contained_in($feature, keys %{$$self{'_numeric_features_valuerange_hash'};})
1657 0 0 unless @values
1668 0 0 if ($estimated_number_of_nodes > 10000)
1680 0 0 unless $answer =~ /y(es)?/i
1690 0 1 unless $self->{'_training_datafile'} =~ /\.csv$/
1700 0 36 if /^[ ]*\r?\n?$/
1703 1 35 if ($record_index == 0)
1715 0 35 if $record_index % 10000 == 0
1721 0 1 if $self->{'_debug1'}
1728 0 140 $data_hash{$sampleID}[$_ - 1] =~ /^\d+$/ ? :
1729 0 140 $b =~ /^\d+$/ ? :
1736 14 126 if $_ ne 'NA' and not $seen1{$_}++
1740 14 0 if not $_ =~ /^$numregex$/
1741 0 4 if ($not_all_values_float == 0)
1747 0 1 if ($self->{'_debug1'})
1824 0 0 if $value eq $array[$i]
1845 0 0 if (not defined $min or $arr->[$i] < $min)
1858 0 0 if (not defined $min or $arr->[$i] < $min)
1861 0 0 if (not defined $max or $arr->[$i] > $max)
1873 162 486 if $ele eq $_
1881 15 181 if scalar @$ref_in == 0
1905 3 7 if ($param eq $legal)
1910 0 3 if $found_match_flag == 0
1927 0 0 if (ref $item) { }
1959 0 0 unless $item =~ /,\s+$/
1996 0 0 unless $self->{'_training_datafile'} =~ /\.csv$/
2045 0 0 if $value ne 'NA'
2050 0 0 if $_ ne 'NA' and not $seen{$_}++
2052 0 0 if (Algorithm::DecisionTree::contained_in($feature, keys %{$$self{'_numeric_features_valuerange_hash'};})) { }
2065 0 0 if ($evaldebug)
2084 0 0 if $evaldebug
2088 0 0 if $evaldebug
2091 0 0 if $evaldebug
2092 0 0 if $_ and not $_ =~ /=NA$/
2093 0 0 if $evaldebug
2100 0 0 if ($evaldebug)
2113 0 0 if $evaldebug
2135 0 0 if ($row_class_name eq $col_class_name) { }
2144 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) { }
2181 29 1 unless defined $root_or_not
2182 1 29 if ($root_or_not eq 'root')
2294 0 0 if (@{$self->get_children;} > 0) { }
2346 0 0 if check_for_illegal_params3(@params) == 0
2382 0 0 if ($param eq $legal)
2387 0 0 if $found_match_flag == 0
2416 0 0 if ($self->{'_debug'})
2432 0 0 if ($self->{'_debug'})
2457 0 0 if ($self->{'_debug'})
2463 0 0 if ($x eq 'mean') { }
2466 0 0 if ($x eq 'covariance')
2507 0 0 if ($self->{'_debug'})
2538 0 0 if ($self->{'_debug'})
2595 0 1 if check_for_illegal_params4(@params) == 0
2625 3 3 if ($param eq $legal)
2630 0 3 if $found_match_flag == 0
2644 0 1 unless defined $input_parameter_file
2656 3 0 if defined $_
2658 3 0 if defined $_
2663 9 0 if defined $_
2665 4 4 if $item =~ /feature/
2667 27 0 if defined $_
2669 4 18 if ($i == 0) { }
2672 4 14 if $splits[$i] =~ /values/
2680 5 0 if defined $_
2682 2 2 if $item =~ /bias/
2684 18 0 if defined $_
2687 2 14 if ($i == 0) { }
8 6 elsif ($splits[$i] =~ /(^.+)[:]$/) { }
2693 0 6 unless defined $feature_name
2694 6 0 if defined $feature_name
2700 0 1 if ($debug)
2737 0 1 if ($self->{'_debug'})
2753 35 14 if ($roll_the_dice >= $v->[0] and $roll_the_dice <= $v->[1])
2764 35 105 unless defined $bias_string
2771 280 0 if defined $_
2774 140 350 if ($values[$i] eq $chosen_for_bias_value) { }
2788 140 159 if ($roll_the_dice >= $v->[0] and $roll_the_dice <= $v->[1])
2796 0 140 if ($self->{'_debug'})
2809 0 1 if ($self->{'_debug'})
2816 0 1 if $self->{'_debug'}
2896 0 0 unless ref $dt eq 'Algorithm::DecisionTree'
2913 0 0 unless $self->{'_root_dtnode'}
2922 0 0 if $self->{'_debug'}
2928 0 0 if (not @samples_at_node) { }
2933 0 0 if Algorithm::DecisionTree::contained_in($sample, @$samples_for_feature_value_combo)
2937 0 0 unless @samples_at_node
2940 0 0 if $self->{'_debug'}
2942 0 0 if (@samples_at_node)
2944 0 0 if (not exists $self->{'_sample_to_node_mapping_direct_hash'}{$sample}) { }
2960 0 0 unless $self->{'_root_dtnode'}
2969 0 0 if (exists $self->{'_samples_at_nodes_hash'}{$node_serial_number})
2970 0 0 if $self->{'_debug'}
2979 0 0 if (exists $self->{'_sample_to_node_mapping_direct_hash'}{$sample})
2997 0 0 if (@children_affected)
3008 0 0 if ($op eq '=') { }
0 0 elsif ($op eq '<') { }
0 0 elsif ($op eq '>') { }
3015 0 0 if ($val_data ne 'NA' and $feature eq $feature_data and $val_data <= $value)
3026 0 0 if ($val_data ne 'NA' and $feature eq $feature_data and $val_data > $value)
3045 0 0 if ($feature_value_combo =~ /$pattern2/) { }
0 0 elsif ($feature_value_combo =~ /$pattern3/) { }
0 0 elsif ($feature_value_combo =~ /$pattern1/) { }
3059 0 0 unless $self->{'_samples_at_nodes_hash'}
3067 0 0 unless $ans =~ /^ye?s?$/
3076 0 0 if $ans =~ /^exit$/
3077 0 0 if Algorithm::DecisionTree::contained_in($ans, keys %{$$self{'_samples_at_nodes_hash'};})
3089 0 0 unless $self->{'_samples_at_nodes_hash'}
3090 0 0 unless (exists $self->{'_samples_at_nodes_hash'}{$node_id})
3094 0 0 unless ($self->{'_awareness_raising_msg_shown'})
3102 0 0 unless $ans =~ /^ye?s?$/
3110 0 0 @samples_at_node == 0 ? :
3119 0 0 if ($ans =~ /^ye?s?$/)
3129 0 0 if ($ans =~ /^ye?s?$/) { }