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
Fixing issue#771: concat_datasets_sequentially discards classes #844
Conversation
@lrzpellegrini can you check? seems ok to me! |
Hi there, line
is a bottleneck and the performance hit may be huge for big datasets. Use the Also, consider including a regression unit test to check that everything is in order! |
Thanks for the review! Yes, I'll make the edit regarding |
I think a simple unit test checking the correct presence of the labels in the final dataset and the total number of patterns may be enough. You can add it inside this test file. You can create a fake dataset and check that the |
Pull Request Test Coverage Report for Build 1649403949
💛 - Coveralls |
@lrzpellegrini @AndreaCossu Regarding Illustration from the example used above: print(type(dataset.targets))
print(dataset.targets)
print(type(set(dataset.targets)))
print(set(dataset.targets))
As seen, On the other hand, mapping the classes = set(map(lambda x: x.item(), dataset.targets))
print(type(classes))
print(classes)
Is there a better way to get the unique classes of a dataset? |
Hi @ashok-arjun. Converting using I recommend using: set(map(int, dataset.targets)) which should work fine in both cases. Alas, there is no better way to achieve this. |
@lrzpellegrini @AndreaCossu I've added the tests. |
Oh no! It seems there are some PEP8 errors! 😕
|
Oh no! It seems there are some PEP8 errors! 😕
|
@AndreaCossu @lrzpellegrini Can you please tell me how to resolve these two errors? |
Thanks @ashok-arjun ! I adjusted the line indentations highlighted in the comment above. It seems good now, we can merge. |
@AndreaCossu Thanks a ton for the help! :)) |
Fixes #771 raised by @AndreaCossu
The problem was that
class_mapping
was not correctly created before to adhere tonew_class_id = class_mapping[original_class_id]
.So a list of size largest class index is created, only the classes present here are filled with the remapped IDs.
Test:
Output: