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

[BUG] OneCoinDawidSkene is broken after vesion 1.4.0. #127

Closed
takumi1001 opened this issue Jan 11, 2025 · 3 comments · Fixed by #128
Closed

[BUG] OneCoinDawidSkene is broken after vesion 1.4.0. #127

takumi1001 opened this issue Jan 11, 2025 · 3 comments · Fixed by #128
Labels
bug Something isn't working

Comments

@takumi1001
Copy link

Observed behavior

In crowd-kit 1.4.0 and later, the following error occurs when running fit_predict() on OneCoinDawidSkene.

Code (Same as the example in docs):

from crowdkit.aggregation import OneCoinDawidSkene
from crowdkit.datasets import load_dataset
df, gt = load_dataset('relevance-2')
hds = OneCoinDawidSkene(100)
result = hds.fit_predict(df)

Error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-2-bc24fa88a4e5>](https://localhost:8080/#) in <cell line: 5>()
      3 df, gt = load_dataset('relevance-2')
      4 hds = OneCoinDawidSkene(100)
----> 5 result = hds.fit_predict(df)

[/usr/local/lib/python3.10/dist-packages/crowdkit/aggregation/classification/dawid_skene.py](https://localhost:8080/#) in fit_predict(self, data, true_labels, initial_error)
    378         """
    379 
--> 380         self.fit(data, true_labels, initial_error)
    381         assert self.labels_ is not None, "no labels_"
    382         return self.labels_

TypeError: OneCoinDawidSkene.fit() takes 2 positional arguments but 4 were given

I believe the following commits are related to this issue:
e67d3a7

Expected behavior

The argument problem is fixed and the algorithm runs successfully.

In 1.3.0.post0, this issue is not caused.

Thank you for reading my issue.
I appreciate the all contributors of the crowd-kit.

Python Version

3.1

Crowd-Kit Version

1.4.1

Other Packages Versions

No response

Example code

from crowdkit.aggregation import OneCoinDawidSkene
from crowdkit.datasets import load_dataset
df, gt = load_dataset('relevance-2')
hds = OneCoinDawidSkene(100)
result = hds.fit_predict(df)

Relevant log output

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-2-bc24fa88a4e5>](https://localhost:8080/#) in <cell line: 5>()
      3 df, gt = load_dataset('relevance-2')
      4 hds = OneCoinDawidSkene(100)
----> 5 result = hds.fit_predict(df)

[/usr/local/lib/python3.10/dist-packages/crowdkit/aggregation/classification/dawid_skene.py](https://localhost:8080/#) in fit_predict(self, data, true_labels, initial_error)
    378         """
    379 
--> 380         self.fit(data, true_labels, initial_error)
    381         assert self.labels_ is not None, "no labels_"
    382         return self.labels_

TypeError: OneCoinDawidSkene.fit() takes 2 positional arguments but 4 were given
@takumi1001 takumi1001 added the bug Something isn't working label Jan 11, 2025
@shenxiangzhuang
Copy link
Contributor

Hi @takumi1001, thanks for reporting this issue. I'll try to fix it later.

Actually, there is a quick fix: override fit_predict and fit_predict_proba methods in OneCoinDawidSkene. And the implementation is the same as the old methods used in DawidSkene class. With this approach, we can keep OneCoinDawidSkene behavior as before without sacrificing readability. @dustalov What do you think about this?

@dustalov
Copy link
Collaborator

Thank you for the report!

@shenxiangzhuang, please override the necessary methods and add corresponding tests to address potential inheritance issues in the future. Once that's done, I'll proceed with shipping the release.

@takumi1001
Copy link
Author

Thank you for your quick response and bugfix 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants