analyser_hj3415 3.0.5__tar.gz → 3.1.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/PKG-INFO +1 -1
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/compile.py +6 -6
- analyser_hj3415-3.1.0/analyser_hj3415/analyser/tsa/__init__.py +7 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/tsa/lstm.py +63 -37
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/tsa/prophet.py +52 -17
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/cli.py +31 -10
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/pyproject.toml +1 -1
- analyser_hj3415-3.0.5/analyser_hj3415/analyser/tsa/__init__.py +0 -2
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/.gitignore +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/README.md +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/__init__.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/__init__.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/eval/__init__.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/eval/blue.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/eval/common.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/eval/growth.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/eval/mil.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/analyser/eval/red.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/workroom/__init__.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/workroom/mysklearn.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/workroom/mysklearn2.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/workroom/score.py +0 -0
- {analyser_hj3415-3.0.5 → analyser_hj3415-3.1.0}/analyser_hj3415/workroom/trash.py +0 -0
@@ -19,7 +19,7 @@ class Compile:
|
|
19
19
|
self.name = mymongo.Corps.get_name(code)
|
20
20
|
self.red = eval.Red(code, expect_earn)
|
21
21
|
self.mil = eval.Mil(code)
|
22
|
-
self.prophet = tsa.
|
22
|
+
self.prophet = tsa.CorpProphet(code)
|
23
23
|
|
24
24
|
@property
|
25
25
|
def code(self) -> str:
|
@@ -102,13 +102,13 @@ class Compile:
|
|
102
102
|
def analyse_lstm_topn(refresh: bool, top=40):
|
103
103
|
ranking_topn = Compile.prophet_ranking(refresh=False, top=top)
|
104
104
|
mylogger.info(ranking_topn)
|
105
|
-
|
105
|
+
corp_lstm = tsa.CorpLSTM('005930')
|
106
106
|
print(f"*** LSTM prediction redis cashing top{top} items ***")
|
107
107
|
for i, (code, _) in enumerate(ranking_topn.items()):
|
108
|
-
|
109
|
-
print(f"{i + 1}. {
|
110
|
-
|
111
|
-
|
108
|
+
corp_lstm.code = code
|
109
|
+
print(f"{i + 1}. {corp_lstm.code}/{corp_lstm.name}")
|
110
|
+
corp_lstm.initializing()
|
111
|
+
corp_lstm.get_final_predictions(refresh=refresh, num=5)
|
112
112
|
|
113
113
|
@staticmethod
|
114
114
|
def red_ranking(expect_earn: float = 0.06, refresh=False) -> OrderedDict:
|
@@ -21,13 +21,14 @@ from dataclasses import dataclass
|
|
21
21
|
from utils_hj3415 import tools, setup_logger
|
22
22
|
from db_hj3415 import myredis
|
23
23
|
|
24
|
-
|
24
|
+
|
25
|
+
mylogger = setup_logger(__name__,'INFO')
|
25
26
|
expire_time = tools.to_int(os.getenv('DEFAULT_EXPIRE_TIME_H', 48)) * 3600
|
26
27
|
|
27
28
|
|
28
29
|
@dataclass
|
29
30
|
class LSTMData:
|
30
|
-
|
31
|
+
ticker: str
|
31
32
|
|
32
33
|
data_2d: np.ndarray
|
33
34
|
train_size: int
|
@@ -45,7 +46,7 @@ class LSTMGrade:
|
|
45
46
|
"""
|
46
47
|
딥러닝 모델의 학습 결과를 평가하기 위해 사용하는 데이터 클래스
|
47
48
|
"""
|
48
|
-
|
49
|
+
ticker: str
|
49
50
|
train_mse: float
|
50
51
|
train_mae: float
|
51
52
|
train_r2: float
|
@@ -55,20 +56,17 @@ class LSTMGrade:
|
|
55
56
|
|
56
57
|
|
57
58
|
class MyLSTM:
|
58
|
-
"""
|
59
|
-
LSTM(Long Short-Term Memory)
|
60
|
-
"""
|
61
59
|
# 미래 몇일을 예측할 것인가?
|
62
60
|
future_days = 30
|
63
61
|
|
64
|
-
def __init__(self,
|
65
|
-
|
66
|
-
self._code = code
|
67
|
-
self.name = myredis.Corps(code, 'c101').get_name()
|
62
|
+
def __init__(self, ticker: str):
|
63
|
+
mylogger.info(f'set up ticker : {ticker}')
|
68
64
|
self.scaler = MinMaxScaler(feature_range=(0, 1))
|
65
|
+
self._ticker = ticker
|
66
|
+
|
69
67
|
self.raw_data = pd.DataFrame()
|
70
68
|
self.lstm_data = LSTMData(
|
71
|
-
|
69
|
+
ticker=self.ticker,
|
72
70
|
data_2d=np.array([]),
|
73
71
|
train_size=0,
|
74
72
|
train_data_2d=np.array([]),
|
@@ -80,20 +78,18 @@ class MyLSTM:
|
|
80
78
|
)
|
81
79
|
|
82
80
|
@property
|
83
|
-
def
|
84
|
-
return self.
|
85
|
-
|
86
|
-
@code.setter
|
87
|
-
def code(self, code: str):
|
88
|
-
assert tools.is_6digit(code), f'Invalid value : {code}'
|
89
|
-
mylogger.debug(f'change code : {self.code} -> {code}')
|
81
|
+
def ticker(self) -> str:
|
82
|
+
return self._ticker
|
90
83
|
|
91
|
-
|
92
|
-
|
84
|
+
@ticker.setter
|
85
|
+
def ticker(self, ticker: str):
|
86
|
+
mylogger.info(f'change ticker : {self.ticker} -> {ticker}')
|
93
87
|
self.scaler = MinMaxScaler(feature_range=(0, 1))
|
88
|
+
self._ticker = ticker
|
89
|
+
|
94
90
|
self.raw_data = pd.DataFrame()
|
95
91
|
self.lstm_data = LSTMData(
|
96
|
-
|
92
|
+
ticker=self.ticker,
|
97
93
|
data_2d=np.array([]),
|
98
94
|
train_size=0,
|
99
95
|
train_data_2d=np.array([]),
|
@@ -127,7 +123,7 @@ class MyLSTM:
|
|
127
123
|
f"Get raw data from yfinance - start: {four_years_ago.strftime('%Y-%m-%d')}, end: {today.strftime('%Y-%m-%d')}")
|
128
124
|
|
129
125
|
df = yf.download(
|
130
|
-
self.
|
126
|
+
tickers=self.ticker,
|
131
127
|
start=four_years_ago.strftime('%Y-%m-%d'),
|
132
128
|
end=today.strftime('%Y-%m-%d')
|
133
129
|
)
|
@@ -175,7 +171,7 @@ class MyLSTM:
|
|
175
171
|
X_test_3d = X_test.reshape(X_test.shape[0], X_test.shape[1], 1)
|
176
172
|
except IndexError:
|
177
173
|
return LSTMData(
|
178
|
-
|
174
|
+
ticker=self.ticker,
|
179
175
|
data_2d=np.array([]),
|
180
176
|
train_size=0,
|
181
177
|
train_data_2d=np.array([]),
|
@@ -192,7 +188,7 @@ class MyLSTM:
|
|
192
188
|
f'len - X_train_3d : {len(X_train_3d)}, X_test_3d : {len(X_test_3d)}, y_train : {len(y_train_1d)}, y_test : {len(y_test_1d)}')
|
193
189
|
|
194
190
|
return LSTMData(
|
195
|
-
|
191
|
+
ticker=self.ticker,
|
196
192
|
data_2d=data_2d,
|
197
193
|
train_size=train_size,
|
198
194
|
train_data_2d=train_data_2d,
|
@@ -289,7 +285,7 @@ class MyLSTM:
|
|
289
285
|
if len(train_predictions) == 0 or len(test_predictions) == 0:
|
290
286
|
mylogger.warning("딥러닝 결과가 없어서 LSTMGrade 데이터를 비워서 반환합니다.")
|
291
287
|
return LSTMGrade(
|
292
|
-
|
288
|
+
ticker=self.ticker,
|
293
289
|
train_mse=float('nan'),
|
294
290
|
train_mae=float('nan'),
|
295
291
|
train_r2=float('nan'),
|
@@ -324,7 +320,7 @@ class MyLSTM:
|
|
324
320
|
# 과적합에 대한 평가는 train 과 test를 비교하여 test가 너무 않좋으면 과적합 의심.
|
325
321
|
|
326
322
|
return LSTMGrade(
|
327
|
-
|
323
|
+
ticker=self.ticker,
|
328
324
|
train_mse=train_mse,
|
329
325
|
train_mae=train_mae,
|
330
326
|
train_r2=train_r2,
|
@@ -388,11 +384,6 @@ class MyLSTM:
|
|
388
384
|
method which averages predictions to forecast future trends. Additionally, the function checks
|
389
385
|
and caches whether the predicted data demonstrates an increasing trend over time.
|
390
386
|
|
391
|
-
Attributes:
|
392
|
-
redis_name (str): f'{self.code}_mylstm_predictions'
|
393
|
-
future_data (dict): Dictionary containing dates (as keys) and predicted prices (as values).
|
394
|
-
lstm_grade (LSTMGrade): Performance evaluation grade for the LSTM prediction model.
|
395
|
-
|
396
387
|
Args:
|
397
388
|
refresh (bool): If True, forces recalculation and cache refresh of predictions.
|
398
389
|
num (int): Number of times to repeat ensemble training for more consistent predictions.
|
@@ -407,7 +398,7 @@ class MyLSTM:
|
|
407
398
|
not match during the data preparation.
|
408
399
|
"""
|
409
400
|
print("**** Start get_final_predictions... ****")
|
410
|
-
redis_name = f'{self.
|
401
|
+
redis_name = f'{self.ticker}_mylstm_predictions'
|
411
402
|
|
412
403
|
print(
|
413
404
|
f"redisname: '{redis_name}' / refresh : {refresh} / expire_time : {expire_time/3600}h")
|
@@ -422,7 +413,7 @@ class MyLSTM:
|
|
422
413
|
"""
|
423
414
|
|
424
415
|
print("**** Caching is_lstm_up ... ****")
|
425
|
-
redis_name = f'{self.
|
416
|
+
redis_name = f'{self.ticker}_is_lstm_up'
|
426
417
|
print(f"redisname: '{redis_name}' / expire_time : {expire_time / 3600}h")
|
427
418
|
|
428
419
|
|
@@ -614,11 +605,11 @@ class MyLSTM:
|
|
614
605
|
return graph_html
|
615
606
|
elif to == 'png':
|
616
607
|
# 그래프를 PNG 파일로 저장
|
617
|
-
fig.write_image(f"myLSTM_{self.
|
608
|
+
fig.write_image(f"myLSTM_{self.ticker}.png")
|
618
609
|
return None
|
619
610
|
elif to == 'htmlfile':
|
620
611
|
# 그래프를 HTML로 저장
|
621
|
-
plot(fig, filename=f'myLSTM_{self.
|
612
|
+
plot(fig, filename=f'myLSTM_{self.ticker}.html', auto_open=False)
|
622
613
|
return None
|
623
614
|
else:
|
624
615
|
Exception("to 인자가 맞지 않습니다.")
|
@@ -664,7 +655,7 @@ class MyLSTM:
|
|
664
655
|
plt.xlabel('Date')
|
665
656
|
plt.ylabel('Stock Price')
|
666
657
|
plt.legend()
|
667
|
-
plt.title(f'{self.
|
658
|
+
plt.title(f'{self.ticker} Stock Price Prediction with LSTM')
|
668
659
|
plt.show()
|
669
660
|
|
670
661
|
"""# 시각화2
|
@@ -687,8 +678,43 @@ class MyLSTM:
|
|
687
678
|
Returns:
|
688
679
|
bool: True if the LSTM model is active (up), False otherwise.
|
689
680
|
"""
|
690
|
-
return myredis.Base.get_value(f'{self.
|
681
|
+
return myredis.Base.get_value(f'{self.ticker}_is_lstm_up')
|
691
682
|
|
692
683
|
|
684
|
+
class CorpLSTM(MyLSTM):
|
685
|
+
def __init__(self, code: str):
|
686
|
+
assert tools.is_6digit(code), f'Invalid value : {code}'
|
687
|
+
self._code = code
|
688
|
+
self.name = myredis.Corps(code, 'c101').get_name()
|
689
|
+
super().__init__(ticker=self.code + '.KS')
|
693
690
|
|
691
|
+
@property
|
692
|
+
def code(self) -> str:
|
693
|
+
return self._code
|
694
|
+
|
695
|
+
@code.setter
|
696
|
+
def code(self, code: str):
|
697
|
+
assert tools.is_6digit(code), f'Invalid value : {code}'
|
698
|
+
self._code = code
|
699
|
+
self.name = myredis.Corps(code, 'c101').get_name()
|
700
|
+
self.ticker = self.code + '.KS'
|
701
|
+
|
702
|
+
|
703
|
+
class MILSTM(MyLSTM):
|
704
|
+
def __init__(self, mi_type: str):
|
705
|
+
from analyser_hj3415.analyser.tsa import MIs
|
706
|
+
assert mi_type in MIs.keys(), f"Invalid MI type ({MIs.keys()})"
|
707
|
+
self._mi_type = mi_type
|
708
|
+
super().__init__(ticker=MIs[mi_type])
|
709
|
+
|
710
|
+
@property
|
711
|
+
def mi_type(self) -> str:
|
712
|
+
return self._mi_type
|
713
|
+
|
714
|
+
@mi_type.setter
|
715
|
+
def mi_type(self, mi_type: str):
|
716
|
+
from analyser_hj3415.analyser.tsa import MIs
|
717
|
+
assert mi_type in MIs.keys(), f"Invalid MI type ({MIs.keys()})"
|
718
|
+
self._mi_type = mi_type
|
719
|
+
self.ticker = MIs[mi_type]
|
694
720
|
|
@@ -17,28 +17,27 @@ mylogger = setup_logger(__name__,'WARNING')
|
|
17
17
|
|
18
18
|
|
19
19
|
class MyProphet:
|
20
|
-
def __init__(self,
|
21
|
-
|
20
|
+
def __init__(self, ticker: str):
|
21
|
+
mylogger.info(f'set up ticker : {ticker}')
|
22
22
|
self.scaler = StandardScaler()
|
23
|
-
|
24
23
|
self.model = Prophet()
|
25
|
-
self.
|
26
|
-
|
24
|
+
self._ticker = ticker
|
25
|
+
|
27
26
|
self.raw_data = self._get_raw_data()
|
28
27
|
self.df_real = self._preprocessing_for_prophet()
|
29
28
|
self.df_forecast = self._make_forecast()
|
30
29
|
|
31
30
|
@property
|
32
|
-
def
|
33
|
-
return self.
|
31
|
+
def ticker(self) -> str:
|
32
|
+
return self._ticker
|
34
33
|
|
35
|
-
@
|
36
|
-
def
|
37
|
-
|
38
|
-
|
34
|
+
@ticker.setter
|
35
|
+
def ticker(self, ticker: str):
|
36
|
+
mylogger.info(f'change ticker : {self.ticker} -> {ticker}')
|
37
|
+
self.scaler = StandardScaler()
|
39
38
|
self.model = Prophet()
|
40
|
-
self.
|
41
|
-
|
39
|
+
self._ticker = ticker
|
40
|
+
|
42
41
|
self.raw_data = self._get_raw_data()
|
43
42
|
self.df_real = self._preprocessing_for_prophet()
|
44
43
|
self.df_forecast = self._make_forecast()
|
@@ -65,7 +64,7 @@ class MyProphet:
|
|
65
64
|
four_years_ago = today - timedelta(days=365 * 4)
|
66
65
|
|
67
66
|
return yf.download(
|
68
|
-
self.
|
67
|
+
tickers=self.ticker,
|
69
68
|
start=four_years_ago.strftime('%Y-%m-%d'),
|
70
69
|
end=today.strftime('%Y-%m-%d')
|
71
70
|
)
|
@@ -168,11 +167,11 @@ class MyProphet:
|
|
168
167
|
return graph_html
|
169
168
|
elif to == 'png':
|
170
169
|
# 그래프를 PNG 파일로 저장
|
171
|
-
fig.write_image(f"myprophet_{self.
|
170
|
+
fig.write_image(f"myprophet_{self.ticker}.png")
|
172
171
|
return None
|
173
172
|
elif to == 'htmlfile':
|
174
173
|
# 그래프를 HTML로 저장
|
175
|
-
plot(fig, filename=f'myprophet_{self.
|
174
|
+
plot(fig, filename=f'myprophet_{self.ticker}.html', auto_open=False)
|
176
175
|
return None
|
177
176
|
else:
|
178
177
|
Exception("to 인자가 맞지 않습니다.")
|
@@ -220,7 +219,7 @@ class MyProphet:
|
|
220
219
|
if recent_price <= yhat_upper:
|
221
220
|
selling_score = -selling_score
|
222
221
|
|
223
|
-
mylogger.info(f"{self.
|
222
|
+
mylogger.info(f"{self.ticker} date: {recent_date} 가격: {recent_price}"
|
224
223
|
f" yhat_lower:{yhat_lower} yhat_upper:{yhat_upper}"
|
225
224
|
f" buying_score:{buying_score} selling_score:{selling_score}")
|
226
225
|
|
@@ -232,3 +231,39 @@ class MyProphet:
|
|
232
231
|
return 'hold', 0
|
233
232
|
|
234
233
|
|
234
|
+
class CorpProphet(MyProphet):
|
235
|
+
def __init__(self, code: str):
|
236
|
+
assert tools.is_6digit(code), f'Invalid value : {code}'
|
237
|
+
self._code = code
|
238
|
+
self.name = myredis.Corps(code, 'c101').get_name()
|
239
|
+
super().__init__(ticker=self.code + '.KS')
|
240
|
+
|
241
|
+
@property
|
242
|
+
def code(self) -> str:
|
243
|
+
return self._code
|
244
|
+
|
245
|
+
@code.setter
|
246
|
+
def code(self, code: str):
|
247
|
+
assert tools.is_6digit(code), f'Invalid value : {code}'
|
248
|
+
self._code = code
|
249
|
+
self.name = myredis.Corps(code, 'c101').get_name()
|
250
|
+
self.ticker = self.code + '.KS'
|
251
|
+
|
252
|
+
|
253
|
+
class MIProphet(MyProphet):
|
254
|
+
def __init__(self, mi_type: str):
|
255
|
+
from analyser_hj3415.analyser.tsa import MIs
|
256
|
+
assert mi_type in MIs.keys(), f"Invalid MI type ({MIs.keys()})"
|
257
|
+
self._mi_type = mi_type
|
258
|
+
super().__init__(ticker=MIs[mi_type])
|
259
|
+
|
260
|
+
@property
|
261
|
+
def mi_type(self) -> str:
|
262
|
+
return self._mi_type
|
263
|
+
|
264
|
+
@mi_type.setter
|
265
|
+
def mi_type(self, mi_type: str):
|
266
|
+
from analyser_hj3415.analyser.tsa import MIs
|
267
|
+
assert mi_type in MIs.keys(), f"Invalid MI type ({MIs.keys()})"
|
268
|
+
self._mi_type = mi_type
|
269
|
+
self.ticker = MIs[mi_type]
|
@@ -7,26 +7,32 @@ from db_hj3415 import myredis, mymongo
|
|
7
7
|
|
8
8
|
|
9
9
|
def analyser_manager():
|
10
|
+
from analyser_hj3415.analyser.tsa import MIs
|
10
11
|
parser = argparse.ArgumentParser(description="Analyser Commands")
|
11
12
|
type_subparsers = parser.add_subparsers(dest='type', help='분석 타입')
|
12
13
|
|
13
14
|
# prophet 명령어 서브파서
|
14
15
|
prophet_parser = type_subparsers.add_parser('prophet', help='MyProphet 타입')
|
15
16
|
prophet_subparser = prophet_parser.add_subparsers(dest='command', help='prophet 관련된 명령')
|
16
|
-
# ranking 파서
|
17
|
+
# prophet - ranking 파서
|
17
18
|
ranking_parser = prophet_subparser.add_parser('ranking', help='prophet 랭킹 책정 및 레디스 저장')
|
18
19
|
ranking_parser.add_argument('-r', '--refresh', action='store_true', help='래디스 캐시를 사용하지 않고 강제로 재계산 할지')
|
20
|
+
# prophet - score 파서
|
21
|
+
prophet_get_parser = prophet_subparser.add_parser('score', help='prophet score 계산')
|
22
|
+
prophet_get_parser.add_argument('target', type=str, help=f'종목코드 or {list(MIs.keys())}')
|
23
|
+
prophet_get_parser.add_argument('-r', '--refresh', action='store_true', help='래디스 캐시를 사용하지 않고 강제로 재계산 할지')
|
19
24
|
|
20
25
|
# lstm 명령어 서브파서
|
21
26
|
lstm_parser = type_subparsers.add_parser('lstm', help='MyLSTM 타입')
|
22
27
|
lstm_subparser = lstm_parser.add_subparsers(dest='command', help='lstm 관련된 명령')
|
23
|
-
# caching 파서
|
28
|
+
# lstm - caching 파서
|
24
29
|
caching_parser = lstm_subparser.add_parser('caching', help='lstm 랭킹 책정 및 레디스 저장')
|
25
30
|
caching_parser.add_argument('-r', '--refresh', action='store_true', help='래디스 캐시를 사용하지 않고 강제로 재계산 할지')
|
26
31
|
caching_parser.add_argument('-t', '--top', type=int, help='prophet ranking 몇위까지 작업을 할지')
|
27
|
-
#
|
28
|
-
lstm_get_parser = lstm_subparser.add_parser('
|
29
|
-
lstm_get_parser.add_argument('
|
32
|
+
# lstm - predict 파서
|
33
|
+
lstm_get_parser = lstm_subparser.add_parser('predict', help='lstm get final prediction 시행')
|
34
|
+
lstm_get_parser.add_argument('target', type=str, help=f'종목코드 or {list(MIs.keys())}')
|
35
|
+
lstm_get_parser.add_argument('-n', '--num', type=int, default=5, help='ensemble training 횟수 설정')
|
30
36
|
lstm_get_parser.add_argument('-r', '--refresh', action='store_true', help='래디스 캐시를 사용하지 않고 강제로 재계산 할지')
|
31
37
|
|
32
38
|
# red 명령어 서브파서
|
@@ -150,6 +156,15 @@ def analyser_manager():
|
|
150
156
|
result = compile.Compile.prophet_ranking(refresh=args.refresh)
|
151
157
|
print(result)
|
152
158
|
mymongo.Logs.save('cli','INFO', 'run >> analyser prophet ranking')
|
159
|
+
elif args.command == 'score':
|
160
|
+
if args.target in MIs.keys():
|
161
|
+
myprophet = tsa.MIProphet(args.target)
|
162
|
+
elif tools.is_6digit(args.target):
|
163
|
+
myprophet = tsa.CorpProphet(args.target)
|
164
|
+
else:
|
165
|
+
raise Exception("Invalid target")
|
166
|
+
print(myprophet.scoring())
|
167
|
+
# mymongo.Logs.save('cli','INFO', f'run >> analyser prophet get {args.target}')
|
153
168
|
|
154
169
|
elif args.type == 'lstm':
|
155
170
|
if args.command == 'caching':
|
@@ -158,11 +173,17 @@ def analyser_manager():
|
|
158
173
|
else:
|
159
174
|
compile.Compile.analyse_lstm_topn(refresh=args.refresh)
|
160
175
|
mymongo.Logs.save('cli','INFO', f'run >> analyser lstm caching / top={args.top if args.top else 20}')
|
161
|
-
elif args.command == '
|
162
|
-
|
163
|
-
|
176
|
+
elif args.command == 'predict':
|
177
|
+
if args.target in MIs.keys():
|
178
|
+
mylstm = tsa.MILSTM(args.target)
|
179
|
+
elif tools.is_6digit(args.target):
|
180
|
+
mylstm = tsa.CorpLSTM(args.target)
|
181
|
+
else:
|
182
|
+
raise Exception("Invalid target")
|
164
183
|
mylstm.initializing()
|
165
|
-
mylstm.get_final_predictions(refresh=args.refresh, num=
|
166
|
-
|
184
|
+
future_data, grade = mylstm.get_final_predictions(refresh=args.refresh, num=args.num)
|
185
|
+
print(future_data)
|
186
|
+
print(grade)
|
187
|
+
# mymongo.Logs.save('cli','INFO', f'run >> analyser lstm get {args.target}')
|
167
188
|
else:
|
168
189
|
parser.print_help()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|