复制链接
克隆策略

    {"description":"实验创建于2017/8/26","graph":{"edges":[{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"to_node_id":"-106:instruments","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8:data"},{"to_node_id":"-773:input_1","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15:data"},{"to_node_id":"-106:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-113:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-243:features","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-768:input_2","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"to_node_id":"-243:input_data","from_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data"},{"to_node_id":"-113:input_data","from_node_id":"-106:data"},{"to_node_id":"-768:input_1","from_node_id":"-113:data"},{"to_node_id":"-168:inputs","from_node_id":"-160:data"},{"to_node_id":"-682:inputs","from_node_id":"-160:data"},{"to_node_id":"-224:inputs","from_node_id":"-168:data"},{"to_node_id":"-231:inputs","from_node_id":"-196:data"},{"to_node_id":"-196:inputs","from_node_id":"-224:data"},{"to_node_id":"-238:inputs","from_node_id":"-231:data"},{"to_node_id":"-682:outputs","from_node_id":"-238:data"},{"to_node_id":"-1098:input_model","from_node_id":"-682:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data2","from_node_id":"-768:data"},{"to_node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53:data1","from_node_id":"-773:data"},{"to_node_id":"-1098:training_data","from_node_id":"-243:data"}],"nodes":[{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8","module_id":"BigQuantSpace.instruments.instruments-v2","parameters":[{"name":"start_date","value":"2010-01-01","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"2015-12-31","type":"Literal","bound_global_parameter":null},{"name":"market","value":"CN_STOCK_A","type":"Literal","bound_global_parameter":null},{"name":"instrument_list","value":"","type":"Literal","bound_global_parameter":null},{"name":"max_count","value":"0","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"rolling_conf","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-8"}],"cacheable":true,"seq_num":1,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15","module_id":"BigQuantSpace.advanced_auto_labeler.advanced_auto_labeler-v2","parameters":[{"name":"label_expr","value":"# #号开始的表示注释\n# 0. 每行一个,顺序执行,从第二个开始,可以使用label字段\n# 1. 可用数据字段见 https://bigquant.com/docs/data_history_data.html\n# 添加benchmark_前缀,可使用对应的benchmark数据\n# 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/big_expr.html>`_\n\n# 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)\nshift(close, -5) / shift(open, -1)-1\n\n# 极值处理:用1%和99%分位的值做clip\nclip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))\n\n# 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)\nwhere(shift(high, -1) == shift(low, -1), NaN, label)\n","type":"Literal","bound_global_parameter":null},{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"benchmark","value":"000300.SHA","type":"Literal","bound_global_parameter":null},{"name":"drop_na_label","value":"True","type":"Literal","bound_global_parameter":null},{"name":"cast_label_int","value":"False","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-15"}],"cacheable":true,"seq_num":2,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","module_id":"BigQuantSpace.input_features.input_features-v1","parameters":[{"name":"features","value":"close_0/mean(close_0,5)\nclose_0/mean(close_0,10)\nclose_0/mean(close_0,20)\nclose_0/open_0\nopen_0/mean(close_0,5)\nopen_0/mean(close_0,10)\nopen_0/mean(close_0,20)","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"features_ds","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"cacheable":false,"seq_num":3,"comment":"","comment_collapsed":true},{"node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53","module_id":"BigQuantSpace.join.join-v3","parameters":[{"name":"on","value":"date,instrument","type":"Literal","bound_global_parameter":null},{"name":"how","value":"inner","type":"Literal","bound_global_parameter":null},{"name":"sort","value":"False","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"data1","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"},{"name":"data2","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"output_ports":[{"name":"data","node_id":"287d2cb0-f53c-4101-bdf8-104b137c8601-53"}],"cacheable":true,"seq_num":7,"comment":"","comment_collapsed":true},{"node_id":"-106","module_id":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v7","parameters":[{"name":"start_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"end_date","value":"","type":"Literal","bound_global_parameter":null},{"name":"before_start_days","value":0,"type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"instruments","node_id":"-106"},{"name":"features","node_id":"-106"}],"output_ports":[{"name":"data","node_id":"-106"}],"cacheable":true,"seq_num":15,"comment":"","comment_collapsed":true},{"node_id":"-113","module_id":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","parameters":[{"name":"date_col","value":"date","type":"Literal","bound_global_parameter":null},{"name":"instrument_col","value":"instrument","type":"Literal","bound_global_parameter":null},{"name":"drop_na","value":"True","type":"Literal","bound_global_parameter":null},{"name":"remove_extra_columns","value":"False","type":"Literal","bound_global_parameter":null},{"name":"user_functions","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-113"},{"name":"features","node_id":"-113"}],"output_ports":[{"name":"data","node_id":"-113"}],"cacheable":true,"seq_num":16,"comment":"","comment_collapsed":true},{"node_id":"-160","module_id":"BigQuantSpace.dl_layer_input.dl_layer_input-v1","parameters":[{"name":"shape","value":"7","type":"Literal","bound_global_parameter":null},{"name":"batch_shape","value":"","type":"Literal","bound_global_parameter":null},{"name":"dtype","value":"float32","type":"Literal","bound_global_parameter":null},{"name":"sparse","value":"False","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-160"}],"output_ports":[{"name":"data","node_id":"-160"}],"cacheable":false,"seq_num":6,"comment":"","comment_collapsed":true},{"node_id":"-168","module_id":"BigQuantSpace.dl_layer_dense.dl_layer_dense-v1","parameters":[{"name":"units","value":"256","type":"Literal","bound_global_parameter":null},{"name":"activation","value":"relu","type":"Literal","bound_global_parameter":null},{"name":"user_activation","value":"","type":"Literal","bound_global_parameter":null},{"name":"use_bias","value":"True","type":"Literal","bound_global_parameter":null},{"name":"kernel_initializer","value":"glorot_uniform","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_initializer","value":"Zeros","type":"Literal","bound_global_parameter":null},{"name":"user_bias_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_kernel_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_bias_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_activity_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_bias_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-168"}],"output_ports":[{"name":"data","node_id":"-168"}],"cacheable":false,"seq_num":8,"comment":"","comment_collapsed":true},{"node_id":"-196","module_id":"BigQuantSpace.dl_layer_dense.dl_layer_dense-v1","parameters":[{"name":"units","value":"128","type":"Literal","bound_global_parameter":null},{"name":"activation","value":"relu","type":"Literal","bound_global_parameter":null},{"name":"user_activation","value":"","type":"Literal","bound_global_parameter":null},{"name":"use_bias","value":"True","type":"Literal","bound_global_parameter":null},{"name":"kernel_initializer","value":"glorot_uniform","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_initializer","value":"Zeros","type":"Literal","bound_global_parameter":null},{"name":"user_bias_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_kernel_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_bias_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_activity_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_bias_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-196"}],"output_ports":[{"name":"data","node_id":"-196"}],"cacheable":false,"seq_num":20,"comment":"","comment_collapsed":true},{"node_id":"-224","module_id":"BigQuantSpace.dl_layer_dropout.dl_layer_dropout-v1","parameters":[{"name":"rate","value":"0.1","type":"Literal","bound_global_parameter":null},{"name":"noise_shape","value":"","type":"Literal","bound_global_parameter":null},{"name":"seed","value":"","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-224"}],"output_ports":[{"name":"data","node_id":"-224"}],"cacheable":false,"seq_num":21,"comment":"","comment_collapsed":true},{"node_id":"-231","module_id":"BigQuantSpace.dl_layer_dropout.dl_layer_dropout-v1","parameters":[{"name":"rate","value":"0.1","type":"Literal","bound_global_parameter":null},{"name":"noise_shape","value":"","type":"Literal","bound_global_parameter":null},{"name":"seed","value":"","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-231"}],"output_ports":[{"name":"data","node_id":"-231"}],"cacheable":false,"seq_num":22,"comment":"","comment_collapsed":true},{"node_id":"-238","module_id":"BigQuantSpace.dl_layer_dense.dl_layer_dense-v1","parameters":[{"name":"units","value":"1","type":"Literal","bound_global_parameter":null},{"name":"activation","value":"linear","type":"Literal","bound_global_parameter":null},{"name":"user_activation","value":"","type":"Literal","bound_global_parameter":null},{"name":"use_bias","value":"True","type":"Literal","bound_global_parameter":null},{"name":"kernel_initializer","value":"glorot_uniform","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_initializer","value":"Zeros","type":"Literal","bound_global_parameter":null},{"name":"user_bias_initializer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"kernel_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_kernel_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"bias_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_bias_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer","value":"None","type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l1","value":0,"type":"Literal","bound_global_parameter":null},{"name":"activity_regularizer_l2","value":0,"type":"Literal","bound_global_parameter":null},{"name":"user_activity_regularizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"kernel_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_kernel_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"bias_constraint","value":"None","type":"Literal","bound_global_parameter":null},{"name":"user_bias_constraint","value":"","type":"Literal","bound_global_parameter":null},{"name":"name","value":"","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"inputs","node_id":"-238"}],"output_ports":[{"name":"data","node_id":"-238"}],"cacheable":false,"seq_num":23,"comment":"","comment_collapsed":true},{"node_id":"-682","module_id":"BigQuantSpace.dl_model_init.dl_model_init-v1","parameters":[],"input_ports":[{"name":"inputs","node_id":"-682"},{"name":"outputs","node_id":"-682"}],"output_ports":[{"name":"data","node_id":"-682"}],"cacheable":false,"seq_num":4,"comment":"","comment_collapsed":true},{"node_id":"-1098","module_id":"BigQuantSpace.dl_model_train.dl_model_train-v1","parameters":[{"name":"optimizer","value":"Adam","type":"Literal","bound_global_parameter":null},{"name":"user_optimizer","value":"","type":"Literal","bound_global_parameter":null},{"name":"loss","value":"mean_squared_error","type":"Literal","bound_global_parameter":null},{"name":"user_loss","value":"","type":"Literal","bound_global_parameter":null},{"name":"metrics","value":"mse","type":"Literal","bound_global_parameter":null},{"name":"batch_size","value":"1024","type":"Literal","bound_global_parameter":null},{"name":"epochs","value":"5","type":"Literal","bound_global_parameter":null},{"name":"earlystop","value":"","type":"Literal","bound_global_parameter":null},{"name":"custom_objects","value":"# 用户的自定义层需要写到字典中,比如\n# {\n# \"MyLayer\": MyLayer\n# }\nbigquant_run = {\n \n}\n","type":"Literal","bound_global_parameter":null},{"name":"n_gpus","value":0,"type":"Literal","bound_global_parameter":null},{"name":"verbose","value":"2:每个epoch输出一行记录","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_model","node_id":"-1098"},{"name":"training_data","node_id":"-1098"},{"name":"validation_data","node_id":"-1098"}],"output_ports":[{"name":"data","node_id":"-1098"}],"cacheable":true,"seq_num":5,"comment":"","comment_collapsed":true},{"node_id":"-768","module_id":"BigQuantSpace.standardlize.standardlize-v8","parameters":[{"name":"columns_input","value":"[]","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-768"},{"name":"input_2","node_id":"-768"}],"output_ports":[{"name":"data","node_id":"-768"}],"cacheable":true,"seq_num":14,"comment":"","comment_collapsed":true},{"node_id":"-773","module_id":"BigQuantSpace.standardlize.standardlize-v8","parameters":[{"name":"columns_input","value":"label","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_1","node_id":"-773"},{"name":"input_2","node_id":"-773"}],"output_ports":[{"name":"data","node_id":"-773"}],"cacheable":false,"seq_num":13,"comment":"","comment_collapsed":true},{"node_id":"-243","module_id":"BigQuantSpace.dl_convert_to_bin.dl_convert_to_bin-v2","parameters":[{"name":"window_size","value":1,"type":"Literal","bound_global_parameter":null},{"name":"feature_clip","value":5,"type":"Literal","bound_global_parameter":null},{"name":"flatten","value":"True","type":"Literal","bound_global_parameter":null},{"name":"window_along_col","value":"instrument","type":"Literal","bound_global_parameter":null}],"input_ports":[{"name":"input_data","node_id":"-243"},{"name":"features","node_id":"-243"}],"output_ports":[{"name":"data","node_id":"-243"}],"cacheable":true,"seq_num":26,"comment":"","comment_collapsed":true}],"node_layout":"<node_postions><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-8' Position='207,58,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-15' Position='131,205,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-24' Position='766,2,200,200'/><node_position Node='287d2cb0-f53c-4101-bdf8-104b137c8601-53' Position='301,459,200,200'/><node_position Node='-106' Position='412,184,200,200'/><node_position Node='-113' Position='428,278,200,200'/><node_position Node='-160' Position='-202,33,200,200'/><node_position Node='-168' Position='-201,148,200,200'/><node_position Node='-196' Position='-203,311,200,200'/><node_position Node='-224' Position='-203,239,200,200'/><node_position Node='-231' Position='-201,395,200,200'/><node_position Node='-238' Position='-198,470,200,200'/><node_position Node='-682' Position='-194,560,200,200'/><node_position Node='-1098' Position='-50,765,200,200'/><node_position Node='-768' Position='454,369,200,200'/><node_position Node='-773' Position='137,329,200,200'/><node_position Node='-243' Position='294,543,200,200'/></node_postions>"},"nodes_readonly":false,"studio_version":"v2"}
    In [1]:
    # 本代码由可视化策略环境自动生成 2021年12月14日 18:11
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # 用户的自定义层需要写到字典中,比如
    # {
    #   "MyLayer": MyLayer
    # }
    m5_custom_objects_bigquant_run = {
        
    }
    
    
    m1 = M.instruments.v2(
        start_date='2010-01-01',
        end_date='2015-12-31',
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m2 = M.advanced_auto_labeler.v2(
        instruments=m1.data,
        label_expr="""# #号开始的表示注释
    # 0. 每行一个,顺序执行,从第二个开始,可以使用label字段
    # 1. 可用数据字段见 https://bigquant.com/docs/data_history_data.html
    #   添加benchmark_前缀,可使用对应的benchmark数据
    # 2. 可用操作符和函数见 `表达式引擎 <https://bigquant.com/docs/big_expr.html>`_
    
    # 计算收益:5日收盘价(作为卖出价格)除以明日开盘价(作为买入价格)
    shift(close, -5) / shift(open, -1)-1
    
    # 极值处理:用1%和99%分位的值做clip
    clip(label, all_quantile(label, 0.01), all_quantile(label, 0.99))
    
    # 过滤掉一字涨停的情况 (设置label为NaN,在后续处理和训练中会忽略NaN的label)
    where(shift(high, -1) == shift(low, -1), NaN, label)
    """,
        start_date='',
        end_date='',
        benchmark='000300.SHA',
        drop_na_label=True,
        cast_label_int=False
    )
    
    m13 = M.standardlize.v8(
        input_1=m2.data,
        columns_input='label',
        m_cached=False
    )
    
    m3 = M.input_features.v1(
        features="""close_0/mean(close_0,5)
    close_0/mean(close_0,10)
    close_0/mean(close_0,20)
    close_0/open_0
    open_0/mean(close_0,5)
    open_0/mean(close_0,10)
    open_0/mean(close_0,20)""",
        m_cached=False
    )
    
    m15 = M.general_feature_extractor.v7(
        instruments=m1.data,
        features=m3.data,
        start_date='',
        end_date='',
        before_start_days=0
    )
    
    m16 = M.derived_feature_extractor.v3(
        input_data=m15.data,
        features=m3.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=True,
        remove_extra_columns=False
    )
    
    m14 = M.standardlize.v8(
        input_1=m16.data,
        input_2=m3.data,
        columns_input='[]'
    )
    
    m7 = M.join.v3(
        data1=m13.data,
        data2=m14.data,
        on='date,instrument',
        how='inner',
        sort=False
    )
    
    m26 = M.dl_convert_to_bin.v2(
        input_data=m7.data,
        features=m3.data,
        window_size=1,
        feature_clip=5,
        flatten=True,
        window_along_col='instrument'
    )
    
    m6 = M.dl_layer_input.v1(
        shape='7',
        batch_shape='',
        dtype='float32',
        sparse=False,
        name=''
    )
    
    m8 = M.dl_layer_dense.v1(
        inputs=m6.data,
        units=256,
        activation='relu',
        use_bias=True,
        kernel_initializer='glorot_uniform',
        bias_initializer='Zeros',
        kernel_regularizer='None',
        kernel_regularizer_l1=0,
        kernel_regularizer_l2=0,
        bias_regularizer='None',
        bias_regularizer_l1=0,
        bias_regularizer_l2=0,
        activity_regularizer='None',
        activity_regularizer_l1=0,
        activity_regularizer_l2=0,
        kernel_constraint='None',
        bias_constraint='None',
        name=''
    )
    
    m21 = M.dl_layer_dropout.v1(
        inputs=m8.data,
        rate=0.1,
        noise_shape='',
        name=''
    )
    
    m20 = M.dl_layer_dense.v1(
        inputs=m21.data,
        units=128,
        activation='relu',
        use_bias=True,
        kernel_initializer='glorot_uniform',
        bias_initializer='Zeros',
        kernel_regularizer='None',
        kernel_regularizer_l1=0,
        kernel_regularizer_l2=0,
        bias_regularizer='None',
        bias_regularizer_l1=0,
        bias_regularizer_l2=0,
        activity_regularizer='None',
        activity_regularizer_l1=0,
        activity_regularizer_l2=0,
        kernel_constraint='None',
        bias_constraint='None',
        name=''
    )
    
    m22 = M.dl_layer_dropout.v1(
        inputs=m20.data,
        rate=0.1,
        noise_shape='',
        name=''
    )
    
    m23 = M.dl_layer_dense.v1(
        inputs=m22.data,
        units=1,
        activation='linear',
        use_bias=True,
        kernel_initializer='glorot_uniform',
        bias_initializer='Zeros',
        kernel_regularizer='None',
        kernel_regularizer_l1=0,
        kernel_regularizer_l2=0,
        bias_regularizer='None',
        bias_regularizer_l1=0,
        bias_regularizer_l2=0,
        activity_regularizer='None',
        activity_regularizer_l1=0,
        activity_regularizer_l2=0,
        kernel_constraint='None',
        bias_constraint='None',
        name=''
    )
    
    m4 = M.dl_model_init.v1(
        inputs=m6.data,
        outputs=m23.data
    )
    
    m5 = M.dl_model_train.v1(
        input_model=m4.data,
        training_data=m26.data,
        optimizer='Adam',
        loss='mean_squared_error',
        metrics='mse',
        batch_size=1024,
        epochs=5,
        custom_objects=m5_custom_objects_bigquant_run,
        n_gpus=0,
        verbose='2:每个epoch输出一行记录'
    )
    
    Epoch 1/5
    3061/3061 - 14s - loss: 0.9903 - mse: 0.9903
    Epoch 2/5
    3061/3061 - 13s - loss: 0.9891 - mse: 0.9891
    Epoch 3/5
    3061/3061 - 16s - loss: 0.9888 - mse: 0.9888
    Epoch 4/5
    3061/3061 - 13s - loss: 0.9886 - mse: 0.9886
    Epoch 5/5
    3061/3061 - 10s - loss: 0.9885 - mse: 0.9885
    
    In [6]:
    m5.data.read()
    
    Out[6]:
    {'model_graph': 'backend: tensorflow\nclass_name: Functional\nconfig:\n  input_layers:\n  - - L0\n    - 0\n    - 0\n  layers:\n  - class_name: InputLayer\n    config:\n      batch_input_shape: !!python/tuple\n      - null\n      - 7\n      dtype: float32\n      name: L0\n      ragged: false\n      sparse: false\n    inbound_nodes: []\n    name: L0\n  - class_name: Dense\n    config:\n      activation: relu\n      activity_regularizer: null\n      bias_constraint: null\n      bias_initializer:\n        class_name: Zeros\n        config: {}\n      bias_regularizer: null\n      dtype: float32\n      kernel_constraint: null\n      kernel_initializer:\n        class_name: GlorotUniform\n        config:\n          seed: null\n      kernel_regularizer: null\n      name: dense\n      trainable: true\n      units: 256\n      use_bias: true\n    inbound_nodes:\n    - - - L0\n        - 0\n        - 0\n        - {}\n    name: dense\n  - class_name: Dropout\n    config:\n      dtype: float32\n      name: dropout\n      noise_shape: null\n      rate: 0.1\n      seed: null\n      trainable: true\n    inbound_nodes:\n    - - - dense\n        - 0\n        - 0\n        - {}\n    name: dropout\n  - class_name: Dense\n    config:\n      activation: relu\n      activity_regularizer: null\n      bias_constraint: null\n      bias_initializer:\n        class_name: Zeros\n        config: {}\n      bias_regularizer: null\n      dtype: float32\n      kernel_constraint: null\n      kernel_initializer:\n        class_name: GlorotUniform\n        config:\n          seed: null\n      kernel_regularizer: null\n      name: dense_1\n      trainable: true\n      units: 128\n      use_bias: true\n    inbound_nodes:\n    - - - dropout\n        - 0\n        - 0\n        - {}\n    name: dense_1\n  - class_name: Dropout\n    config:\n      dtype: float32\n      name: dropout_1\n      noise_shape: null\n      rate: 0.1\n      seed: null\n      trainable: true\n    inbound_nodes:\n    - - - dense_1\n        - 0\n        - 0\n        - {}\n    name: dropout_1\n  - class_name: Dense\n    config:\n      activation: linear\n      activity_regularizer: null\n      bias_constraint: null\n      bias_initializer:\n        class_name: Zeros\n        config: {}\n      bias_regularizer: null\n      dtype: float32\n      kernel_constraint: null\n      kernel_initializer:\n        class_name: GlorotUniform\n        config:\n          seed: null\n      kernel_regularizer: null\n      name: dense_2\n      trainable: true\n      units: 1\n      use_bias: true\n    inbound_nodes:\n    - - - dropout_1\n        - 0\n        - 0\n        - {}\n    name: dense_2\n  name: BigQuantDL\n  output_layers:\n  - - dense_2\n    - 0\n    - 0\nkeras_version: 2.4.0\n',
     'model_weights': [array([[-0.154027  ,  0.00604708,  0.08911502, ...,  0.12364112,
               0.02252254,  0.00457029],
             [ 0.13891403,  0.24827442,  0.14426117, ..., -0.02152511,
               0.00291871, -0.17115147],
             [ 0.13781168,  0.13770522, -0.19393885, ...,  0.07864738,
              -0.04429848,  0.19242582],
             ...,
             [ 0.12663502, -0.09604324,  0.14228673, ..., -0.1723215 ,
               0.06374906,  0.09371775],
             [ 0.03240169, -0.14075258, -0.03402144, ..., -0.02601273,
              -0.14499193, -0.0881785 ],
             [-0.0345192 , -0.23157738,  0.02943403, ...,  0.01823769,
               0.08929355, -0.07788055]], dtype=float32),
      array([-0.09382957,  0.05456739, -0.12471621, -0.2716419 , -0.25807664,
             -0.18833177, -0.07549204, -0.1431125 , -0.06286953, -0.159452  ,
             -0.12621915, -0.09894181, -0.37188417, -0.14191517, -0.1660073 ,
              0.02024871, -0.18845561, -0.01222421, -0.27634647, -0.29231274,
             -0.17166837, -0.12117968,  0.03149686, -0.16929078, -0.23653762,
             -0.17639503, -0.21312   , -0.21057615, -0.35604027, -0.07200184,
             -0.32991627, -0.24288242, -0.03995512, -0.21358278, -0.21781413,
             -0.26298812, -0.0829959 , -0.28332865, -0.0423722 , -0.04146947,
             -0.13031982, -0.08699284, -0.23174378,  0.00440219, -0.03064184,
             -0.1151005 , -0.23929636, -0.14576639, -0.20204774, -0.03803592,
             -0.12199039, -0.23616931, -0.10798483, -0.21232407, -0.24335892,
             -0.10953264, -0.20291758, -0.25751725, -0.2279232 , -0.16506329,
             -0.11058541, -0.11674088, -0.10463887, -0.13614328, -0.35697982,
             -0.10173605,  0.01281572, -0.21452361, -0.15292814, -0.37880284,
             -0.10025091,  0.03355556, -0.1271172 , -0.17162511, -0.02666164,
              0.06011454, -0.44302467, -0.25598535, -0.07623262, -0.22840776,
             -0.23069187, -0.11224689, -0.1588261 , -0.29858214, -0.08634687,
             -0.1753883 ,  0.04996187, -0.15977012, -0.07809906, -0.00806558,
             -0.31183177, -0.11710411, -0.29181018, -0.17607173, -0.22590138,
             -0.16529465, -0.14341407, -0.12891218, -0.26059437, -0.28825653,
             -0.07674399, -0.21231286, -0.1204908 , -0.24556667, -0.23653977,
             -0.14962676, -0.03122336, -0.00440796,  0.01352691, -0.24696122,
             -0.01015737, -0.04057423, -0.14903325, -0.20266987, -0.15216082,
             -0.22297679, -0.09311745, -0.05788316, -0.16532594, -0.15678568,
             -0.1251816 , -0.24598296,  0.0619217 , -0.151664  , -0.12673907,
             -0.27730325, -0.11958943, -0.19119589, -0.1408075 , -0.20033568,
             -0.19785848, -0.06275735, -0.09749961, -0.07809958, -0.18867241,
             -0.176396  , -0.30816555, -0.29800683, -0.03574008, -0.34466594,
             -0.14537519, -0.13120668, -0.42008644, -0.25054178, -0.3137296 ,
             -0.35076994, -0.1313469 , -0.07333581, -0.16143534, -0.0985214 ,
             -0.13064474, -0.31149587, -0.2414527 , -0.13072926, -0.2536489 ,
             -0.19710118, -0.26860064, -0.33608693, -0.1785306 , -0.00786352,
             -0.11583616, -0.13414371, -0.11974929, -0.2919826 , -0.03500529,
             -0.04733949, -0.18813682,  0.02056263, -0.06504098, -0.12958467,
             -0.10941093,  0.05933987, -0.12586287, -0.26844612, -0.30520016,
             -0.25075   , -0.16150488, -0.09815581, -0.09556725, -0.2769052 ,
             -0.31928912, -0.11697263, -0.24452323, -0.04352893, -0.03935671,
             -0.09700929, -0.1695046 , -0.2587839 , -0.09733181, -0.10349596,
             -0.1045478 , -0.14405498, -0.13716018,  0.03510277, -0.3186886 ,
             -0.3156558 , -0.19044027, -0.2023477 , -0.01619259, -0.12320136,
             -0.10062361, -0.16027965, -0.02929046, -0.2741078 , -0.06276833,
             -0.15199196, -0.23468968, -0.0492901 , -0.08579504, -0.35212559,
             -0.19096456, -0.29660442, -0.285501  , -0.2626433 ,  0.05164397,
             -0.2858442 , -0.06396517, -0.26395193, -0.07289774, -0.15517618,
             -0.18977973, -0.19528401, -0.05179564, -0.19555639, -0.20770523,
             -0.14824203,  0.10576679, -0.09403505, -0.02404256, -0.21498807,
             -0.16753212, -0.24186933, -0.27761805, -0.17062087, -0.10062211,
              0.03997335, -0.17159407, -0.00389251, -0.38414922, -0.01566905,
             -0.21582359, -0.03631778, -0.04529278,  0.05695813,  0.02611906,
             -0.18097249, -0.22478369, -0.16045563, -0.05937549,  0.07134317,
              0.08230166, -0.22390889, -0.12887157, -0.13128099, -0.2451857 ,
             -0.24160796], dtype=float32),
      array([[-0.06980481, -0.25713003,  0.12822986, ...,  0.03213713,
              -0.16057107, -0.03091461],
             [ 0.04157116, -0.18845439, -0.14578111, ..., -0.07942096,
               0.29268858, -0.03473996],
             [-0.10485224, -0.1347217 ,  0.04023063, ...,  0.04572565,
              -0.10314041, -0.07502603],
             ...,
             [-0.04246576, -0.0901323 , -0.33906016, ..., -0.02689155,
               0.14806034,  0.00878196],
             [-0.00071208, -0.1443879 , -0.03961731, ..., -0.013017  ,
              -0.01841386, -0.01738931],
             [ 0.0679552 , -0.2878137 ,  0.07064565, ...,  0.02082439,
              -0.14002332,  0.05488787]], dtype=float32),
      array([-0.08332123,  0.10356219, -0.18264113, -0.05700009, -0.09398551,
             -0.0815213 , -0.03193037,  0.03594881,  0.09351325, -0.07712807,
             -0.13108139, -0.09356421,  0.09060805, -0.01528204,  0.06079054,
             -0.06469468, -0.01362155, -0.08831856, -0.09025421, -0.0854828 ,
             -0.12382715, -0.12438719, -0.04328939, -0.07327722, -0.00483654,
             -0.00988327,  0.1331728 , -0.14148435, -0.05273581, -0.06943549,
             -0.0908654 , -0.05494254, -0.06061956, -0.00553282,  0.06109975,
             -0.09716877, -0.09249631, -0.09299915, -0.06033013, -0.03670042,
             -0.08234166, -0.04570769, -0.07643115, -0.06406564, -0.1058683 ,
              0.03594816,  0.10052684, -0.05848561,  0.05222475, -0.09265593,
             -0.0454208 , -0.04579931,  0.13577567, -0.05373953, -0.0923254 ,
             -0.06717968,  0.12465276, -0.0511139 , -0.06672768, -0.08751396,
             -0.04848409, -0.07421587, -0.0733621 , -0.08726252, -0.09798617,
             -0.1573155 , -0.06260289, -0.06534215, -0.07255898,  0.02054381,
              0.11308851,  0.02714948,  0.11718681, -0.13883938, -0.09122407,
             -0.16376261, -0.3848241 , -0.05857344, -0.38669774,  0.06028408,
             -0.07103153, -0.08239635, -0.04642615, -0.0633847 , -0.08584775,
             -0.0705806 , -0.02747627, -0.1619663 ,  0.09950171, -0.09220313,
             -0.07303261, -0.10054316, -0.09991648, -0.04771434, -0.10629231,
              0.22871657, -0.01625826, -0.06385772,  0.1330478 , -0.39287   ,
             -0.0392275 , -0.01946148,  0.06532177, -0.07268051, -0.05052096,
             -0.04838316, -0.05777595,  0.03254976,  0.08663523, -0.07000139,
             -0.07677593, -0.04692807, -0.07797222,  0.01225467,  0.18953909,
             -0.07420129,  0.0020557 , -0.08101143, -0.13884266,  0.08748303,
              0.00299297, -0.03470781, -0.1479709 ,  0.1533586 , -0.03549658,
             -0.05838974,  0.00307072, -0.09088539], dtype=float32),
      array([[-4.20816755e-03],
             [ 1.08918533e-01],
             [-2.78878570e-01],
             [ 1.17013022e-01],
             [ 4.65555163e-03],
             [-1.31227061e-01],
             [ 8.73630568e-02],
             [-2.82532051e-02],
             [ 2.90643051e-02],
             [ 1.45270959e-01],
             [ 1.74774101e-03],
             [ 1.32852476e-02],
             [ 4.02792543e-02],
             [-9.07800943e-02],
             [-2.00699810e-02],
             [ 3.05173988e-03],
             [-5.16606774e-03],
             [ 2.88483687e-02],
             [ 1.84774801e-01],
             [-1.38070866e-01],
             [ 5.66187836e-02],
             [-1.05049387e-01],
             [-8.03644944e-04],
             [ 6.34855479e-02],
             [-4.32314537e-02],
             [-1.54957343e-02],
             [ 5.61857373e-02],
             [ 3.93942669e-02],
             [-1.43882468e-01],
             [ 1.38381205e-03],
             [-6.16489025e-03],
             [ 1.65294066e-01],
             [ 5.44929169e-02],
             [ 4.04315144e-02],
             [ 2.65487004e-02],
             [ 2.76997928e-02],
             [ 4.15638983e-02],
             [ 3.52805369e-02],
             [ 3.70024401e-03],
             [-1.37543511e-02],
             [ 3.92859727e-02],
             [-1.03600405e-01],
             [-8.73636380e-02],
             [ 2.97799334e-03],
             [ 1.63792878e-01],
             [-1.89346801e-02],
             [ 3.52061689e-02],
             [ 1.81059763e-02],
             [ 1.25591820e-02],
             [-1.33576454e-04],
             [ 1.53742032e-02],
             [ 8.30582529e-02],
             [ 3.60175967e-02],
             [-1.02808461e-01],
             [ 2.78482214e-03],
             [ 4.81178705e-03],
             [-3.05209085e-02],
             [-1.46904930e-01],
             [-1.04293972e-01],
             [-5.35507277e-02],
             [-1.40693188e-01],
             [-1.73043292e-02],
             [-1.03772633e-01],
             [ 1.21805668e-02],
             [-1.14249503e-02],
             [-8.74227509e-02],
             [-1.69359863e-01],
             [-6.84684664e-02],
             [-5.51210716e-02],
             [-1.69064403e-02],
             [-2.45811976e-02],
             [ 7.67139196e-02],
             [ 5.04191965e-02],
             [ 1.75973158e-02],
             [ 1.15674391e-01],
             [-1.16850898e-01],
             [-8.18725973e-02],
             [-9.13653430e-03],
             [-7.63739496e-02],
             [-1.13787437e-02],
             [ 1.08925670e-01],
             [ 1.95074044e-02],
             [ 5.13887480e-02],
             [-5.40447012e-02],
             [-1.95365369e-01],
             [ 8.46237764e-02],
             [-8.88548568e-02],
             [ 1.01353079e-02],
             [-6.03192076e-02],
             [-2.92085782e-02],
             [-3.39294528e-03],
             [ 5.85992029e-03],
             [ 6.69707544e-04],
             [ 1.70072392e-01],
             [ 2.41396371e-02],
             [ 6.45640343e-02],
             [-4.15139273e-02],
             [-7.49991238e-02],
             [ 3.59975919e-02],
             [-6.81249574e-02],
             [ 5.75502496e-03],
             [ 1.07736088e-01],
             [-6.63822219e-02],
             [ 8.55320245e-02],
             [ 9.97826830e-02],
             [-1.85072143e-02],
             [ 7.83024132e-02],
             [ 4.43034917e-02],
             [-4.40898351e-02],
             [-1.39304608e-01],
             [-1.13110550e-01],
             [ 1.17126601e-02],
             [ 3.24118361e-02],
             [-7.45316148e-02],
             [ 3.60953733e-02],
             [ 3.41509655e-02],
             [ 7.74081945e-02],
             [ 1.53883576e-01],
             [-2.13018972e-02],
             [ 1.90752950e-02],
             [ 4.08717245e-02],
             [ 3.79879139e-02],
             [ 2.11027861e-02],
             [ 6.41700104e-02],
             [ 5.08924527e-03],
             [ 6.82757050e-03],
             [-4.90439013e-02],
             [ 7.02767540e-03]], dtype=float32),
      array([-0.0331731], dtype=float32)],
     'history': {'loss': [0.9903290867805481,
       0.9891356825828552,
       0.9888054132461548,
       0.9886475205421448,
       0.9885059595108032],
      'mse': [0.9903290867805481,
       0.9891356825828552,
       0.9888054132461548,
       0.9886475205421448,
       0.9885059595108032]},
     'custom_objects': {}}
    In [5]:
    m5.plot_result()
    
    In [ ]: