Skip to content

Commit

Permalink
apply pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rchan26 committed Nov 24, 2023
1 parent 3f43f7e commit c944883
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions paper-examples/Data.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import os
import pickle
import random
from pathlib import Path

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -65,9 +65,9 @@ def load_pen_digit(self, digit: int = 1):
"""
train_df = pd.read_pickle(DATA_DIR + "pen_digit_train.pkl")
test_df = pd.read_pickle(DATA_DIR + "pen_digit_test.pkl")
self.corpus = train_df[train_df["Digit"] == digit]["Stream"].values
self.test_inlier = test_df[test_df["Digit"] == digit]["Stream"].values
self.test_outlier = test_df[test_df["Digit"] != digit]["Stream"].values
self.corpus = train_df[train_df["Digit"] == digit]["Stream"].to_numpy()
self.test_inlier = test_df[test_df["Digit"] == digit]["Stream"].to_numpy()
self.test_outlier = test_df[test_df["Digit"] != digit]["Stream"].to_numpy()

if self.if_sample:
self.sample()
Expand Down Expand Up @@ -116,9 +116,9 @@ def process_data(data_frame):
np.array(
list(
zip(
data_frame.iloc[i].values[0],
data_frame.iloc[i].values[1],
data_frame.iloc[i].values[2],
data_frame.iloc[i].to_numpy()[0],
data_frame.iloc[i].to_numpy()[1],
data_frame.iloc[i].to_numpy()[2],
)
)
)
Expand All @@ -134,11 +134,11 @@ def sample_data(ais_by_vessel_split, random_state):
random_state=random_state,
)

with open(DATA_DIR + "inlier_mmsis_train.pkl", "rb") as f:
with Path(DATA_DIR + "inlier_mmsis_train.pkl").open("rb") as f:
inlier_mmsis_train = pickle.load(f)
with open(DATA_DIR + "inlier_mmsis_test.pkl", "rb") as f:
with Path(DATA_DIR + "inlier_mmsis_test.pkl").open("rb") as f:
inlier_mmsis_test = pickle.load(f)
with open(DATA_DIR + "outlier_mmsis.pkl", "rb") as f:
with Path(DATA_DIR + "outlier_mmsis.pkl").open("rb") as f:
outlier_mmsis = pickle.load(f)

if thres_distance not in [4000, 8000, 16000, 32000]:
Expand Down Expand Up @@ -197,10 +197,10 @@ def load_ucr_dataset(
raise ValueError(msg, comparisons.index)
DATASET_PATH = DATA_DIR + "Univariate_arff"
datatrain = arff.loadarff(
os.path.join(DATASET_PATH, data_set_name, data_set_name + "_TRAIN.arff")
Path(DATASET_PATH) / data_set_name / (data_set_name + "_TRAIN.arff")
)
datatest = arff.loadarff(
os.path.join(DATASET_PATH, data_set_name, data_set_name + "_TEST.arff")
Path(DATASET_PATH) / data_set_name / (data_set_name + "_TEST.arff")
)
alldata = pd.concat(
[pd.DataFrame(datatrain[0]), pd.DataFrame(datatest[0])], ignore_index=True
Expand Down
2 changes: 1 addition & 1 deletion paper-examples/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3095,7 +3095,7 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 7,
"id": "887c4530-28dd-4df7-b1f5-58c74e40f0eb",
"metadata": {},
"outputs": [
Expand Down

0 comments on commit c944883

Please sign in to comment.