-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in env$X[idx, ] : incorrect number of dimensions #19
Comments
Try it with more than one column. It's probably dropping to a vector when
it indices the data frame rows.
…On Wed, Oct 10, 2018, 3:44 PM Michael ***@***.***> wrote:
I'm getting an error with iForest that I don't understand:
# test dataset
test = data.frame(VALUE = rlnorm(200))
iForest(test, 100, 50)
## Error in env$X[idx, ] : incorrect number of dimensions
iForest(as.matrix(test), 100, 50)
## Error in env$X[idx, ] : incorrect number of dimensions
iForest(as_tibble(test), 100, 50)
## Isolation Forest with 100 Trees and Max Depth of 6
Why does iForest work with a tibble, but not with a regular data.frame or
list?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABmRXbpux2S6hitZ0rm_cTLtsqf3iWF4ks5ujlw-gaJpZM4XWSuj>
.
|
Yes, the function works when there is more than one column, but my data is univariate. Do isolation forests not work on univariate data? I am new to this method. |
It's an issue of dropping dimensions when indexing a data.frame with one column. The second dimension gets dropped. I'll try to patch it tomorrow. It's an easy fix. |
I pushed a fix to this branch: https://github.com/Zelazny7/isofor/tree/fix-single-column-data-frame Can you test it and let me know if it solves your problem? I was able to train an isolation forest on a data.frame with one column. |
@Zelazny7 it now works with vectors, data.frames, and matrices, but fails on tibbles:
|
I'm getting an error with
iForest
that I don't understand:Why does
iForest
work with atibble
, but not with a regular data.frame or list?The text was updated successfully, but these errors were encountered: