Skip to content

ENH: Allow category-wise Fleiss' kappas. - #9242

Draft
jseabold wants to merge 7 commits into
statsmodels:mainfrom
jseabold:fleiss-kappa-detail
Draft

jseabold wants to merge 7 commits into
statsmodels:mainfrom
jseabold:fleiss-kappa-detail

Conversation

@jseabold

@jseabold jseabold commented May 9, 2024

Copy link
Copy Markdown
Member

The API is a bit of a mess with many conditional returns.

Probably worth adding a bunch return and maybe a separate function with bells and whistles and deprecating the old one maybe?

Includes #9241, so it should go in after that. Will leave as draft until that's merged.

  • tests added / passed.
  • code/documentation is well formatted.
  • properly formatted commit message. See
    NumPy's guide.

Comment thread statsmodels/stats/inter_rater.py Fixed
@josef-pkt

josef-pkt commented May 10, 2024 •

Copy link
Copy Markdown
Member

Thanks @jseabold

We have Holder and HolderTuple which are now returned by most newer functions.
HolderTuple is backwards compatible with a tuple return (allows indexing and assigning to tuple) but not when previous return was only one value.

For transition and ambiguous cases where extra information might not be a priority, I had used return_results=False as keyword.
Otherwise, I now often return always extra results (if they are cheap) and intermediate results in a Holder instance.
If extra information is more expensive, I have been adding them recently as methods to a subclass of Holder, similar to the model results instance.

The Holder classes have a __repr__ that list all attributes with values.

Aside: Holder and HolderTuple do not subclass python dict or tuple, because I only wanted to support/maintain explicitly defined methods and not to have to worry about inherited methods from dict or tuple.

@jseabold
jseabold force-pushed the fleiss-kappa-detail branch from 75c0231 to f51773a Compare May 15, 2024 13:54
@jseabold jseabold mentioned this pull request May 15, 2024
4 tasks done
@jseabold

jseabold commented May 15, 2024 •

Copy link
Copy Markdown
Member Author

Rebased on PR with results class returned.

Made it an error to request Randolph's Kappa with details. Not sure it makes much sense to assume a marginal 50/50 chance between a single category vs. all others?

If that makes sense, will need to remove that code path from the detail helper function, and I don't think I have a test yet for method = 'fleiss' and return_results = False.

@josef-pkt

Copy link
Copy Markdown
Member

can we add the category level computation to the results class?
Then, we would have only two return cases, plain number or results instance.

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

Successfully merging this pull request may close these issues.

3 participants