logo
Loading...

請問Part1_data_collector的SELECT_CODE上限? - Cupoy

課程中建議的SELECT_CODE是5~30支股票,只有說太長可能影響計算速度。(TRAIN_NUM...

請問Part1_data_collector的SELECT_CODE上限?

2021/01/10 上午 11:30
《用 Python 打造你的 AI 股票交易引擎》業界專家實戰教學
larry wong
觀看數:22
回答數:1
收藏數:0

課程中建議的SELECT_CODE是5~30支股票,只有說太長可能影響計算速度。 (TRAIN_NUM課程中提到上限900) 我在輸入50支股票後(TRAIN_NUM保持原本的50)Part12沒有出現錯誤,在part3出現錯誤,這個錯誤在減少輸入股票支數重新跑Part123後就沒有了,是不是設計上SELECT_CODE有一個輸入上限?不能超過30支? Part3跑50支的結果卡錯誤在第一個歸因圖表,圖表以上都有算出結果: ![image](http://kwassistfile.cupoy.com/00000176EA1307D0000000066375706F795F72656C656173655155455354/1610076223374/large) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_axes.py in _parse_scatter_color_args(c, edgecolors, kwargs, xsize, get_next_color_func) 4290 try: # Is 'c' acceptable as PathCollection facecolors? -> 4291 colors = mcolors.to_rgba_array(c) 4292 except (TypeError, ValueError) as err: C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba_array(c, alpha) 340 else: --> 341 return np.array([to_rgba(cc, alpha) for cc in c]) 342 C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in (.0) 340 else: --> 341 return np.array([to_rgba(cc, alpha) for cc in c]) 342 C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha) 188 if rgba is None: # Suppress exception chaining of cache lookup failure. --> 189 rgba = _to_rgba_no_colorcycle(c, alpha) 190 try: C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\colors.py in _to_rgba_no_colorcycle(c, alpha) 262 if not np.iterable(c): --> 263 raise ValueError(f"Invalid RGBA argument: {orig_c!r}") 264 if len(c) not in [3, 4]: ValueError: Invalid RGBA argument: 20.373526738093577 The above exception was the direct cause of the following exception: ValueError Traceback (most recent call last) in 7 model_2d60 = cs.load_model(data_2d, model_file='2d_60D_model') 8 model_60 = cs.blending_model([model_1d60, model_2d60], [0.7]) ----> 9 cs.predict_result(trading_params=TRADING_PARAMS, model_d1=model_1, model_d60=model_60) ~\CH4_CStock_v1_0_5\cstock.py in predict_result(trading_params, model_d1, model_d60) 1432 data = data[['history_std', 'pred_60', 'original_ratio']].values 1433 plt.figure(figsize=(15,8)) -> 1434 plt.scatter(data[:, 0], data[:, 1], marker='o', c=data[:, 2], s=100, cmap=plt.get_cmap('Spectral')) 1435 plt.grid(axis='y', which='major') 1436 for label, x, y in zip(labels, data[:, 0], data[:, 1]): C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\pyplot.py in scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, plotnonfinite, data, **kwargs) 2888 verts=cbook.deprecation._deprecated_parameter, 2889 edgecolors=None, *, plotnonfinite=False, data=None, **kwargs): -> 2890 __ret = gca().scatter( 2891 x, y, s=s, c=c, marker=marker, cmap=cmap, norm=norm, 2892 vmin=vmin, vmax=vmax, alpha=alpha, linewidths=linewidths, C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py in inner(ax, data, *args, **kwargs) 1436 def inner(ax, *args, data=None, **kwargs): 1437 if data is None: -> 1438 return func(ax, *map(sanitize_sequence, args), **kwargs) 1439 1440 bound = new_sig.bind(ax, *args, **kwargs) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\deprecation.py in wrapper(*inner_args, **inner_kwargs) 409 else deprecation_addendum, 410 **kwargs) --> 411 return func(*inner_args, **inner_kwargs) 412 413 return wrapper C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, plotnonfinite, **kwargs) 4449 4450 c, colors, edgecolors = \ -> 4451 self._parse_scatter_color_args( 4452 c, edgecolors, kwargs, x.size, 4453 get_next_color_func=self._get_patches_for_fill.get_next_color) C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_axes.py in _parse_scatter_color_args(c, edgecolors, kwargs, xsize, get_next_color_func) 4298 # Both the mapping *and* the RGBA conversion failed: pretty 4299 # severe failure => one may appreciate a verbose feedback. -> 4300 raise ValueError( 4301 f"'c' argument must be a color, a sequence of colors, " 4302 f"or a sequence of numbers, not {c}") from err ValueError: 'c' argument must be a color, a sequence of colors, or a sequence of numbers, not [20.373526738093577 16.50677992447601 15.882760640826762 15.755811671402201 14.454470511534115 14.121481054769907 13.348520001507747 13.067388017529725 12.28030020491964 12.267512274093352 12.18232540879931 11.821856940544068 11.720813315157985 11.710606875495355 11.581327824097599 11.217666802309543 10.839959253899604 10.621793644938284 10.41248172147314 10.410877510428916 9.967139657228358 9.746209079751244 9.54330377261395 9.242620018790628 9.217386198438406 9.065395912452393 array([], dtype=float32) 9.031458602273373 9.001873738433193 8.979363670472559 8.881933706517268 8.82152854767326 8.677823254016477 8.657105662820689 8.610432800155102 8.575529225872787 8.53812757086137 8.1877691563733 7.899450508618987 7.830638492688386 7.801773902660511 7.753989821101697 7.702642262892316 7.5930390773995144 7.489455900314268 7.330665280447798 7.186673497230666 7.164132353438044 6.634222641872979 6.292375518039769 5.978305088018085 5.660637850351244 5.599122949693892] ![image](http://kwassistfile.cupoy.com/00000176EA1307D0000000066375706F795F72656C656173655155455354/1610076223375/large) ![image](http://kwassistfile.cupoy.com/00000176EA1307D0000000066375706F795F72656C656173655155455354/1610076223378/large)

回答列表

  • 2021/01/12 上午 10:55
    CUPOY
    贊同數:0
    不贊同數:0
    留言數:0

    同學 您好,


    感謝您的提問,我們已經通知專家,會盡快回覆您的問題。