Skip to content

Possible issue for IsolationForest Division by zero #353

@indianalalal

Description

@indianalalal

Hello,

I'm trying to use IsolationForest.

$dataset =  new CSV('test.csv', false);
$dataset = Unlabeled::fromIterator($dataset);

$oneHotEncoder = new OneHotEncoder();
$dataset->apply($oneHotEncoder);

$estimator = new IsolationForest(2, 0.1, 0.5); 
$estimator->train($dataset);

There is an exemple of the csv content. In reality I have more than 1000 lines

1,1,46,3,1
1,1,58,6,3
2,5,52,3,1
1,11,52,3,3
2,11,52,6,3
3,1,46,3,1
3,1,58,6,3
3,11,52,3,3

And I have this issue

In IsolationForest.php line 311:
Division by zero  

Is there a problem with the code or with my data?
Thx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions