RFC: tracing variables within `JointDistribution`s
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- machine-learning
Línea de trabajo
Comienza leyendo el comportamiento existente de JointDistribution.Root y los métodos relacionados con CDF/CMF/PDF/PMF descritos en la issue. Define la semántica de Trace en torno al proceso de generación hacia adelante y, después, verifica que los valores trazados aparezcan en model.sample(), mientras que log_prob pueda ignorarlos y aceptar las variables restantes sin volver a calcular la expresión.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Background
Sometimes it would be useful to be able to trace intermediate values computed as part of a JointDistribution* model. The current solution to this is to make use of tfd.Deterministic. As an example, supposing we would like to trace the mean of a simple linear regression on a single feature, a user might write:
@tfd.JointDistributionCoroutine
def model():
intercept = yield tfd.Normal(loc=0.0, scale=1.0, name="intercept")
slope = yield tfd.Normal(loc=0.0, scale=1.0, name="slope")
mean = tfd.Deterministic(intercept + slope * feature, name="mean")
yield tfd.Normal(loc=mean, scale=1.0, name="response")
A call to model.sample() will return a named tuple including the value of mean, conditional on alpha and beta (and feature). However, if we wish to compute the log probability density of the model given response, intercept, and slope, we also have to pass into model.log_prob a value of mean. Here, mean must be consistent with intercept and slope, which requires the user to duplicate the expression for mean outside the model object. e.g.
intercept = 0.1
slope = 0.2
feature = 0.5
response = 0.21
# Since `mean` is deterministic, we should not have to re-compute it outside of `model`
mean = intercept + slope * feature
lp = model.log_prob(intercept=intercept, slope=slope, mean=mean, response=response)
This seems wasteful in terms of keystrokes, but also error-prone if model changes.
Suggested solution
A potential solution would be to include a sub-class similar to JointDistribution.Root called JointDistribution.Trace which would flag an expression for tracing in the forward generating process (i.e. model.sample()), but exclude the associated variable from the CDF/CMF and PDF/PMF-related methods. Thus we could write:
@tfd.JointDistributionCoroutine
def model():
intercept = yield tfd.Normal(loc=0.0, scale=1.0, name="intercept")
slope = yield tfd.Normal(loc=0.0, scale=1.0, name="slope")
mean =Trace(intercept + slope * feature, name="mean")
yield tfd.Normal(loc=mean, scale=1.0, name="response")
draw = model.sample(seed=[0,0])
# `mean` is simply ignored
model.log_prob(draw)
# `mean` does not have to be supplied
model.log_prob(intercept=draw.intercept, slope=draw.slope, response=draw.response)
Does this seem like a feasible addition? (I may have some resource to devote to it)
- Lenguaje dominante
- Jupyter Notebook
- Estrellas
- 4.4k
- Forks
- 1.1k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tensorflow/probability
-
KL divergence between two `TransformedDistribution`s with a shared non-injective bijector (`AbsoluteValue`) returns the base KLPosiblemente ocupada @Andreas-Hum la tomó hace 7 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
tensorflow/probability#2036 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
tensorflow/probability#2034 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
tensorflow/probability#2021 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
tensorflow/probability#2015 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
tensorflow/probability#2013 ·
Todos los issues de tensorflow/probability
Issues similares
-
[Bug]: DoubleMLRDDData accepts a score_col that is no data column (as in its docstring example); the running variable then becomes a covariate and RDFlex failsPosiblemente ocupada @vrjdev la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
DoubleML/doubleml-for-py#455 ·
Los mantenedores suelen responder en 1 día
-
Install page: spectarf's CUDA engine fails with PyTorch for CUDA 13.0 (nvvmError: ERROR_INVALID_IR)Posiblemente ocupada @lukepolson la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
PyTomography/PyTomography#435 ·
Los mantenedores suelen responder en 1 día
-
beginner friendly
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
aws-samples/sample-per-model-bedrock#821 ·
Los mantenedores suelen responder en 1 día
-
Strain created without dtype promotes the conservative+stress path to float64 under jax_enable_x64Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100