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

A question about the target label in PosData and UnlabelData #2

Open
Blue0rigin opened this issue Jun 26, 2023 · 0 comments
Open

A question about the target label in PosData and UnlabelData #2

Blue0rigin opened this issue Jun 26, 2023 · 0 comments

Comments

@Blue0rigin
Copy link

Blue0rigin commented Jun 26, 2023

I am a bit confused about the following two quoted lines of code. Why use 0 for pos_data target label? Is it more natural to use 1 for pos_data target label and 0 for neg_data target label?

class PosData(torch.utils.data.Dataset): 
    def __init__(self, transform=None, target_transform=None, data=None, \
            index=None, data_type=None):
        self.transform = transform
        self.target_transform = target_transform

        self.data=data

> self.targets = np.zeros(data.shape[0], dtype= np.int_)

        self.data_type = data_type
        self.index = index
class UnlabelData(torch.utils.data.Dataset): 
    def __init__(self, transform=None, target_transform=None, pos_data=None, \
            neg_data=None, index=None, data_type=None):
        self.transform = transform
        self.target_transform = target_transform

        self.data=np.concatenate((pos_data, neg_data), axis=0)

>         self.true_targets = np.concatenate((np.zeros(pos_data.shape[0],  dtype= np.int_), np.ones(neg_data.shape[0],  dtype= np.int_)), axis=0)

        self.targets = np.ones_like(self.true_targets, dtype= np.int_)

        self.data_type = data_type
        self.index = index
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

1 participant