Skip to content

DOC: Document kwargs for kde across all layers#327

Open
player3zxcvbnm wants to merge 1 commit intoarviz-devs:mainfrom
player3zxcvbnm:fix-kde-docs
Open

DOC: Document kwargs for kde across all layers#327
player3zxcvbnm wants to merge 1 commit intoarviz-devs:mainfrom
player3zxcvbnm:fix-kde-docs

Conversation

@player3zxcvbnm
Copy link

@player3zxcvbnm player3zxcvbnm commented Mar 12, 2026

This PR resolves issue #318 by properly documenting the **kwargs passed to the kde function so users know they can use arguments like bw and adaptive.

Note on scope: I noticed that other functions in accessors.py (like rhat, mcse, histogram, etc.) should also be fixed. I kept this PR strictly scoped to kde , we could fix them in a separate PR for them!

@read-the-docs-community
Copy link

read-the-docs-community bot commented Mar 12, 2026

Documentation build overview

📚 arviz-stats | 🛠️ Build #31771752 | 📁 Comparing 82fcc04 against latest (cbbc9e2)


🔍 Preview build

Show files changed (23 files in total): 📝 23 modified | ➕ 0 added | ➖ 0 deleted
File Status
api/index.html 📝 modified
api/generated/arviz_stats.base.array_stats.kde.html 📝 modified
api/generated/arviz_stats.base.dataarray_stats.kde.html 📝 modified
api/generated/arviz_stats.eti.html 📝 modified
api/generated/arviz_stats.hdi.html 📝 modified
api/generated/arviz_stats.histogram.html 📝 modified
api/generated/arviz_stats.iqr.html 📝 modified
api/generated/arviz_stats.kde.html 📝 modified
api/generated/arviz_stats.loo_approximate_posterior.html 📝 modified
api/generated/arviz_stats.loo_kfold.html 📝 modified
api/generated/arviz_stats.loo_moment_match.html 📝 modified
api/generated/arviz_stats.loo_subsample.html 📝 modified
api/generated/arviz_stats.mean.html 📝 modified
api/generated/arviz_stats.median.html 📝 modified
api/generated/arviz_stats.mode.html 📝 modified
api/generated/arviz_stats.numba.array_stats.kde.html 📝 modified
api/generated/arviz_stats.qds.html 📝 modified
api/generated/arviz_stats.std.html 📝 modified
api/generated/arviz_stats.var.html 📝 modified
api/generated/xarray.Dataset.azstats.kde.html 📝 modified
_modules/arviz_stats/loo/loo_approximate_posterior.html 📝 modified
_modules/arviz_stats/loo/loo_moment_match.html 📝 modified
_modules/arviz_stats/loo/loo_subsample.html 📝 modified

@player3zxcvbnm player3zxcvbnm force-pushed the fix-kde-docs branch 4 times, most recently from 4c6de28 to 00f46aa Compare March 12, 2026 06:32
weights : array-like, optional
axis : int, sequence of int or None, default -1
density : bool, default True
density : bool, optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this changes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for missing that one in the cleanup. I've just reverted the density parameter documentation to its original state as well. The PR should be completely clean now—containing only the kde docstring updates.

@aloctavodia
Copy link
Contributor

I edited you PR description. See how the message is much shorter and the relevant information is there (no need to list the changes that are obvious by inspecting the code).

Things still missing

  • arviz_stats.kde mentions dataarray and array interfaces without linking: https://python.arviz.org/projects/stats/en/latest/api/generated/arviz_stats.kde.html#arviz_stats.kde.
  • Somewhere we need to list ALL possible kwargs that could be passed.Still not clear to me what is the best way to do it:
    • All the kwargs should be described in the first function without linking anywhere.
    • All the kwargs should be described in the array function and it should be a path from the first function to the array following the path of the code.
    • All the kwargs should be described in both the first and array functions, and we should have links following the path.

@player3zxcvbnm
Copy link
Author

Thanks for the description edits and the feedback! I’m tied up for the next two days, but I'll address the linking and doc structure as soon as I'm back.

@player3zxcvbnm
Copy link
Author

player3zxcvbnm commented Mar 16, 2026

Hi @aloctavodia
Regarding the missing pieces, here is my plan to address them:

Out of the options you listed, I agree the second option is the cleanest approach. Since I already documented the underlying kwargs (like bw, adaptive, etc.) in the base array function in my previous commit, I will update the top-level kde docstring (and related functions) to link directly to it: :func:~arviz_stats.base.array_stats.kde.

I realized linking to the dataarray interface here would just create a redundant double-hop for the user trying to find the kwargs, so pointing directly to the array interface creates a clean, single source of truth.

Let me know if this approach sounds good to you and I'll push the updates!

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.

2 participants