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

Update format for partition input in ReadMe #6

Closed
tenggaard opened this issue Apr 22, 2021 · 1 comment
Closed

Update format for partition input in ReadMe #6

tenggaard opened this issue Apr 22, 2021 · 1 comment

Comments

@tenggaard
Copy link

  • OCTIS version: 1.2.0
  • Python version: Python 3.8.3
  • Operating System: Linux

According to the readme, input in the partition column for a custom dataset should be of the type 'training', 'validation', 'test', which I can't get to yield a partition:


Make sure that the dataset is in the following format:

  • corpus file: a .tsv file (tab-separated) that contains up to three columns, i.e. the document, the partitition, and the label associated to the document (optional).
  • vocabulary: a .txt file where each line represents a word of the vocabulary

The partition can be "training", "test" or "validation". An example of dataset can be found here: sample_dataset_.


However, it seems the right format is 'train', 'val', 'test', which does work for me - just passing this on to make the ReadMe clearer.

    def load_custom_dataset_from_folder(self, path):
        """
        Loads all the dataset from a folder
        Parameters
        ----------
        path : path of the folder to read
        """
        self.dataset_path = path
        try:
            if exists(self.dataset_path + "/metadata.json"):
                self._load_metadata(self.dataset_path + "/metadata.json")
            else:
                self.__metadata = dict()
            df = pd.read_csv(self.dataset_path + "/corpus.tsv", sep='\t', header=None)
            if len(df.keys()) > 1:
                df[1] = df[1].replace("train", "a_train")
                df[1] = df[1].replace("val", "b_val")
                df = df.sort_values(1).reset_index(drop=True)

                self.__metadata['last-training-doc'] = len(df[df[1] == 'a_train'])
                self.__metadata['last-validation-doc'] = len(df[df[1] == 'b_val']) + len(df[df[1] == 'a_train'])
silviatti added a commit that referenced this issue Apr 22, 2021
@silviatti
Copy link
Collaborator

Hi! I just fixed this in the readme.
Thanks again for reporting :) If you'd like to contribute, feel free to make a pull request!

Bye!

Silvia

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