Feature Request: Support bin width/step size in fit(Histogram, ...)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- julia
- Ambito
- data-visualization
Direzione di ricerca
Inizia da src/hist.jl intorno alle righe 298-307 e rivedi i percorsi di dispatch esistenti per fit(Histogram, data), edges e nbins. Definisci e implementa l’API per la larghezza dei bin scelta, incluso il comportamento dell’intervallo e dell’allineamento dei bordi, quindi verifica che il binning a larghezza fissa funzioni insieme alle chiamate esistenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
As I, was discussing on slack about this with some members;
This idea was discussed in the community: See the thread
I thought that currently, fit(Histogram, data) requires users to either specify the number of bins (nbins) or the exact bin edges. While flexible, a common workflow in scientific computing is to specify bins by a fixed width (e.g., "one bin every 0.5 units") independent of the data range.
Although this can be done manually with fit(Histogram, data, min:width:max), it requires calculating bounds and handling potential edge alignment issues manually.
Reference:
The current fit implementations for Histogram are centered around these methods:
https://github.com/JuliaStats/StatsBase.jl/blob/7388a8e23d98de0441dc0a460db47d4a6caf00c1/src/hist.jl#L298-L307
Proposed Change:
Add a keyword argument or helper type to allow binning by width. Examples:
# Option 1: keyword argument
fit(Histogram, data; width=0.5)
# Option 2: helper type
fit(Histogram, data, BinWidth(0.5))
My proposal is to extend this dispatch pattern. Currently, we have:
fit(..., edges) (User provides the range)
fit(..., nbins) (Internal histrange calculates the range)
I will add a third path:
3. fit(..., binwidth) (A simple range min:binwidth:max is generated and passed to the existing edges method).
Additional Considerations:
Alignment/anchor: Optional parameter to control where the first bin edge starts.
Variable resolution: Optional method for "equal-count" bins using data quantiles.
This Simplifies the API for new users, aligns with common libraries (NumPy, matplotlib), and reduces errors in manual bin calculations.
- Lingua principale
- Julia
- Stelle
- 614
- Fork
- 197
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di JuliaStats/StatsBase.jl
-
TransformationsAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
JuliaStats/StatsBase.jl#1012 ·
-
Data loss with floating-point `Histogram`sForse già presa @andreasnoack l’ha presa 38 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
JuliaStats/StatsBase.jl#1009 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
JuliaStats/StatsBase.jl#1006 · 2 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
JuliaStats/StatsBase.jl#998 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 52/100
JuliaStats/StatsBase.jl#995 ·
Tutte le issue di JuliaStats/StatsBase.jl
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JuliaGPU/KernelAbstractions.jl#897 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
oscar-system/GAP.jl#1455 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
JuliaAI/MLJTransforms.jl#85 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
SciML/OrdinaryDiffEq.jl#4875 ·
I maintainer di solito rispondono entro 4 giorni