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

Dataset implementation for classification task? #17

Closed
hillarylia opened this issue Mar 5, 2024 · 2 comments
Closed

Dataset implementation for classification task? #17

hillarylia opened this issue Mar 5, 2024 · 2 comments

Comments

@hillarylia
Copy link

Hi there,

I'm interested in time series classification. I noticed that there is no implementation for ClassificationDFDataset. Is there a workaround you might suggest? Otherwise, are there plans to implement classification?

@lkluo
Copy link

lkluo commented Mar 13, 2024

I have no idea why they dont implement classification. Perhaps they pretend no body cares time series classification. A quick solution is to modify on RegressionDFDataset:

from torch.utils.data import  Dataset

dataset = RegressionDFDataset(...)
dataset = ClassificationDataset(dataset)

class ClassificationDataset(Dataset):
    def __init__(self, data):
        self.data = data

    def __len__(self):
        return len(self.data)

    def __getitem__(self, index):
        ret = {
            "past_values": self.data[index]["past_values"],
            "target_values": self.data[index]["target_values"][0]
        }
        if self.data.datetime_col:
            ret["timestamp"] = self.data[index]["timestamp"]
        return ret

@hillarylia
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants