Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions datasets/daphnet.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

PATH = config.get_data_path("DAPHNET")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None, verbose=False, number=-1):
Expand Down Expand Up @@ -104,6 +104,8 @@ def load_data(db_path, record_ids=None, verbose=False, number=-1):
class Dataset(BaseDataset):
name = "DAPHNET"

requirements = ["pip:pooch"]

parameters = {
# "recordings_id": [["S01R02E0"]],
"recordings_id": [None], # [["S01R02E0"]],
Expand All @@ -118,11 +120,13 @@ class Dataset(BaseDataset):
def get_data(self):
"""Load the DAPHNET dataset."""

path = fetch_tsb_uad("DAPHNET")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
if self.recordings_id in (["all"], "all"):
self.recordings_id = None
X, y_true = load_data(PATH, self.recordings_id, number=self.number)
X, y_true = load_data(path, self.recordings_id, number=self.number)

X_test = X.copy()
y_test = y_true.copy()
Expand Down
10 changes: 7 additions & 3 deletions datasets/ecg.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("ECG")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None, verbose=False, number=-1):
Expand Down Expand Up @@ -95,6 +95,8 @@ def load_data(db_path, record_ids=None, verbose=False, number=-1):
class Dataset(BaseDataset):
name = "ECG"

requirements = ["pip:pooch"]

parameters = {
"recordings_id": [["1", "2"]],
"debug": [False],
Expand All @@ -103,11 +105,13 @@ class Dataset(BaseDataset):

def get_data(self):
"""Load the MITDB dataset."""
path = fetch_tsb_uad("ECG")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
if self.recordings_id in (["all"], "all"):
self.recordings_id = None
X, y_true = load_data(PATH, self.recordings_id, number=self.number)
X, y_true = load_data(path, self.recordings_id, number=self.number)

X_test = X.copy()
y_test = y_true.copy()
Expand Down
10 changes: 7 additions & 3 deletions datasets/genesis.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("GENESIS")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None, verbose=False):
Expand Down Expand Up @@ -91,6 +91,8 @@ def load_data(db_path, record_ids=None, verbose=False):
class Dataset(BaseDataset):
name = "GENESIS"

requirements = ["pip:pooch"]

parameters = {
"recordings_id": [["1", "2"]],
"debug": [False],
Expand All @@ -99,9 +101,11 @@ class Dataset(BaseDataset):
def get_data(self):
"""Load the GENESIS dataset."""

path = fetch_tsb_uad("GENESIS")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
X, y_true = load_data(PATH, self.recordings_id)
X, y_true = load_data(path, self.recordings_id)

X_test = X.copy()
y_test = y_true.copy()
Expand Down
10 changes: 7 additions & 3 deletions datasets/ghl.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("GHL")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None, verbose=False):
Expand Down Expand Up @@ -95,6 +95,8 @@ def load_data(db_path, record_ids=None, verbose=False):
class Dataset(BaseDataset):
name = "GHL"

requirements = ["pip:pooch"]

parameters = {
"recordings_id": [["1", "2"]],
"debug": [False],
Expand All @@ -103,9 +105,11 @@ class Dataset(BaseDataset):
def get_data(self):
"""Load the GHL dataset."""

path = fetch_tsb_uad("GHL")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
X, y_true = load_data(PATH, self.recordings_id)
X, y_true = load_data(path, self.recordings_id)

X_test = X.copy()
y_test = y_true.copy()
Expand Down
11 changes: 7 additions & 4 deletions datasets/iops.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("IOPS")
PATH = "/data/parietal/store2/data/tsb-uad/TSB-UAD-Public/IOPS/"
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, verbose=False):
Expand Down Expand Up @@ -110,16 +109,20 @@ def load_data(db_path, verbose=False):
class Dataset(BaseDataset):
name = "IOPS"

requirements = ["pip:pooch"]

parameters = {
"debug": [False],
}

def get_data(self):
"""Load the IOPS dataset."""

path = fetch_tsb_uad("IOPS")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
X_train, X_test, y_test = load_data(PATH)
X_train, X_test, y_test = load_data(path)

if self.debug:
X_train = X_train[:, :1000]
Expand Down
10 changes: 7 additions & 3 deletions datasets/kdd21.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("KDD21")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None, verbose=False):
Expand Down Expand Up @@ -89,6 +89,8 @@ def load_data(db_path, record_ids=None, verbose=False):
class Dataset(BaseDataset):
name = "KDD21"

requirements = ["pip:pooch"]

