Branch Coverage

blib/lib/Algorithm/Classifier/IsolationForest/Online.pm
Criterion Covered Total %
branch 177 206 85.9


line true false branch
68 90 0 defined &Algorithm::Classifier::IsolationForest::online_learn_row_xs ? :
272 1 72 unless $growth =~ /\A(?:adaptive|fixed)\z/
276 1 71 unless $missing =~ /\A(?:die|zero)\z/
279 44 27 if (defined $args{'seed'})
285 52 19 exists $args{'window_size'} ? :
293 8 9 $args{'use_c'} && $Algorithm::Classifier::IsolationForest::HAS_C ? :
17 54 defined $args{'use_c'} ? :
297 1 0 $args{'use_openmp'} && $Algorithm::Classifier::IsolationForest::HAS_OPENMP ? :
1 70 defined $args{'use_openmp'} ? :
299 9 62 unless $use_c
328 0 142 if defined $self->{$doc} and ref $self->{$doc}
332 7 64 if defined $self->{'feature_descriptions'}
337 4 66 if (defined $args{'mungers'})
339 0 4 unless ref $args{'mungers'} eq "HASH"
341 1 3 unless ref $self->{'feature_names'} eq "ARRAY" and @{$self->{'feature_names'};}
348 1 68 unless $self->{'n_trees'} >= 1
349 1 67 unless $self->{'max_leaf_samples'} >= 1
351 1 66 if $self->{'window_size'} and $self->{'window_size'} < $self->{'max_leaf_samples'}
353 3 63 unless $self->{'subsample'} > 0 and $self->{'subsample'} <= 1
356 2 61 if defined $self->{'contamination'} and not $self->{'contamination'} > 0 && $self->{'contamination'} <= 0.5
360 44 17 if defined $self->{'seed'}
385 0 262 unless ref $data eq "ARRAY" and @$data
413 1 2 if (ref $row eq "ARRAY")
440 0 35 unless ref $data eq "ARRAY" and @$data
483 0 68 unless ref $data eq "ARRAY"
486 55 13 if ($self->_ensure_c_trees)
535 0 3 unless ref $data eq "ARRAY"
539 2 1 if ($self->_ensure_c_trees)
582 7 0 defined $self->{'threshold'} ? :
9 7 defined $threshold ? :
587 9 7 if ($threshold > 0 and $threshold < 1 and $self->_ensure_c_trees)
602 9 26 $_ >= $threshold ? :
640 2 0 defined $self->{'threshold'} ? :
2 2 defined $threshold ? :
644 3 1 if ($threshold > 0 and $threshold < 1 and $self->_ensure_c_trees)
660 2 3 $_ >= $threshold ? :
698 2 0 defined $self->{'threshold'} ? :
1 2 defined $threshold ? :
702 2 1 if ($threshold > 0 and $threshold < 1 and $self->_ensure_c_trees)
720 2 3 $_ >= $threshold ? :
743 2 7 unless defined $self->{'contamination'}
744 1 6 defined $data ? :
745 1 6 unless ref $rows eq "ARRAY" and @$rows
753 0 6 if $k < 1
754 0 6 if $k > $n_pts
913 2 16 unless ref $payload eq "HASH" and defined $payload->{'format'} and $payload->{'format'} eq "Algorithm::Classifier::IsolationForest::Online"
945 0 16 unless ref $trees eq "ARRAY" and @$trees
1001 0 1 unless ref $self->{'feature_names'} eq "ARRAY" and @{$self->{'feature_names'};}
1008 1 0 if ref $self->{'feature_descriptions'} eq "HASH" and %{$self->{'feature_descriptions'};}
1010 0 1 if ref $self->{'mungers'} eq "HASH" and %{$self->{'mungers'};}
1019 0 1 if defined $self->{'contamination'}
1057 3 94 unless $self->{'seen'} > 0
1065 0 16418 unless ref $row eq "ARRAY" and @$row
1068 48 16370 if (not defined $self->{'n_features'}) { }
2 16368 elsif (scalar @$row != $self->{'n_features'}) { }
1074 15366 1050 if ($self->{'missing'} eq "die")
1076 31767 1 if defined $row->[$f]
1094 5680 105613 if $n < $eta
1102 70435 16482 $self->{'growth'} eq 'adaptive' ? :
1109 1904 102 $self->{'window_size'} ? :
1144 13415 3000 if ($self->{'_use_c'}) { }
1148 12765 650 $self->{'growth'} eq 'adaptive' ? :
1152 2029 44471 if $sub < 1 and rand() >= $sub
1158 15115 1300 if ($self->{'window_size'})
1160 8463 6652 if (@{$self->{'window'};} > $self->{'window_size'})
1162 7003 1460 if ($self->{'_use_c'}) { }
1166 6609 394 $self->{'growth'} eq 'adaptive' ? :
1170 1490 21270 if $sub < 1 and rand() >= $sub
1183 110 44361 if (not defined $tree->{'root'}) { }
1200 0 125393 if (not defined $node->[2]) { }
1210 5904 244882 if $v < $lo->[$f]
1211 6190 244596 if $v > $hi->[$f]
1215 44361 81032 if ($node->[0] == 0)
1216 449 43912 if ($node->[1] >= $self->_split_threshold($depth) and $depth < $limit)
1223 36112 44920 $$x[$node->[4]] < $node->[5] ? :
1234 31372 0 if ($w > 0) { }
1247 898 449 if ($n < $self->_split_threshold($depth) or $depth >= $limit)
1254 1315 14371 if $p->[$attr] < $pmin
1255 1360 14326 if $p->[$attr] > $pmax
1261 7769 7917 if ($p->[$attr] < $split) { }
1278 0 21270 unless defined $tree->{'root'}
1291 21149 41209 if $node->[0] == 0
1292 121 41088 if $node->[1] < $self->_split_threshold($depth)
1294 19952 21136 $$x[$node->[4]] < $node->[5] ? :
1298 41088 0 if (defined $lo)
1309 242 121 if $node->[0] == 0
1313 0 121 unless (defined $lo)
1328 0 41209 unless @boxed
1331 41209 0 if (@boxed == 2)
1334 24674 57744 if $blo->[$f] < $lo->[$f]
1335 61232 21186 if $bhi->[$f] > $hi->[$f]
1344 0 1347 unless @$pts
1349 6522 56222 if $p->[$f] < $lo->[$f]
1350 6522 56222 if $p->[$f] > $hi->[$f]
1367 44692 53534 ($$x[$node->[4]] // 0) < $node->[5] ? :
1380 0 700 unless defined $root
1393 1324 600 if ($self->{'_use_c'})
1404 10480 20 if defined $tree->{'root'}
1448 21 71 unless $self->{'_use_c'}
1449 44 27 if $self->{'_c_nodes'}
1472 0 905 unless defined $root
1480 4066 3161 if ($node->[0] == 0) { }
1516 15 4 if not defined $self->{'contamination'} or defined $self->{'threshold'} or not @{$self->{'window'};}