Skip to content

Commit

Permalink
Reverted to manually checking data in swat
Browse files Browse the repository at this point in the history
  • Loading branch information
Jad-yehya committed Nov 21, 2024
1 parent c9c192e commit 8c71b23
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions datasets/swat.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
from benchopt import BaseDataset, safe_import_context
from benchopt.config import get_data_path
from benchmark_utils import check_data

with safe_import_context() as import_ctx:
import pandas as pd

# Checking if the data is available
# Temporary : Checks if the data is available for the tests
path = get_data_path(key="SWaT")
check_data(path, "SWaT", "train")
check_data(path, "SWaT", "test")

if (
not (path / "swat_train2.csv").exists()
) or (
not (path / "swat2.csv").exists()
):
raise ImportError(
"Test data not found. Please download the data "
"from the Google Drive "
"https://drive.google.com/drive/folders/"
"1xhcYqh6okRs98QJomFWBKNLw4d1T4Q0w"
f" and place it in {path}"
)


class Dataset(BaseDataset):
Expand All @@ -23,12 +33,29 @@ class Dataset(BaseDataset):
}

def get_data(self):

# To get the data, you need to ask for access to the dataset
# at the following link:
# https://drive.google.com/drive/folders/1xhcYqh6okRs98QJomFWBKNLw4d1T4Q0w

# path = get_data_path(key="SWaT")
path = get_data_path(key="SWaT")

if not (path / "swat_train2.csv").exists():
raise FileNotFoundError(
"Train data not found. Please download the data "
"from the Google Drive "
"https://drive.google.com/drive/folders/"
"1xhcYqh6okRs98QJomFWBKNLw4d1T4Q0w"
f" and place it in {path}"
)

if not (path / "swat2.csv").exists():
raise FileNotFoundError(
"Test data not found. Please download the data "
"from the Google Drive "
"https://drive.google.com/drive/folders/"
"1xhcYqh6okRs98QJomFWBKNLw4d1T4Q0w"
f" and place it in {path}"
)

# Load the data
X_train = pd.read_csv(path / "swat_train2.csv")
Expand Down

0 comments on commit 8c71b23

Please sign in to comment.