MemoryError with IV2SLS
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- numpy, python
- Área
- performance
Línea de trabajo
Start at the IV2SLS entry point and inspect the weight handling around self._wz = self._z * w, comparing the weights=None path with explicitly supplied float32 weights. The reported failure is the allocation of a float64 array for a large design matrix; done means explaining or addressing that excessive memory use so the described regression can run.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I'm trying to run a 2SLS to estimate price elasticity with IV2SLS. This is what my data looks like:
| ln_q | ln_p | .... weather variables ... | ... instruments ... |... user id dummies ...|
all data is np.float32. My data array is approx. (200000, 20000) which is about 16GB.
Using linearmodels IV2SLS I set up my model like:
dependent = ln_q
endog = weather variables + user id dummies
exog = ln_p
instruments = instruments
results = IV2SLS(dependent, endog, exog, instruments).fit()
When running with the full dataset I consistently get the error:
Unable to allocate 27.8GiB of memory to an array with shape (202507, 18450) and data type float64 and it looks like this line is the culprit:
self._wz = self._z * w
which is where weights are assigned.
I'm running 64-bit python on a machine with 128 GB of RAM. I've tried to circumvent this issue by passing my own weights:
results = IV2SLS(dependent, endog, exog, instruments, weights=np.ones(dependent.shape, dtype=np.float32)).fit()
but still get the same MemoryError even when I explicitly pass my own weights of data type float32.
32 GB of RAM usage just to create an array of 1s when weights = None seems like an awful lot of memory usage to essentially keep the input values unchanged. Further, why is it getting recast to float64, when all my other data is of data type float32 and I explicitly pass weights of datatype float32?
Why is an array of ~16GB using >100GB of RAM in this process? What can I do to get this regression to run?
- Lenguaje dominante
- Python
- Estrellas
- 1.1k
- Forks
- 203
- Merge medio
- 3 h 26 min
- PR fusionados (30 d)
- 115
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 bashtage/linearmodels
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
bashtage/linearmodels#832 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
bashtage/linearmodels#831 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
IV: LIML kappa with an endogenous regressor spanned by the instruments, kappa's unit dependence, scale-dependent instrument rank checkPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
bashtage/linearmodels#823 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 18/100
bashtage/linearmodels#817 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
bashtage/linearmodels#780 ·
Los mantenedores suelen responder en 1 día
Todos los issues de bashtage/linearmodels
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
NousResearch/hermes-agent#147104 ·
Los mantenedores suelen responder en 1 día
-
[oblt-aw][autodoc] Document new required `shared-org-key` input for `obs-aw-dependency-review`Posiblemente ocupada @github-actions la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
bot-triaged module: inductor oncall: pt2 topic: fuzzer triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
getchaintips leaves out the active tip once a header is staged on it, where Core always lists itAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
btclib-org/btclib-node#2158 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
patrick-hudson/put.gd-desktop#979 · 1 comentario ·
Los mantenedores suelen responder en 1 día