Minqi824 / ADBench

Official Implement of "ADBench: Anomaly Detection Benchmark", NeurIPS 2022.
BSD 2-Clause "Simplified" License
872 stars 136 forks source link

Error in model fitting #21

Open albertoHdzE opened 1 year ago

albertoHdzE commented 1 year ago

Hello guys! Super amazing job! Thank you. I have tried first examples, but some don´t run well, could you help me please? thank you so much.

CODE:

# customized model on ADBench's datasets
from adbench.run import RunPipeline
from adbench.baseline.Customized.run import Customized

# notice that you should specify the corresponding category of your customized AD algorithm
# for example, here we use Logistic Regression as customized clf, which belongs to the supervised algorithm
# for your own algorithm, you can realize the same usage as other baselines by modifying the fit.py, model.py, and run.py files in the adbench/baseline/Customized
pipeline = RunPipeline(suffix='ADBench', parallel='supervise', realistic_synthetic_mode=None, noise_type=None)
results = pipeline.run(clf=Customized)

# customized model on customized dataset
import numpy as np
dataset = {}
dataset['X'] = np.random.randn(1000, 20)
dataset['y'] = np.random.choice([0, 1], 1000)
results = pipeline.run(dataset=dataset, clf=Customized)
print(results)

KIND OF REPETITIVE OUTPUT:

generating duplicate samples for dataset 39_vertebral...
current noise type: None
{'Samples': 1000, 'Features': 6, 'Anomalies': 138, 'Anomalies Ratio(%)': 13.8}
Error in model fitting. Model:Customized, Error: scikit-learn estimators should always specify their parameters in the signature of their __init__ (no varargs). <class 'adbench.baseline.Customized.model.LR'> with constructor (self, *args, **kwargs) doesn't  follow this convention.
Current experiment parameters: ('39_vertebral', 1.0, 2), model: Customized, metrics: {'aucroc': nan, 'aucpr': nan}, fitting time: None, inference time: None

python 3.10.11 pyod = 1.0.0 MAC M2, Ventura 13

I FOUND THAT probably has to do with how parameters are feed, but i really dont think this could be the solution in t his ca se https://stackoverflow.com/questions/40025406/inherit-from-scikit-learns-lassocv-model

Thank you again for your help