Moving away from pickle files for model output

Abierto
#1,025 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
18/100
Tipo de issue
Refactorización
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python
Área
data

Línea de trabajo

Start with the pickle writes for SS_vars.pkl, TPI_vars.pkl and model_params.pkl, and with the existing ogcore.utils.param_dump_json function, which already serializes most parameters. The open question is what to do with SciPy interpolation objects when tax_func_type is mono or mono2D. This needs a maintainer decision on the format before any code change, so it is not a newcomer task. Done means an agreed design, not a patch.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

question

We currently save model outputs (SS_vars.pkl, TPI_vars.pkl, and model_params.pkl) as pickle files. This issue is to discussing moving away from this file format -- likely towards a JSON format.

The disadvantages of pickle include:

  1. Data need to be loaded into Python.
  2. They are binary files and thus have an opaqueness that makes it difficult to view changes to elements in the data and could pose a security risk.
  3. Pickle files, particularly those saved with cloudpickle, scubas model_params.pkl, are not guaranteed to open on versions of Python they were not saved in. This can inhibit the sharing of files and the long-term storage of data.

Using a JSON format would solve these three issues. SS_vars.pkl and TPI_vars.pkl contain only dictionaries of scalars, arrays, and strings, and so are easily converted to JSON.

Model parameters can almost always be saved to JSON (e.g., as in done with ogcore.utils.param_dump_jsonfunction). The exception to this is iftax_func_type=mono(ormono2D`), in which case the tax functions are SciPy interpolation objects. I am not aware of a way to put these into JSON. Perhaps JSON can be used in general, but a pkl can be used if tax functions of these types are used?

Lenguaje dominante
Python
Estrellas
85
Forks
153
Merge medio
1 d 19 h
PR fusionados (30 d)
19

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

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PSLmodels/OG-Core

Todos los issues de PSLmodels/OG-Core

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.