Bug: LinearTransform shift

Aperta
#234 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
haskell
Ambito
backend

Direzione di ricerca

Start by reading Statistics.Distribution.Transform and the implementations of mean, maybeMean, entropy, maybeEntropy, and complCumulative; the issue does not name test files. Check how shifted and scaled exponential distributions behave, including negative scales and far-tail complements. Done means the reported mean is 4.0 and the listed scale, entropy, and complement cases behave correctly.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi, I was working on some statistical exercises in Haskell. It's been a while since I took a course in the topic so I am a bit rusty.

While working on the assignments I needed to use shifted linear transforms of exponential distributions and things looked odd. I am using latest statistics-0.16.5.0

import Statistics.Distribution
import Statistics.Distribution.Exponential
import Statistics.Distribution.Transform

e = exponential 1                  -- E(1): mean 1, variance 1, entropy 1

-- >>> mean (LinearTransform 0 3 e)
-- 1.0
-- expected: 4.0

I am able to produce a fix for that, but since I have some blind spots I used LLM to analyze the code and it report other issues:

  • mean and maybeMean drop the scale
  • entropy and maybeEntropy ignore the scale
  • A negative scale returns the complement of the right answer
  • complCumulative is not defined, so the far tail is lost

If LLM contributions are welcome the following branch can be used https://github.com/haskell/statistics/compare/master...bcardiff:statistics:fix-linear-transform. Let me know if you want me to open a PR with that.

Lingua principale
Haskell
Stelle
309
Fork
77
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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di haskell/statistics

Tutte le issue di haskell/statistics

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.