PipeGraphPy 1.0.18__py3-none-manylinux1_x86_64.whl

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 (145) hide show
  1. PipeGraphPy/__init__.py +10 -0
  2. PipeGraphPy/common.py +4 -0
  3. PipeGraphPy/config/__init__.py +277 -0
  4. PipeGraphPy/config/config_light.py +122 -0
  5. PipeGraphPy/config/custom.py +6 -0
  6. PipeGraphPy/config/default_settings.py +125 -0
  7. PipeGraphPy/constants.py +238 -0
  8. PipeGraphPy/core/__init__.py +2 -0
  9. PipeGraphPy/core/anchor.cpython-38-x86_64-linux-gnu.so +0 -0
  10. PipeGraphPy/core/edge.cpython-38-x86_64-linux-gnu.so +0 -0
  11. PipeGraphPy/core/graph.cpython-38-x86_64-linux-gnu.so +0 -0
  12. PipeGraphPy/core/graph_base.cpython-38-x86_64-linux-gnu.so +0 -0
  13. PipeGraphPy/core/modcls/__init__.py +3 -0
  14. PipeGraphPy/core/modcls/base.cpython-38-x86_64-linux-gnu.so +0 -0
  15. PipeGraphPy/core/modcls/branchselect.cpython-38-x86_64-linux-gnu.so +0 -0
  16. PipeGraphPy/core/modcls/classifier.cpython-38-x86_64-linux-gnu.so +0 -0
  17. PipeGraphPy/core/modcls/cluster.cpython-38-x86_64-linux-gnu.so +0 -0
  18. PipeGraphPy/core/modcls/datacharts.cpython-38-x86_64-linux-gnu.so +0 -0
  19. PipeGraphPy/core/modcls/deeplearning.cpython-38-x86_64-linux-gnu.so +0 -0
  20. PipeGraphPy/core/modcls/endscript.cpython-38-x86_64-linux-gnu.so +0 -0
  21. PipeGraphPy/core/modcls/ensemble.cpython-38-x86_64-linux-gnu.so +0 -0
  22. PipeGraphPy/core/modcls/evaluate.cpython-38-x86_64-linux-gnu.so +0 -0
  23. PipeGraphPy/core/modcls/exportdata.cpython-38-x86_64-linux-gnu.so +0 -0
  24. PipeGraphPy/core/modcls/handlescript.cpython-38-x86_64-linux-gnu.so +0 -0
  25. PipeGraphPy/core/modcls/importdata.cpython-38-x86_64-linux-gnu.so +0 -0
  26. PipeGraphPy/core/modcls/merge.cpython-38-x86_64-linux-gnu.so +0 -0
  27. PipeGraphPy/core/modcls/mergescript.cpython-38-x86_64-linux-gnu.so +0 -0
  28. PipeGraphPy/core/modcls/metrics.cpython-38-x86_64-linux-gnu.so +0 -0
  29. PipeGraphPy/core/modcls/postprocessor.cpython-38-x86_64-linux-gnu.so +0 -0
  30. PipeGraphPy/core/modcls/preprocessor.cpython-38-x86_64-linux-gnu.so +0 -0
  31. PipeGraphPy/core/modcls/pythonscript.cpython-38-x86_64-linux-gnu.so +0 -0
  32. PipeGraphPy/core/modcls/regressor.cpython-38-x86_64-linux-gnu.so +0 -0
  33. PipeGraphPy/core/modcls/selector.cpython-38-x86_64-linux-gnu.so +0 -0
  34. PipeGraphPy/core/modcls/selectscript.cpython-38-x86_64-linux-gnu.so +0 -0
  35. PipeGraphPy/core/modcls/special.cpython-38-x86_64-linux-gnu.so +0 -0
  36. PipeGraphPy/core/modcls/split.cpython-38-x86_64-linux-gnu.so +0 -0
  37. PipeGraphPy/core/modcls/splitscript.cpython-38-x86_64-linux-gnu.so +0 -0
  38. PipeGraphPy/core/modcls/startscript.cpython-38-x86_64-linux-gnu.so +0 -0
  39. PipeGraphPy/core/modcls/transformer.cpython-38-x86_64-linux-gnu.so +0 -0
  40. PipeGraphPy/core/module.cpython-38-x86_64-linux-gnu.so +0 -0
  41. PipeGraphPy/core/modules/__init__.py +83 -0
  42. PipeGraphPy/core/modules/branchselect/__init__.py +0 -0
  43. PipeGraphPy/core/modules/branchselect/sqlbranchselect.py +30 -0
  44. PipeGraphPy/core/modules/classifier/__init__.py +2 -0
  45. PipeGraphPy/core/modules/cluster/__init__.py +0 -0
  46. PipeGraphPy/core/modules/custom/__init__.py +0 -0
  47. PipeGraphPy/core/modules/custom/classifier/__init__.py +0 -0
  48. PipeGraphPy/core/modules/datacharts/__init__.py +5 -0
  49. PipeGraphPy/core/modules/datacharts/dataview.py +28 -0
  50. PipeGraphPy/core/modules/deeplearning/__init__.py +0 -0
  51. PipeGraphPy/core/modules/ensemble/__init__.py +0 -0
  52. PipeGraphPy/core/modules/ensemble/predictcombine.py +83 -0
  53. PipeGraphPy/core/modules/evaluate/__init__.py +0 -0
  54. PipeGraphPy/core/modules/evaluate/rmseeval.py +323 -0
  55. PipeGraphPy/core/modules/exportdata/__init__.py +0 -0
  56. PipeGraphPy/core/modules/exportdata/rundownloadcsv.py +88 -0
  57. PipeGraphPy/core/modules/exportdata/todb.py +132 -0
  58. PipeGraphPy/core/modules/importdata/__init__.py +686 -0
  59. PipeGraphPy/core/modules/importdata/algodata.py +194 -0
  60. PipeGraphPy/core/modules/importdata/ensemblegridweather.py +356 -0
  61. PipeGraphPy/core/modules/importdata/fromdb.py +153 -0
  62. PipeGraphPy/core/modules/importdata/fromsql.py +88 -0
  63. PipeGraphPy/core/modules/importdata/gridweather.py +427 -0
  64. PipeGraphPy/core/modules/importdata/import_graph.py +24 -0
  65. PipeGraphPy/core/modules/importdata/midlong.py +283 -0
  66. PipeGraphPy/core/modules/importdata/nwpdata.py +174 -0
  67. PipeGraphPy/core/modules/importdata/qiaogdfsimport.py +670 -0
  68. PipeGraphPy/core/modules/importdata/shan1xiareaimport.py +521 -0
  69. PipeGraphPy/core/modules/importdata/strategyalgodata.py +565 -0
  70. PipeGraphPy/core/modules/importdata/test.py +3 -0
  71. PipeGraphPy/core/modules/importdata/theorydata.py +115 -0
  72. PipeGraphPy/core/modules/importdata/thirdpower.py +344 -0
  73. PipeGraphPy/core/modules/importdata/token.npy +0 -0
  74. PipeGraphPy/core/modules/importdata/totalpower.py +218 -0
  75. PipeGraphPy/core/modules/importdata/totalpower_utils.py +107 -0
  76. PipeGraphPy/core/modules/merge/mergemany.py +97 -0
  77. PipeGraphPy/core/modules/merge/mergetwo.py +83 -0
  78. PipeGraphPy/core/modules/model_selector/MLP_test_Selector.py +28 -0
  79. PipeGraphPy/core/modules/model_selector/__init__.py +3 -0
  80. PipeGraphPy/core/modules/postprocessor/__init__.py +0 -0
  81. PipeGraphPy/core/modules/postprocessor/postdownloadcsv.py +84 -0
  82. PipeGraphPy/core/modules/postprocessor/test.py +1 -0
  83. PipeGraphPy/core/modules/postprocessor/testss.py +4 -0
  84. PipeGraphPy/core/modules/postprocessor/zerotocap.py +18 -0
  85. PipeGraphPy/core/modules/preprocessor/__init__.py +5 -0
  86. PipeGraphPy/core/modules/preprocessor/filtercolumns.py +12 -0
  87. PipeGraphPy/core/modules/preprocessor/filterlib.py +106 -0
  88. PipeGraphPy/core/modules/preprocessor/predownloadcsv.py +106 -0
  89. PipeGraphPy/core/modules/preprocessor/sqlfilter.py +41 -0
  90. PipeGraphPy/core/modules/pythonscript/__init__.py +0 -0
  91. PipeGraphPy/core/modules/pythonscript/copycompetitionpredictresulttest.py +254 -0
  92. PipeGraphPy/core/modules/pythonscript/reportmengDongenergytest.py +176 -0
  93. PipeGraphPy/core/modules/regressor/__init__.py +0 -0
  94. PipeGraphPy/core/modules/selector/__init__.py +3 -0
  95. PipeGraphPy/core/modules/selector/explore_selector.py +377 -0
  96. PipeGraphPy/core/modules/selector/nwp_selector.py +192 -0
  97. PipeGraphPy/core/modules/special/__init__.py +6 -0
  98. PipeGraphPy/core/modules/special/emptydata.py +37 -0
  99. PipeGraphPy/core/modules/special/graphmod.py +46 -0
  100. PipeGraphPy/core/modules/transformer/MLP_test_Transformer.py +40 -0
  101. PipeGraphPy/core/modules/transformer/__init__.py +3 -0
  102. PipeGraphPy/core/modules/transformer/rnn_transformer.py +110 -0
  103. PipeGraphPy/core/node.cpython-38-x86_64-linux-gnu.so +0 -0
  104. PipeGraphPy/core/pipegraph.cpython-38-x86_64-linux-gnu.so +0 -0
  105. PipeGraphPy/db/__init__.py +2 -0
  106. PipeGraphPy/db/models.cpython-38-x86_64-linux-gnu.so +0 -0
  107. PipeGraphPy/db/utils.py +183 -0
  108. PipeGraphPy/decorators.py +42 -0
  109. PipeGraphPy/exceptions.py +61 -0
  110. PipeGraphPy/handle_wait_graph.py +318 -0
  111. PipeGraphPy/logger.py +169 -0
  112. PipeGraphPy/plot/__init__.py +0 -0
  113. PipeGraphPy/plot/draw.py +424 -0
  114. PipeGraphPy/shell_op.py +144 -0
  115. PipeGraphPy/storage/__init__.py +10 -0
  116. PipeGraphPy/storage/base.py +2 -0
  117. PipeGraphPy/storage/dict_backend.py +101 -0
  118. PipeGraphPy/storage/file_backend.py +340 -0
  119. PipeGraphPy/storage/redis_backend.py +183 -0
  120. PipeGraphPy/tools.py +383 -0
  121. PipeGraphPy/utils/__init__.py +1 -0
  122. PipeGraphPy/utils/celery_control.py +20 -0
  123. PipeGraphPy/utils/check.py +179 -0
  124. PipeGraphPy/utils/core.py +295 -0
  125. PipeGraphPy/utils/examine.py +259 -0
  126. PipeGraphPy/utils/feature_select.py +41 -0
  127. PipeGraphPy/utils/file_operate.py +101 -0
  128. PipeGraphPy/utils/format.py +125 -0
  129. PipeGraphPy/utils/formula.py +5 -0
  130. PipeGraphPy/utils/functional.py +422 -0
  131. PipeGraphPy/utils/handle_graph.py +31 -0
  132. PipeGraphPy/utils/lock.py +1 -0
  133. PipeGraphPy/utils/mq.py +54 -0
  134. PipeGraphPy/utils/osutil.py +29 -0
  135. PipeGraphPy/utils/read_nwp_tar.py +84 -0
  136. PipeGraphPy/utils/redis_operate.py +195 -0
  137. PipeGraphPy/utils/str_handle.py +122 -0
  138. PipeGraphPy/utils/version.py +108 -0
  139. PipeGraphPy/worker_exe.py +64 -0
  140. PipeGraphPy/worker_heartbeat.py +150 -0
  141. PipeGraphPy/worker_subscriber.py +117 -0
  142. pipegraphpy-1.0.18.dist-info/METADATA +23 -0
  143. pipegraphpy-1.0.18.dist-info/RECORD +145 -0
  144. pipegraphpy-1.0.18.dist-info/WHEEL +5 -0
  145. pipegraphpy-1.0.18.dist-info/top_level.txt +1 -0
