Moving away from pickle files for model output

オープン
#1,025 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
18/100
issue の種類
リファクタリング
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
data

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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?

主要言語
Python
スター
85
フォーク
153
平均マージ
1日 19時間
マージ済み PR(30日)
19

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PSLmodels/OG-Core のほかの issue

PSLmodels/OG-Core の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。