parameters = {
"recordings_id": [["1", "2"]],
"debug": [False],
Expand All @@ -97,9 +99,11 @@ class Dataset(BaseDataset):
def get_data(self):
"""Load the KDD21 dataset."""

path = fetch_tsb_uad("KDD21")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
X, y_true = load_data(PATH, self.recordings_id)
X, y_true = load_data(path, self.recordings_id)

X_test = X.copy()
y_test = y_true.copy()
Expand Down
10 changes: 7 additions & 3 deletions datasets/mgab.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("MGAB")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None, verbose=False):
Expand Down Expand Up @@ -86,6 +86,8 @@ def load_data(db_path, record_ids=None, verbose=False):
class Dataset(BaseDataset):
name = "MGAB"

requirements = ["pip:pooch"]

parameters = {
"recordings_id": [["1", "2"]],
"debug": [False],
Expand All @@ -94,9 +96,11 @@ class Dataset(BaseDataset):
def get_data(self):
"""Load the MITDB dataset."""

path = fetch_tsb_uad("MGAB")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
X, y_true = load_data(PATH, self.recordings_id)
X, y_true = load_data(path, self.recordings_id)
n_recordings, _ = X.shape

X_test = X.copy()
Expand Down
10 changes: 7 additions & 3 deletions datasets/occupancy.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("OCCUPANCY")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None, verbose=False):
Expand Down Expand Up @@ -111,6 +111,8 @@ def load_data(db_path, record_ids=None, verbose=False):
class Dataset(BaseDataset):
name = "OCCUPANCY"

requirements = ["pip:pooch"]

parameters = {
"recordings_id": [None],
"debug": [False],
Expand All @@ -119,9 +121,11 @@ class Dataset(BaseDataset):
def get_data(self):
"""Load the OCCUPANCY dataset."""

path = fetch_tsb_uad("OCCUPANCY")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
X_train, X_test, y_test = load_data(PATH, self.recordings_id)
X_train, X_test, y_test = load_data(path, self.recordings_id)

if self.debug:
X_train = X_train[:, :1000]
Expand Down
10 changes: 7 additions & 3 deletions datasets/opportunity.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("OPPORTUNITY")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None, verbose=False):
Expand Down Expand Up @@ -91,6 +91,8 @@ def load_data(db_path, record_ids=None, verbose=False):
class Dataset(BaseDataset):
name = "OPPORTUNITY"

requirements = ["pip:pooch"]

parameters = {
"recordings_id": [["1", "2"]],
"debug": [False],
Expand All @@ -99,9 +101,11 @@ class Dataset(BaseDataset):
def get_data(self):
"""Load the OPPORTUNITY dataset."""

path = fetch_tsb_uad("OPPORTUNITY")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
X, y_true = load_data(PATH, self.recordings_id)
X, y_true = load_data(path, self.recordings_id)

X_test = X.copy()
y_test = y_true.copy()
Expand Down
10 changes: 7 additions & 3 deletions datasets/sensorscope.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("SENSORSCOPE")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None, verbose=False):
Expand Down Expand Up @@ -90,6 +90,8 @@ def load_data(db_path, record_ids=None, verbose=False):
class Dataset(BaseDataset):
name = "SENSORSCOPE"

requirements = ["pip:pooch"]

parameters = {
"recordings_id": [["10", "11"]],
"debug": [False],
Expand All @@ -98,9 +100,11 @@ class Dataset(BaseDataset):
def get_data(self):
"""Load the SENSORSCOPE dataset."""

path = fetch_tsb_uad("SENSORSCOPE")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
X, y_true = load_data(PATH, self.recordings_id)
X, y_true = load_data(path, self.recordings_id)

X_test = X.copy()
y_test = y_true.copy()
Expand Down
10 changes: 7 additions & 3 deletions datasets/smd.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from benchopt import BaseDataset, config
from benchopt import BaseDataset

from pathlib import Path
import numpy as np
import pandas as pd

PATH = config.get_data_path("SMD")
from benchmark_utils.download import fetch_tsb_uad


def load_data(db_path, record_ids=None):
Expand Down Expand Up @@ -94,6 +94,8 @@ def load_data(db_path, record_ids=None):
class Dataset(BaseDataset):
name = "SMD"

requirements = ["pip:pooch"]

parameters = {
"recordings_id": [["1", "2"]],
"debug": [False],
Expand All @@ -102,9 +104,11 @@ class Dataset(BaseDataset):
def get_data(self):
"""Load the SMD dataset."""

path = fetch_tsb_uad("SMD")

# X shape (n_recordings, n_samples)
# y shape (n_recordings, n_samples)
X, y_true = load_data(PATH, self.recordings_id)
X, y_true = load_data(path, self.recordings_id)

X_test = X.copy()
y_test = y_true.copy()
Expand Down
Loading
Loading