Skip to content

Commit

Permalink
Do not allow zero local reachability density in LocalOutlierFactor (#335
Browse files Browse the repository at this point in the history
)

See #334
  • Loading branch information
dmnc committed May 23, 2024
1 parent 6e81fdf commit 696a2f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/AnomalyDetectors/LocalOutlierFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ protected function localOutlierFactor(array $sample) : float
{
[$samples, $indices, $distances] = $this->tree->nearest($sample, $this->k);

$lrd = $this->localReachabilityDensity($indices, $distances);
$lrd = $this->localReachabilityDensity($indices, $distances) ?: EPSILON;

$ratios = [];

Expand Down

0 comments on commit 696a2f6

Please sign in to comment.