@@ -0,0 +1,10 @@
1
+ # coding:utf-8
2
+
3
+ __version__ = "1.0.18"
4
+
5
+ from PipeGraphPy.core.graph import Graph, graph_predict, graph_evaluate, online_graph_evaluate, online_graph_predict, graph_run, graph_backtest
6
+ from PipeGraphPy.core.module import Module
7
+ from PipeGraphPy.core.node import Node
8
+
9
+ __all__ = ['Node', 'Module', 'Graph', 'graph_predict', 'graph_evaluate',
10
+ 'online_graph_evaluate', 'online_graph_predict', 'graph_run', 'graph_backtest']
PipeGraphPy/common.py ADDED
@@ -0,0 +1,4 @@
1
+ # 本文件存储通用变量或全局变量
2
+
3
+
4
+ multi_graph = dict()
@@ -0,0 +1,277 @@
1
+ # coding:utf-8
2
+
3
+ """
4
+ Settings and configuration for PGP.
5
+
6
+ Read values from the module specified by the PGP_SETTINGS_MODULE environment
7
+ variable, and then from PipeGraphPy.conf.default_settings; see the default_settings.py
8
+ for a list of all possible variables.
9
+
10
+ """
11
+ import importlib
12
+ import os
13
+ import traceback
14
+ import PipeGraphPy
15
+ from PipeGraphPy.config import default_settings
16
+ from PipeGraphPy.exceptions import ImproperlyConfigured
17
+ from PipeGraphPy.utils.functional import LazyObject, empty
18
+ from dbpoolpy import settings as dbsettings
19
+
20
+ os.environ['PGP_SETTINGS_MODULE'] = 'PipeGraphPy.config.custom'
21
+
22
+ ENVIRONMENT_VARIABLE = "PGP_SETTINGS_MODULE"
23
+
24
+ PASSWORD_RESET_TIMEOUT_DAYS_DEPRECATED_MSG = (
25
+ 'The PASSWORD_RESET_TIMEOUT_DAYS setting is deprecated. Use '
26
+ 'PASSWORD_RESET_TIMEOUT instead.'
27
+ )
28
+
29
+ DEFAULT_HASHING_ALGORITHM_DEPRECATED_MSG = (
30
+ 'The DEFAULT_HASHING_ALGORITHM transitional setting is deprecated. '
31
+ 'Support for it and tokens, cookies, sessions, and signatures that use '
32
+ 'SHA-1 hashing algorithm will be removed in PGP 4.0.'
33
+ )
34
+
35
+
36
+ class SettingsReference(str):
37
+ """
38
+ String subclass which references a current settings value. It's treated as
39
+ the value in memory but serializes to a settings.NAME attribute reference.
40
+ """
41
+
42
+ def __new__(self, value, setting_name):
43
+ return str.__new__(self, value)
44
+
45
+ def __init__(self, value, setting_name):
46
+ self.setting_name = setting_name
47
+
48
+
49
+ class LazySettings(LazyObject):
50
+ """
51
+ A lazy proxy for either global PGP settings or a custom settings object.
52
+ The user can manually configure settings prior to using them. Otherwise,
53
+ PGP uses the settings module pointed to by PGP_SETTINGS_MODULE.
54
+ """
55
+
56
+ def _setup(self, name=None):
57
+ """
58
+ Load the settings module pointed to by the environment variable. This
59
+ is used the first time settings are needed, if the user hasn't
60
+ configured settings manually.
61
+ """
62
+ settings_module = os.environ.get(ENVIRONMENT_VARIABLE)
63
+ if not settings_module:
64
+ desc = ("setting %s" % name) if name else "settings"
65
+ raise ImproperlyConfigured(
66
+ "Requested %s, but settings are not configured. "
67
+ "You must either define the environment variable %s "
68
+ "or call settings.configure() before accessing settings."
69
+ % (desc, ENVIRONMENT_VARIABLE))
70
+
71
+ self._wrapped = Settings(settings_module)
72
+
73
+ def __repr__(self):
74
+ # Hardcode the class name as otherwise it yields 'Settings'.
75
+ if self._wrapped is empty:
76
+ return '<LazySettings [Unevaluated]>'
77
+ return '<LazySettings "%(settings_module)s">' % {
78
+ 'settings_module': self._wrapped.SETTINGS_MODULE,
79
+ }
80
+
81
+ def __getattr__(self, name):
82
+ """Return the value of a setting and cache it in self.__dict__."""
83
+ if self._wrapped is empty:
84
+ self._setup(name)
85
+ val = getattr(self._wrapped, name)
86
+
87
+ # Special case some settings which require further modification.
88
+ # This is done here for performance reasons so the
89
+ # modified value is cached.
90
+
91
+ # if name in {'MEDIA_URL', 'STATIC_URL'} and val is not None:
92
+ # val = self._add_script_prefix(val)
93
+ # elif name == 'SECRET_KEY' and not val:
94
+ # raise ImproperlyConfigured(
95
+ # "The SECRET_KEY setting must not be empty.")
96
+
97
+ self.__dict__[name] = val
98
+ return val
99
+
100
+ def __setattr__(self, name, value):
101
+ """
102
+ Set the value of setting. Clear all cached values if _wrapped changes
103
+ (@override_settings does this) or clear single values when set.
104
+ """
105
+ if name == '_wrapped':
106
+ self.__dict__.clear()
107
+ else:
108
+ self.__dict__.pop(name, None)
109
+ if name == 'DEBUG':
110
+ dbsettings.DEBUG = value
111
+ super().__setattr__(name, value)
112
+
113
+ def __delattr__(self, name):
114
+ """Delete a setting and clear it from cache if needed."""
115
+ super().__delattr__(name)
116
+ self.__dict__.pop(name, None)
117
+
118
+ def configure(self, default_settings=default_settings, **options):
119
+ """
120
+ Called to manually configure the settings. The 'default_settings'
121
+ parameter sets where to retrieve any unspecified values from (its
122
+ argument must support attribute access (__getattr__)).
123
+ """
124
+ if self._wrapped is not empty:
125
+ raise RuntimeError('Settings already configured.')
126
+ holder = UserSettingsHolder(default_settings)
127
+ for name, value in options.items():
128
+ if not name.isupper():
129
+ raise TypeError('Setting %r must be uppercase.' % name)
130
+ setattr(holder, name, value)
131
+ self._wrapped = holder
132
+
133
+ # @staticmethod
134
+ # def _add_script_prefix(value):
135
+ # """
136
+ # Add SCRIPT_NAME prefix to relative paths.
137
+
138
+ # Useful when the app is being served at a subpath and manually prefixing
139
+ # subpath to STATIC_URL and MEDIA_URL in settings is inconvenient.
140
+ # """
141
+ # # Don't apply prefix to absolute paths and URLs.
142
+ # if value.startswith(('http://', 'https://', '/')):
143
+ # return value
144
+ # from PipeGraphPy.urls import get_script_prefix
145
+ # return '%s%s' % (get_script_prefix(), value)
146
+
147
+ @property
148
+ def configured(self):
149
+ """Return True if the settings have already been configured."""
150
+ return self._wrapped is not empty
151
+
152
+ @property
153
+ def PASSWORD_RESET_TIMEOUT_DAYS(self):
154
+ stack = traceback.extract_stack()
155
+ # Show a warning if the setting is used outside of PGP.
156
+ # Stack index: -1 this line, -2 the caller.
157
+ filename, _, _, _ = stack[-2]
158
+ if not filename.startswith(os.path.dirname(PipeGraphPy.__file__)):
159
+ pass
160
+ # warnings.warn(
161
+ # PASSWORD_RESET_TIMEOUT_DAYS_DEPRECATED_MSG,
162
+ # RemovedInPGP40Warning,
163
+ # stacklevel=2,
164
+ # )
165
+ return self.__getattr__('PASSWORD_RESET_TIMEOUT_DAYS')
166
+
167
+
168
+ class Settings:
169
+ def __init__(self, settings_module):
170
+ # update this dict from global
171
+ # settings (but only for ALL_CAPS settings)
172
+ for setting in dir(default_settings):
173
+ if setting.isupper():
174
+ setattr(self, setting, getattr(default_settings, setting))
175
+
176
+ # store the settings module in case someone later cares
177
+ self.SETTINGS_MODULE = settings_module
178
+
179
+ mod = importlib.import_module(self.SETTINGS_MODULE)
180
+
181
+ tuple_settings = (
182
+ "INSTALLED_APPS",
183
+ "TEMPLATE_DIRS",
184
+ "LOCALE_PATHS",
185
+ )
186
+ self._explicit_settings = set()
187
+ for setting in dir(mod):
188
+ if setting.isupper():
189
+ setting_value = getattr(mod, setting)
190
+
191
+ if (setting in tuple_settings and
192
+ not isinstance(setting_value, (list, tuple))):
193
+ raise ImproperlyConfigured(
194
+ "The %s setting must be a list or a tuple. " % setting)
195
+ setattr(self, setting, setting_value)
196
+ self._explicit_settings.add(setting)
197
+
198
+ if self.is_overridden('PASSWORD_RESET_TIMEOUT_DAYS'):
199
+ if self.is_overridden('PASSWORD_RESET_TIMEOUT'):
200
+ raise ImproperlyConfigured(
201
+ 'PASSWORD_RESET_TIMEOUT_DAYS/PASSWORD_RESET_TIMEOUT are '
202
+ 'mutually exclusive.'
203
+ )
204
+ setattr(self, 'PASSWORD_RESET_TIMEOUT',
205
+ self.PASSWORD_RESET_TIMEOUT_DAYS * 60 * 60 * 24)
206
+ # warnings.warn(PASSWORD_RESET_TIMEOUT_DAYS_DEPRECATED_MSG,
207
+ # RemovedInPGP40Warning)
208
+
209
+ # if self.is_overridden('DEFAULT_HASHING_ALGORITHM'):
210
+ # warnings.warn(DEFAULT_HASHING_ALGORITHM_DEPRECATED_MSG,
211
+ # RemovedInPGP40Warning)
212
+
213
+ def is_overridden(self, setting):
214
+ return setting in self._explicit_settings
215
+
216
+ def __repr__(self):
217
+ return '<%(cls)s "%(settings_module)s">' % {
218
+ 'cls': self.__class__.__name__,
219
+ 'settings_module': self.SETTINGS_MODULE,
220
+ }
221
+
222
+
223
+ class UserSettingsHolder:
224
+ """Holder for user configured settings."""
225
+ # SETTINGS_MODULE doesn't make much sense in the manually configured
226
+ # (standalone) case.
227
+ SETTINGS_MODULE = None
228
+
229
+ def __init__(self, default_settings):
230
+ """
231
+ Requests for configuration variables not in this class are satisfied
232
+ from the module specified in default_settings (if possible).
233
+ """
234
+ self.__dict__['_deleted'] = set()
235
+ self.default_settings = default_settings
236
+
237
+ def __getattr__(self, name):
238
+ if not name.isupper() or name in self._deleted:
239
+ raise AttributeError
240
+ return getattr(self.default_settings, name)
241
+
242
+ def __setattr__(self, name, value):
243
+ self._deleted.discard(name)
244
+ # if name == 'PASSWORD_RESET_TIMEOUT_DAYS':
245
+ # setattr(self, 'PASSWORD_RESET_TIMEOUT', value * 60 * 60 * 24)
246
+ # warnings.warn(PASSWORD_RESET_TIMEOUT_DAYS_DEPRECATED_MSG,
247
+ # RemovedInPGP40Warning)
248
+ # if name == 'DEFAULT_HASHING_ALGORITHM':
249
+ # warnings.warn(DEFAULT_HASHING_ALGORITHM_DEPRECATED_MSG,
250
+ # RemovedInPGP40Warning)
251
+ super().__setattr__(name, value)
252
+
253
+ def __delattr__(self, name):
254
+ self._deleted.add(name)
255
+ if hasattr(self, name):
256
+ super().__delattr__(name)
257
+
258
+ def __dir__(self):
259
+ return sorted(
260
+ s for s in [*self.__dict__, *dir(self.default_settings)]
261
+ if s not in self._deleted
262
+ )
263
+
264
+ def is_overridden(self, setting):
265
+ deleted = (setting in self._deleted)
266
+ set_locally = (setting in self.__dict__)
267
+ set_on_default = getattr(
268
+ self.default_settings, 'is_overridden', lambda s: False)(setting)
269
+ return deleted or set_locally or set_on_default
270
+
271
+ def __repr__(self):
272
+ return '<%(cls)s>' % {
273
+ 'cls': self.__class__.__name__,
274
+ }
275
+
276
+
277
+ settings = LazySettings()
@@ -0,0 +1,122 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ """This file is part of the TPOT library.
4
+ TPOT was primarily developed at the University of Pennsylvania by:
5
+ - Randal S. Olson (rso@randalolson.com)
6
+ - Weixuan Fu (weixuanf@upenn.edu)
7
+ - Daniel Angell (dpa34@drexel.edu)
8
+ - and many more generous open source contributors
9
+ TPOT is free software: you can redistribute it and/or modify
10
+ it under the terms of the GNU Lesser General Public License as
11
+ published by the Free Software Foundation, either version 3 of
12
+ the License, or (at your option) any later version.
13
+ TPOT is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU Lesser General Public License for more details.
17
+ You should have received a copy of the GNU Lesser General Public
18
+ License along with TPOT. If not, see <http://www.gnu.org/licenses/>.
19
+ """
20
+
21
+ import numpy as np
22
+
23
+ # Check the TPOT documentation for information on the structure of config dicts
24
+
25
+ regressor_config_dict_light = {
26
+
27
+ 'sklearn.linear_model.ElasticNetCV': {
28
+ 'l1_ratio': np.arange(0.0, 1.01, 0.05),
29
+ 'tol': [1e-5, 1e-4, 1e-3, 1e-2, 1e-1]
30
+ },
31
+
32
+ 'sklearn.tree.DecisionTreeRegressor': {
33
+ 'max_depth': range(1, 11),
34
+ 'min_samples_split': range(2, 21),
35
+ 'min_samples_leaf': range(1, 21)
36
+ },
37
+
38
+ 'sklearn.neighbors.KNeighborsRegressor': {
39
+ 'n_neighbors': range(1, 101),
40
+ 'weights': ["uniform", "distance"],
41
+ 'p': [1, 2]
42
+ },
43
+
44
+ 'sklearn.linear_model.LassoLarsCV': {
45
+ 'normalize': [True, False]
46
+ },
47
+
48
+ 'sklearn.svm.LinearSVR': {
49
+ 'loss': ["epsilon_insensitive", "squared_epsilon_insensitive"],
50
+ 'dual': [True, False],
51
+ 'tol': [1e-5, 1e-4, 1e-3, 1e-2, 1e-1],
52
+ 'C': [1e-4, 1e-3, 1e-2, 1e-1, 0.5, 1., 5., 10., 15., 20., 25.],
53
+ 'epsilon': [1e-4, 1e-3, 1e-2, 1e-1, 1.]
54
+ },
55
+
56
+ 'sklearn.linear_model.RidgeCV': {
57
+ },
58
+
59
+
60
+ # Preprocesssors
61
+ 'sklearn.preprocessing.Binarizer': {
62
+ 'threshold': np.arange(0.0, 1.01, 0.05)
63
+ },
64
+
65
+
66
+ 'sklearn.cluster.FeatureAgglomeration': {
67
+ 'linkage': ['ward', 'complete', 'average'],
68
+ 'affinity': ['euclidean', 'l1', 'l2', 'manhattan', 'cosine']
69
+ },
70
+
71
+ 'sklearn.preprocessing.MaxAbsScaler': {
72
+ },
73
+
74
+ 'sklearn.preprocessing.MinMaxScaler': {
75
+ },
76
+
77
+ 'sklearn.preprocessing.Normalizer': {
78
+ 'norm': ['l1', 'l2', 'max']
79
+ },
80
+
81
+ 'sklearn.kernel_approximation.Nystroem': {
82
+ 'kernel': ['rbf', 'cosine', 'chi2', 'laplacian', 'polynomial', 'poly', 'linear', 'additive_chi2', 'sigmoid'],
83
+ 'gamma': np.arange(0.0, 1.01, 0.05),
84
+ 'n_components': range(1, 11)
85
+ },
86
+
87
+ 'sklearn.decomposition.PCA': {
88
+ 'svd_solver': ['randomized'],
89
+ 'iterated_power': range(1, 11)
90
+ },
91
+
92
+ 'sklearn.kernel_approximation.RBFSampler': {
93
+ 'gamma': np.arange(0.0, 1.01, 0.05)
94
+ },
95
+
96
+ 'sklearn.preprocessing.RobustScaler': {
97
+ },
98
+
99
+ 'sklearn.preprocessing.StandardScaler': {
100
+ },
101
+
102
+
103
+ # Selectors
104
+ 'sklearn.feature_selection.SelectFwe': {
105
+ 'alpha': np.arange(0, 0.05, 0.001),
106
+ 'score_func': {
107
+ 'sklearn.feature_selection.f_regression': None
108
+ }
109
+ },
110
+
111
+ 'sklearn.feature_selection.SelectPercentile': {
112
+ 'percentile': range(1, 100),
113
+ 'score_func': {
114
+ 'sklearn.feature_selection.f_regression': None
115
+ }
116
+ },
117
+
118
+ 'sklearn.feature_selection.VarianceThreshold': {
119
+ 'threshold': [0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.2]
120
+ }
121
+
122
+ }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ import os
4
+
5
+
6
+
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+
4
+ """
5
+ Default PGP settings.
6
+ """
7
+ import os
8
+ import sys
9
+ # from pyecharts.globals import NotebookType
10
+
11
+ class PGP_ENV:
12
+ DEV = "dev" # 本地开发
13
+ DEBUG = "debug" # 本地测试
14
+ RPC = "rpc" # rpc
15
+ RUN_WORKER = "run_worker" # 训练worker
16
+ PREDICT_WORKER = "predict_worker" # 预测worker
17
+ SDK = "sdk" # sdk
18
+ NONE = "none" # 非执行训练和预测环境
19
+
20
+
21
+ DEBUG = False if str(os.environ.get("PGP_NOT_DEBUG")) == "1" else True
22
+ ISDEV = False if str(os.environ.get("PGP_NOT_DEV")) == "1" else True
23
+ ISJUPYTER = True if str(os.environ.get("PGP_JUPYTER")) == "1" else False
24
+ RUN_PERMISSION = True if str(os.environ.get("PGP_RUN_PERMISSION")) == "1" else False
25
+ RUN_MODEL_SAVE_PATH = os.environ.get("PGP_RUN_MODEL_SAVE_PATH", "")
26
+ SDK_MODEL_SAVE_PATH = os.environ.get("PGP_SDK_MODEL_SAVE_PATH", "")
27
+ PREDICT_MODEL_SAVE_PATH = os.environ.get("PGP_PREDICT_MODEL_SAVE_PATH", '')
28
+ PREDICT_RESULT_SAVE_PATH = os.environ.get("PGP_PREDICT_RESULT_SAVE_PATH", '')
29
+ BACKTEST_RESULT_SAVE_PATH = os.environ.get("PGP_BACKTEST_RESULT_SAVE_PATH", '')
30
+ RUN_RESULT_SAVE_PATH = os.environ.get("PGP_RUN_RESULT_SAVE_PATH", '')
31
+ EVALUATE_RESULT_SAVE_PATH = os.environ.get("PGP_EVALUATE_RESULT_SAVE_PATH", '')
32
+ TEMP_SAVE_PATH = os.environ.get("PGP_TEMP_SAVE_PATH", "")
33
+ CUSTOM_CACHE_PATH = os.environ.get("PGP_CUSTOM_CACHE_PATH", '')
34
+ REDIS_HOST = os.environ.get("REDIS_HOST", '39.105.185.60')
35
+ REDIS_PORT = int(os.environ.get("REDIS_PORT", '6371'))
36
+ PGP_DB_HOST = os.environ.get("PGP_DB_HOST", '39.105.185.60')
37
+ PGP_DB_PORT = int(os.environ.get("PGP_DB_PORT", '33061'))
38
+ AMQP_URL = os.environ.get("PGP_AMQP_URL", 'amqp://mlf:mlfadmin@47.94.251.175:6296/mlf_vhost')
39
+ RUN_TIMEOUT = int(os.environ.get("RUN_TIMEOUT", 60 * 60 * 6)) # 训练超时2小时
40
+ PREDICT_TIMEOUT = int(os.environ.get("PREDICT_TIMEOUT", 60 * 10)) # 预测超时5分钟
41
+ RT_DB_CONNECTOR = os.environ.get("RT_DB_CONNECTOR", '')
42
+ ISONLINE = True if str(os.environ.get("PGP_IS_ONLINE")) == "1" else False
43
+ DEPLOYMENT_ENV = os.environ.get("PGP_DEPLOYMENT_ENV", "none")
44
+ RUN_ENV = os.environ.get("PGP_RUN_ENV", 'test') # 运行环境, test, online, dev, sdk, image
45
+ DBPOOL_SERVER_NAME = os.environ.get("PGP_DBPOOL_SERVER_NAME", 'mlf')
46
+ PGP_PDB_PORT = int(os.environ.get("PGP_PDB_PORT", '6688'))
47
+
48
+ # 模型保存配置
49
+ if DEPLOYMENT_ENV == PGP_ENV.SDK:
50
+ HOME_CACHE_PATH = os.path.expanduser('~/.cache/PipeGraphPy/sdk/')
51
+ if not SDK_MODEL_SAVE_PATH:
52
+ SDK_MODEL_SAVE_PATH = os.path.join(HOME_CACHE_PATH, "sdk")
53
+ if not os.path.exists(SDK_MODEL_SAVE_PATH):
54
+ os.makedirs(SDK_MODEL_SAVE_PATH)
55
+ else:
56
+ HOME_CACHE_PATH = os.path.expanduser('~/.cache/PipeGraphPy/')
57
+ if not RUN_MODEL_SAVE_PATH:
58
+ RUN_MODEL_SAVE_PATH = os.path.join(HOME_CACHE_PATH, "models")
59
+ if not PREDICT_MODEL_SAVE_PATH:
60
+ PREDICT_MODEL_SAVE_PATH = os.path.join(HOME_CACHE_PATH, "models")
61
+ if not PREDICT_RESULT_SAVE_PATH:
62
+ PREDICT_RESULT_SAVE_PATH = os.path.join(HOME_CACHE_PATH, "predict_result")
63
+ if not BACKTEST_RESULT_SAVE_PATH:
64
+ BACKTEST_RESULT_SAVE_PATH = os.path.join(HOME_CACHE_PATH, "backtest_result")
65
+ if not RUN_RESULT_SAVE_PATH:
66
+ RUN_RESULT_SAVE_PATH = os.path.join(HOME_CACHE_PATH, "run_result")
67
+ if not EVALUATE_RESULT_SAVE_PATH:
68
+ EVALUATE_RESULT_SAVE_PATH = os.path.join(HOME_CACHE_PATH, "evaluate_result")
69
+ if not TEMP_SAVE_PATH:
70
+ TEMP_SAVE_PATH = os.path.join(HOME_CACHE_PATH, "temp")
71
+ if not CUSTOM_CACHE_PATH:
72
+ CUSTOM_CACHE_PATH = os.path.join(HOME_CACHE_PATH, "custom")
73
+ if not os.path.exists(CUSTOM_CACHE_PATH):
74
+ os.makedirs(CUSTOM_CACHE_PATH)
75
+ _init_file = os.path.join(CUSTOM_CACHE_PATH, "__init__.py")
76
+ with open(_init_file, "w") as f:
77
+ f.write("#")
78
+ sys.path.append(os.path.dirname(CUSTOM_CACHE_PATH))
79
+ MODEL_SAVE_NAME = "graph_model_{graph_id}"
80
+ ALGO_MODEL_SAVE_NAME = "algo_model_{graph_id}_{node_id}_{algo_mod_type}_{idx}"
81
+
82
+ # 运行模式 1: 包引用 2:grpc
83
+ RUN_PATTERN = 1
84
+
85
+ # redis设置
86
+ REDIS_DB = 3 if str(os.environ.get("PGP_NOT_DEV")) == "1" else 4
87
+ REDIS_KEY_TTL = 7 * 24 * 60 * 60 # 过期时间,默认7天
88
+
89
+ # celery 存储设置
90
+ CELERY_REDIS_HOST = None
91
+ CELERY_REDIS_PORT = None
92
+ CELERY_REDIS_DB = None
93
+
94
+
95
+ # 时间格式
96
+ DATETIME_FORMAT = "%H:%M:%S"
97
+ DATETIME_TOTAL_FORMAT = "%Y-%m-%d %H:%M:%S"
98
+ DATETIME_INPUT_FORMATS = [
99
+ "%Y-%m-%d %H:%M:%S",
100
+ ]
101
+
102
+ # 计算存储引擎
103
+ STORAGE_ENGINE = "file"
104
+
105
+ # 结构数据库配置
106
+ DATABASES = {
107
+ "ENGINE": "sqlite3",
108
+ "NAME": "PipeGraphPy",
109
+ }
110
+
111
+ # 数据库配置
112
+ DATABASES_POOL = None
113
+ # 数据库名称
114
+ DATABASE_NAME = None
115
+ DATABASE_SERVER_NAME = None
116
+ DATABASE_DB_NAME = None
117
+
118
+
119
+ # jupyter_type
120
+ # JUPYTER_TYPE = NotebookType.JUPYTER_LAB
121
+
122
+
123
+ # SDK是否显示log日志
124
+ SDK_SHOW_LOG = False
125
+