Vectorize predictors in categorical(_logit)

Offen
#3,102 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
38/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
cpp

Rechercherichtung

Beginne damit, die Einstiegspunkte der Wahrscheinlichkeitsfunktionen categorical und categorical_logit sowie deren bestehende Vektorisierungsunterstützung zu lokalisieren. Prüfe, wie Signaturen für array[] int mit Vektorparametern definiert sind, füge dann Abdeckung für die Matrixform hinzu und verifiziere, dass das bereitgestellte Stan-Beispiel kompiliert; die Form array[] vector bleibt wie beschrieben optional.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

feature

Description

As is, the categorical and categorical_logit pdfs allow multiple outputs, but not multiple parameters.

This was requested in docs, but doesn't exist yet: https://github.com/stan-dev/docs/issues/500

Example

Currently:

Available signatures:
(array[] int, vector) => real
  The second argument must be vector but got matrix
(int, vector) => real
  The first argument must be int but got array[] int

What we want is to add the following signature in the usual way (so that each row of the matrix corresponds to an entry of the integer array):

(array[] int, matrix) => real

and maybe

(array[] int, array[] vector) => real

The goal is to support vectorized code that looks like this:

data {
  int<lower=0> K;
  int<lower=0> N;
  int<lower=0> D;
  array[N] int<lower=1, upper=K> y;
  matrix[N, D] x;
}
parameters {
  matrix[D, K] beta;
}
model {
  to_vector(beta) ~ normal(0, 5);
  y ~ categorical_logit(x * beta);
}

Expected Output

Above example compiles.

Current Version:

v4.9.0

Vorherrschende Sprache
C++
Sterne
845
Forks
225
Ø Merge
4 T. 21 Std.
Gemergte PRs (30 T.)
13

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus stan-dev/math

Alle Issues in stan-dev/math

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.