ModelFlowIb 2.71__tar.gz → 2.73__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. modelflowib-2.73/PKG-INFO +156 -0
  2. modelflowib-2.73/README.md +113 -0
  3. modelflowib-2.73/license.md +10 -0
  4. {modelflowib-2.71 → modelflowib-2.73}/modelBLfunk.py +1 -1
  5. {modelflowib-2.71 → modelflowib-2.73}/modelclass.py +278 -44
  6. {modelflowib-2.71 → modelflowib-2.73}/modelconstruct.py +94 -7
  7. modelflowib-2.73/modelconstruct_estimation.py +2872 -0
  8. {modelflowib-2.71 → modelflowib-2.73}/modeldekom.py +15 -8
  9. modelflowib-2.73/modelestimator_new.py +2613 -0
  10. modelflowib-2.73/modelflowib.egg-info/PKG-INFO +156 -0
  11. {modelflowib-2.71/ModelFlowIb.egg-info → modelflowib-2.73/modelflowib.egg-info}/SOURCES.txt +10 -17
  12. {modelflowib-2.71/ModelFlowIb.egg-info → modelflowib-2.73/modelflowib.egg-info}/top_level.txt +3 -13
  13. modelflowib-2.73/modelgrabgdx.py +584 -0
  14. modelflowib-2.73/modelhtml.py +606 -0
  15. {modelflowib-2.71 → modelflowib-2.73}/modeljupytermagic.py +104 -92
  16. {modelflowib-2.71 → modelflowib-2.73}/modelmanipulation.py +4 -4
  17. {modelflowib-2.71 → modelflowib-2.73}/modelmf.py +135 -0
  18. {modelflowib-2.71 → modelflowib-2.73}/modelnewton.py +124 -35
  19. {modelflowib-2.71 → modelflowib-2.73}/modelpattern.py +48 -24
  20. {modelflowib-2.71 → modelflowib-2.73}/modelreport.py +15 -11
  21. {modelflowib-2.71 → modelflowib-2.73}/modelwidget.py +13 -0
  22. modelflowib-2.73/pyproject.toml +81 -0
  23. modelflowib-2.71/ModelFlowIb.egg-info/PKG-INFO +0 -33
  24. modelflowib-2.71/PKG-INFO +0 -33
  25. modelflowib-2.71/model_doable.py +0 -40
  26. modelflowib-2.71/model_ifrs9.py +0 -88
  27. modelflowib-2.71/model_run_numba.py +0 -15
  28. modelflowib-2.71/modelclass2.py +0 -463
  29. modelflowib-2.71/modelfeedback.py +0 -243
  30. modelflowib-2.71/modelgrabgdx.py +0 -292
  31. modelflowib-2.71/modelpatternrev.py +0 -72
  32. modelflowib-2.71/modelsandbox.py +0 -76
  33. modelflowib-2.71/modelsandbox_Mixin.py +0 -1565
  34. modelflowib-2.71/modeltodo.py +0 -31
  35. modelflowib-2.71/modeluserfunk_old.py +0 -90
  36. modelflowib-2.71/modelwidget_input_old.py +0 -1541
  37. modelflowib-2.71/modelwidget_shinypy.py +0 -935
  38. modelflowib-2.71/pyproject.toml +0 -46
  39. {modelflowib-2.71 → modelflowib-2.73}/model_Excel.py +0 -0
  40. {modelflowib-2.71 → modelflowib-2.73}/model_cvx.py +0 -0
  41. {modelflowib-2.71 → modelflowib-2.73}/model_dynare.py +0 -0
  42. {modelflowib-2.71 → modelflowib-2.73}/model_financial_stability.py +0 -0
  43. {modelflowib-2.71 → modelflowib-2.73}/model_latex.py +0 -0
  44. {modelflowib-2.71 → modelflowib-2.73}/model_latex_class.py +0 -0
  45. {modelflowib-2.71 → modelflowib-2.73}/model_parquet_mixin.py +0 -0
  46. {modelflowib-2.71 → modelflowib-2.73}/modeldash.py +0 -0
  47. {modelflowib-2.71 → modelflowib-2.73}/modeldashboot.py +0 -0
  48. {modelflowib-2.71 → modelflowib-2.73}/modeldashsidebar.py +0 -0
  49. {modelflowib-2.71 → modelflowib-2.73}/modeldiff.py +0 -0
  50. {modelflowib-2.71 → modelflowib-2.73}/modeldisplay.py +0 -0
  51. {modelflowib-2.71 → modelflowib-2.73}/modelestimation.py +0 -0
  52. {modelflowib-2.71/ModelFlowIb.egg-info → modelflowib-2.73/modelflowib.egg-info}/dependency_links.txt +0 -0
  53. {modelflowib-2.71/ModelFlowIb.egg-info → modelflowib-2.73/modelflowib.egg-info}/requires.txt +0 -0
  54. {modelflowib-2.71 → modelflowib-2.73}/modelgrab.py +0 -0
  55. {modelflowib-2.71 → modelflowib-2.73}/modelgrabwf2.py +0 -0
  56. {modelflowib-2.71 → modelflowib-2.73}/modelhelp.py +0 -0
  57. {modelflowib-2.71 → modelflowib-2.73}/modelinvert.py +0 -0
  58. {modelflowib-2.71 → modelflowib-2.73}/modeljupyter.py +0 -0
  59. {modelflowib-2.71 → modelflowib-2.73}/modelmacrograb.py +0 -0
  60. {modelflowib-2.71 → modelflowib-2.73}/modelnet.py +0 -0
  61. {modelflowib-2.71 → modelflowib-2.73}/modelnormalize.py +0 -0
  62. {modelflowib-2.71 → modelflowib-2.73}/modeluserfunk.py +0 -0
  63. {modelflowib-2.71 → modelflowib-2.73}/modelvis.py +0 -0
  64. {modelflowib-2.71 → modelflowib-2.73}/modelwidget_input.py +0 -0
  65. {modelflowib-2.71 → modelflowib-2.73}/setup.cfg +0 -0
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.4
2
+ Name: modelflowib
3
+ Version: 2.73
4
+ Summary: A tool to solve and manage dynamic economic and financial models
5
+ Author-email: Ib Hansen <Ib.Hansen.Iv@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/IbHansen/ModelFlow2
8
+ Project-URL: Repository, https://github.com/IbHansen/ModelFlow2
9
+ Keywords: economics,dynamic models,BLL,numba,modelling
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+ License-File: license.md
15
+ Requires-Dist: pandas
16
+ Requires-Dist: matplotlib
17
+ Requires-Dist: seaborn
18
+ Requires-Dist: sympy
19
+ Requires-Dist: numpy
20
+ Requires-Dist: networkx
21
+ Requires-Dist: tqdm
22
+ Requires-Dist: scipy
23
+ Requires-Dist: numexpr
24
+ Requires-Dist: bottleneck
25
+ Requires-Dist: XlsxWriter
26
+ Requires-Dist: pyarrow
27
+ Requires-Dist: tabulate
28
+ Requires-Dist: openpyxl
29
+ Requires-Dist: xarray
30
+ Requires-Dist: cvxopt
31
+ Requires-Dist: numba
32
+ Requires-Dist: dash
33
+ Requires-Dist: dash-bootstrap-components
34
+ Requires-Dist: dash-interactive-graphviz
35
+ Requires-Dist: lmfit
36
+ Requires-Dist: jupyter
37
+ Requires-Dist: ipywidgets
38
+ Requires-Dist: ipydatagrid
39
+ Provides-Extra: shiny
40
+ Requires-Dist: shiny; extra == "shiny"
41
+ Requires-Dist: shinywidgets; extra == "shiny"
42
+ Dynamic: license-file
43
+
44
+ # ModelFlow
45
+ A Python toolkit to manage models
46
+
47
+ The easy way to start is here [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/IbHansen/modelflow/master).
48
+
49
+ This will start **ModelFlow** as an online Jupyter notebook. Select one of the notebooks (files with the extension .ipynb). Some of the
50
+ notebooks are ModelFlow related. Other implement different model
51
+
52
+ - FRBUS will start the FRB/US model from the Federal reserve board.
53
+ - Q-JEM will start the Quarterly Japanese Economic Model from Bank of Japan
54
+ - ADAM will start the Anual Danish Aggregate Model for the Danish Statistical agency.
55
+ - Solow will implement a simple textybook Solow model.
56
+
57
+ You can also look at the python files of the system. Located at the **modelflow/** folder
58
+
59
+ Alternative look at the *getting started* section later in this file. It explains how to run ModelFlow localy.
60
+
61
+ The **Pandas** library is a great library to handle all kinds of datamanipulation and transformations.
62
+
63
+ However when it comes to models which contains lags or models which requires solving simultanous equations, Pandas is not quite helpful.
64
+
65
+ ModelFlow extends Pandas to handle a range of such models. And they can be large.
66
+
67
+ It requires you to specify the *model* specified as equations (the **business logic**) and place the *data* in a Pandas **DataFrame**. ModelFlow allows the model to meet the data and return the result as a new DataFrame.
68
+
69
+ A number of **analytical tools for model and result analytic** helps to understand the model and its results.
70
+
71
+ The user can **extend and modify the tools** to her or his needs.
72
+
73
+ **Onboarding models and combining models from different sources**. Creating a Macro prudential model often entails recycling several models specified in different ways: Excel, Latex, Dynare, Python or other languages. Python's ecosystem makes it possible to transform many different models into ModelFlow models or to wrap them into functions which can be called from ModelFlow models.
74
+
75
+ **Models can be specified in a high level Business logic language (a Domain Specific language)**. This allows the formulation of a model in a concise and expressive language which is close to the economic of the model. The user can concentrate on the economic or financial content - not the coding of the solution. The code for solving the model is generated by the tool. Then you can *solve the
76
+ simultaneous* (or *non-simultaneous* model) in an efficient way.
77
+
78
+ ## Introduction
79
+
80
+ **ModelFlow is written in Python**. Python comes "batteries included" and is
81
+ the basis of a very rich ecosystem, which consists of a wide array of
82
+ libraries. ModelFlow is just another library. It supplements the existing
83
+ libraries regarding modeling language and solving and allows the use of
84
+ Python as a model management framework.
85
+
86
+ **Data handling and wrangling is done in the Pandas library**. This
87
+ library is the Swiss army knife of data science in Python. It can import and export data to most systems and it is very powerful in manipulating and transforming data.
88
+ The core
89
+ element of Pandas is the *Dataframe*. A Dataframe is a two-dimensional
90
+ tabular data structure. Each *column* consists of cells of the same type
91
+ -- it can be a number, a string, a matrix or another Python data object.This includes matrices and other dataframes. Each *row is indexed.* The index can basically be any type of variable
92
+ including dates, which is especially relevant for economic and financial models.
93
+
94
+ **ModelFlow gives the user tools for more than solving models**. This
95
+ includes:
96
+
97
+ - *Visualization* and comparison of results
98
+
99
+ - *Integration* of models from different sources
100
+
101
+ - *Analyze the logical structure of a model*. By applying graph theory,
102
+ ModelFlow can find data lineage, find a suitable calculating sequence and trace
103
+ causes of changes through the calculations.
104
+
105
+ - *Inverting* the model to calculating the necessary instruments to
106
+ achieve a desired target.
107
+
108
+ - Calculating the *attributions* from input to the results of a model.
109
+
110
+ - Calculating the *attribution* from input to the result of each
111
+ formula.
112
+
113
+ - Finding and calculating partial *derivatives* of formulas
114
+
115
+ - *Integrating user defined python functions* in the Business logic
116
+ language (like optimization, calculating risk weights or to make a matrices consistent with the RAS algorithm )
117
+
118
+ - *Wrap matlab* models so they can be used in the Business logic
119
+ language.
120
+
121
+ - *Speed up* solving using "Just in time compilation"
122
+
123
+ - Analyze the model structure through tools from graph theory
124
+
125
+ - Handle *large models.* 1,000,000 formulas is not a problem.
126
+
127
+ - Integrate model management in Jupyter notebooks for *agile and user
128
+ friendly model use*
129
+
130
+
131
+ **The core code of ModelFlow is small and
132
+ documented.** Thus it can easily be modified and expanded to the specific need of the user. *ModelFlow is a toolset*. It can handle models, which conform to the tools.
133
+
134
+ If you need a feature or have a model which can't be handled in ModelFlow,
135
+ you are encouraged to improve ModelFlow. Please share the
136
+ improvement, other users may have the same need, or can be inspired by
137
+ your work.
138
+
139
+ Also bear in mind that ModelFlow is experimental. It is provided ”as is”, without any representation or warranty of any kind either express or implied.
140
+
141
+ ## Getting started
142
+
143
+ You need Python 3.7+ with asssociated libraries. The easy way is to install Anaconda Python is to download the distribution from [https://www.anaconda.com/distribution](https://www.anaconda.com/distribution)
144
+
145
+ Now you can install ModelFlow by running a command window from the Anaconda prompt and execute theese commands
146
+ ```
147
+ conda install modelflow -c ibh -c defaults -c conda-forge
148
+ ```
149
+ You will find the anaconda prompt by searching "anaconda" in the start menu search field
150
+
151
+ Try out one of the workbooks. to do this you:
152
+ ```
153
+ click on the Adaconda prompth in the Anaconda folder
154
+ cd <The location you have downloaded the workbooks>
155
+ jupyter notebook
156
+ ```
@@ -0,0 +1,113 @@
1
+ # ModelFlow
2
+ A Python toolkit to manage models
3
+
4
+ The easy way to start is here [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/IbHansen/modelflow/master).
5
+
6
+ This will start **ModelFlow** as an online Jupyter notebook. Select one of the notebooks (files with the extension .ipynb). Some of the
7
+ notebooks are ModelFlow related. Other implement different model
8
+
9
+ - FRBUS will start the FRB/US model from the Federal reserve board.
10
+ - Q-JEM will start the Quarterly Japanese Economic Model from Bank of Japan
11
+ - ADAM will start the Anual Danish Aggregate Model for the Danish Statistical agency.
12
+ - Solow will implement a simple textybook Solow model.
13
+
14
+ You can also look at the python files of the system. Located at the **modelflow/** folder
15
+
16
+ Alternative look at the *getting started* section later in this file. It explains how to run ModelFlow localy.
17
+
18
+ The **Pandas** library is a great library to handle all kinds of datamanipulation and transformations.
19
+
20
+ However when it comes to models which contains lags or models which requires solving simultanous equations, Pandas is not quite helpful.
21
+
22
+ ModelFlow extends Pandas to handle a range of such models. And they can be large.
23
+
24
+ It requires you to specify the *model* specified as equations (the **business logic**) and place the *data* in a Pandas **DataFrame**. ModelFlow allows the model to meet the data and return the result as a new DataFrame.
25
+
26
+ A number of **analytical tools for model and result analytic** helps to understand the model and its results.
27
+
28
+ The user can **extend and modify the tools** to her or his needs.
29
+
30
+ **Onboarding models and combining models from different sources**. Creating a Macro prudential model often entails recycling several models specified in different ways: Excel, Latex, Dynare, Python or other languages. Python's ecosystem makes it possible to transform many different models into ModelFlow models or to wrap them into functions which can be called from ModelFlow models.
31
+
32
+ **Models can be specified in a high level Business logic language (a Domain Specific language)**. This allows the formulation of a model in a concise and expressive language which is close to the economic of the model. The user can concentrate on the economic or financial content - not the coding of the solution. The code for solving the model is generated by the tool. Then you can *solve the
33
+ simultaneous* (or *non-simultaneous* model) in an efficient way.
34
+
35
+ ## Introduction
36
+
37
+ **ModelFlow is written in Python**. Python comes "batteries included" and is
38
+ the basis of a very rich ecosystem, which consists of a wide array of
39
+ libraries. ModelFlow is just another library. It supplements the existing
40
+ libraries regarding modeling language and solving and allows the use of
41
+ Python as a model management framework.
42
+
43
+ **Data handling and wrangling is done in the Pandas library**. This
44
+ library is the Swiss army knife of data science in Python. It can import and export data to most systems and it is very powerful in manipulating and transforming data.
45
+ The core
46
+ element of Pandas is the *Dataframe*. A Dataframe is a two-dimensional
47
+ tabular data structure. Each *column* consists of cells of the same type
48
+ -- it can be a number, a string, a matrix or another Python data object.This includes matrices and other dataframes. Each *row is indexed.* The index can basically be any type of variable
49
+ including dates, which is especially relevant for economic and financial models.
50
+
51
+ **ModelFlow gives the user tools for more than solving models**. This
52
+ includes:
53
+
54
+ - *Visualization* and comparison of results
55
+
56
+ - *Integration* of models from different sources
57
+
58
+ - *Analyze the logical structure of a model*. By applying graph theory,
59
+ ModelFlow can find data lineage, find a suitable calculating sequence and trace
60
+ causes of changes through the calculations.
61
+
62
+ - *Inverting* the model to calculating the necessary instruments to
63
+ achieve a desired target.
64
+
65
+ - Calculating the *attributions* from input to the results of a model.
66
+
67
+ - Calculating the *attribution* from input to the result of each
68
+ formula.
69
+
70
+ - Finding and calculating partial *derivatives* of formulas
71
+
72
+ - *Integrating user defined python functions* in the Business logic
73
+ language (like optimization, calculating risk weights or to make a matrices consistent with the RAS algorithm )
74
+
75
+ - *Wrap matlab* models so they can be used in the Business logic
76
+ language.
77
+
78
+ - *Speed up* solving using "Just in time compilation"
79
+
80
+ - Analyze the model structure through tools from graph theory
81
+
82
+ - Handle *large models.* 1,000,000 formulas is not a problem.
83
+
84
+ - Integrate model management in Jupyter notebooks for *agile and user
85
+ friendly model use*
86
+
87
+
88
+ **The core code of ModelFlow is small and
89
+ documented.** Thus it can easily be modified and expanded to the specific need of the user. *ModelFlow is a toolset*. It can handle models, which conform to the tools.
90
+
91
+ If you need a feature or have a model which can't be handled in ModelFlow,
92
+ you are encouraged to improve ModelFlow. Please share the
93
+ improvement, other users may have the same need, or can be inspired by
94
+ your work.
95
+
96
+ Also bear in mind that ModelFlow is experimental. It is provided ”as is”, without any representation or warranty of any kind either express or implied.
97
+
98
+ ## Getting started
99
+
100
+ You need Python 3.7+ with asssociated libraries. The easy way is to install Anaconda Python is to download the distribution from [https://www.anaconda.com/distribution](https://www.anaconda.com/distribution)
101
+
102
+ Now you can install ModelFlow by running a command window from the Anaconda prompt and execute theese commands
103
+ ```
104
+ conda install modelflow -c ibh -c defaults -c conda-forge
105
+ ```
106
+ You will find the anaconda prompt by searching "anaconda" in the start menu search field
107
+
108
+ Try out one of the workbooks. to do this you:
109
+ ```
110
+ click on the Adaconda prompth in the Anaconda folder
111
+ cd <The location you have downloaded the workbooks>
112
+ jupyter notebook
113
+ ```
@@ -0,0 +1,10 @@
1
+ Copyright © 2019 Danmarks Nationalbank and ECB
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Soft-ware"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+
8
+ Except as contained in this notice, the name of Danmarks Nationalbank and ECB shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Danmarks Nationalbank and ECB.
9
+
10
+ Based on MIT License.
@@ -7,7 +7,7 @@ Created on Fri Mar 2 17:01:49 2018
7
7
  Functions placed here are included in the Pyfs business language
8
8
 
9
9
  """
10
- from math import exp, log, sqrt, tanh, erf
10
+ from math import exp, log, sqrt, tanh, erf,isclose
11
11
  from numpy import transpose , array
12
12
  from scipy.stats import norm,lognorm
13
13
  from scipy.stats import gamma