generated from benchopt/template_benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
318 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from benchopt import BaseDataset | ||
from benchopt import safe_import_context | ||
|
||
with safe_import_context() as import_ctx: | ||
import os | ||
import pandas as pd | ||
|
||
|
||
class Dataset(BaseDataset): | ||
name = "SMAP" | ||
|
||
install_cmd = "conda" | ||
requirements = ["pandas"] | ||
|
||
def get_data(self): | ||
|
||
path = "/storage/store/work/jyehya/Benchmarks/processing/processed/SMAP" | ||
dataset = "SMAP" | ||
|
||
X_train = pd.read_pickle(os.path.join(path, dataset + "_train.pkl")) | ||
X_test = pd.read_pickle(os.path.join(path, dataset + "_test.pkl")) | ||
y_test = pd.read_pickle(os.path.join(path, dataset + "_test_label.pkl")) | ||
|
||
return dict(X=X_train, y=y_test, X_test=X_test) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Deep Isolation Forest | ||
from benchopt import BaseSolver | ||
from benchopt import safe_import_context | ||
|
||
with safe_import_context() as import_ctx: | ||
from pyod.models.dif import DIF | ||
|
||
|
||
class Solver(BaseSolver): | ||
name = "DIF" | ||
|
||
install_cmd = "conda" | ||
requirements = ["pyod"] | ||
|
||
parameters = { | ||
"contamination": [0.05, 0.1, 0.2], | ||
} | ||
|
||
sampling_strategy = "run_once" | ||
|
||
def set_objective(self, X, y, X_test=None): | ||
# y is y_test, the learning is unsupervised | ||
self.X = X | ||
self.X_test = X_test | ||
self.y = y | ||
|
||
def run(self, _): | ||
clf = DIF(contamination=self.contamination) | ||
clf.fit(self.X) | ||
self.y_hat = clf.predict(self.X_test) | ||
|
||
def get_result(self): | ||
return {"y_hat": self.y_hat} |