Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unlabelled ts files #15

Merged
merged 2 commits into from
Jun 15, 2022
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
6 changes: 5 additions & 1 deletion src/datasets/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,12 @@ def load_single(self, filepath):
labels_df = pd.DataFrame(labels.cat.codes, dtype=np.int8) # int8-32 gives an error when using nn.CrossEntropyLoss
else: # e.g. imputation
try:
df, labels = load_data.load_from_tsfile_to_dataframe(filepath, return_separate_X_and_y=True,
data = load_data.load_from_tsfile_to_dataframe(filepath, return_separate_X_and_y=True,
replace_missing_vals_with='NaN')
if isinstance(data, tuple):
df, labels = data
else:
df = data
except:
df, _ = utils.load_from_tsfile_to_dataframe(filepath, return_separate_X_and_y=True,
replace_missing_vals_with='NaN')
Expand Down
1 change: 1 addition & 0 deletions src/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def load_from_tsfile_to_dataframe(full_file_path_and_name, return_separate_X_and
instance_list = []
class_val_list = []
line_num = 0
target_labels = False

# Parse the file
# print(full_file_path_and_name)
Expand Down