Skip to content
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

[DOC] ESAD example from documentation failing #32

Open
leona opened this issue Sep 6, 2022 · 1 comment
Open

[DOC] ESAD example from documentation failing #32

leona opened this issue Sep 6, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@leona
Copy link

leona commented Sep 6, 2022

Describe the bug

When running the ESADDetector example from the documentation here https://outlierdetectionjl.github.io/OutlierDetection.jl/dev/API/detectors/#esaddetector

Specifically

using OutlierDetection: ESADDetector, fit, score
detector = ESADDetector()
X = rand(10, 100)
y = rand([-1,1], 100)
model = fit(detector, X, y)
train_scores, test_scores = score(detector, model, X)

I receive multiple errors. First, that score does not exist in OutlierDetection, then verbosity is not set on fit. I can resolve those errors, but I'm unable to resolve this

ERROR: DomainError with Supervised detectors can only be fitted with array
inputs with one observation per last dimension, found X=Matrix{Float64}, y=Vector{Int64}:

Stacktrace:
 [1] fit(::DSADDetector, X::Matrix{Float64}, y::Vector{Int64}; verbosity::Int64)
   @ OutlierDetectionInterface ~/.julia/packages/OutlierDetectionInterface/8U8oT/src/base.jl:137
 [2] top-level scope
   @ REPL[34]:1
 [3] top-level scope
   @ ~/.julia/packages/CUDA/DfvRa/src/initialization.jl:52

Versions

[v0.3.2](https://github.com/OutlierDetectionJL/OutlierDetection.jl/releases/tag/v0.3.2)
@leona leona added the bug Something isn't working label Sep 6, 2022
@davnn
Copy link
Member

davnn commented Sep 7, 2022

Hey, it appears that you have discovered some (very) outdated docs. Have a look at the following code snippet

using OutlierDetection: fit, transform, to_categorical
using OutlierDetectionNetworks: AEDetector, ESADDetector
using OutlierDetectionNetworks.Templates: MLPAutoEncoder

n_samples, n_features = 100, 10
encoder, decoder = MLPAutoEncoder(n_features, 5, [50, 20]; bias=false);
detector = ESADDetector(encoder=encoder, decoder=decoder)
X = rand(n_features, n_samples)
y = to_categorical(rand(["normal", "outlier"], n_samples))
model, scores_train = fit(detector, X, y; verbosity=0)
scores_test = transform(detector, model, X)

Would be happy to accept a pull request fixing the docs.

@davnn davnn changed the title [BUG] ESAD example from documentation failing [DOCS] ESAD example from documentation failing Sep 7, 2022
@davnn davnn changed the title [DOCS] ESAD example from documentation failing [DOC] ESAD example from documentation failing Sep 7, 2022
@davnn davnn added documentation Improvements or additions to documentation and removed bug Something isn't working labels Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants