基于大宽可视化的深度学习Hello World!

机器学习
标签: #<Tag:0x00007fcf6365d468>

(chaoskey) #1
克隆策略

    {"Description":"实验创建于2018/2/5","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-2725:inputs","SourceOutputPortId":"-2717:data"},{"DestinationInputPortId":"-2782:inputs","SourceOutputPortId":"-2717:data"},{"DestinationInputPortId":"-2753:inputs","SourceOutputPortId":"-2725:data"},{"DestinationInputPortId":"-2782:outputs","SourceOutputPortId":"-2753:data"},{"DestinationInputPortId":"-2787:input_model","SourceOutputPortId":"-2782:data"},{"DestinationInputPortId":"-2787:training_data","SourceOutputPortId":"-2803:data_1"},{"DestinationInputPortId":"-2787:validation_data","SourceOutputPortId":"-2803:data_2"}],"ModuleNodes":[{"Id":"-2717","ModuleId":"BigQuantSpace.dl_layer_input.dl_layer_input-v1","ModuleParameters":[{"Name":"shape","Value":"784,","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"batch_shape","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"dtype","Value":"float32","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"sparse","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"name","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"inputs","NodeId":"-2717"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-2717","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":1,"Comment":"","CommentCollapsed":true},{"Id":"-2725","ModuleId":"BigQuantSpace.dl_layer_dense.dl_layer_dense-v1","ModuleParameters":[{"Name":"units","Value":"512","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"activation","Value":"relu","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_activation","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"use_bias","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_initializer","Value":"glorot_uniform","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_kernel_initializer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_initializer","Value":"Zeros","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_bias_initializer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_regularizer","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_regularizer_l1","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_regularizer_l2","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_kernel_regularizer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_regularizer","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_regularizer_l1","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_regularizer_l2","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_bias_regularizer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"activity_regularizer","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"activity_regularizer_l1","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"activity_regularizer_l2","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_activity_regularizer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_constraint","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_kernel_constraint","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_constraint","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_bias_constraint","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"name","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"inputs","NodeId":"-2725"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-2725","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":2,"Comment":"","CommentCollapsed":true},{"Id":"-2753","ModuleId":"BigQuantSpace.dl_layer_dense.dl_layer_dense-v1","ModuleParameters":[{"Name":"units","Value":"10","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"activation","Value":"softmax","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_activation","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"use_bias","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_initializer","Value":"glorot_uniform","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_kernel_initializer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_initializer","Value":"Zeros","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_bias_initializer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_regularizer","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_regularizer_l1","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_regularizer_l2","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_kernel_regularizer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_regularizer","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_regularizer_l1","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_regularizer_l2","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_bias_regularizer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"activity_regularizer","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"activity_regularizer_l1","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"activity_regularizer_l2","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_activity_regularizer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"kernel_constraint","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_kernel_constraint","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"bias_constraint","Value":"None","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_bias_constraint","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"name","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"inputs","NodeId":"-2753"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-2753","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":3,"Comment":"","CommentCollapsed":true},{"Id":"-2782","ModuleId":"BigQuantSpace.dl_model_init.dl_model_init-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"inputs","NodeId":"-2782"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"outputs","NodeId":"-2782"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-2782","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":4,"Comment":"","CommentCollapsed":true},{"Id":"-2787","ModuleId":"BigQuantSpace.dl_model_train.dl_model_train-v1","ModuleParameters":[{"Name":"optimizer","Value":"RMSprop","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_optimizer","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"loss","Value":"categorical_crossentropy","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_loss","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"metrics","Value":"accuracy","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"batch_size","Value":"128","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"epochs","Value":"5","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"n_gpus","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"verbose","Value":"2:每个epoch输出一行记录","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_model","NodeId":"-2787"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"training_data","NodeId":"-2787"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"validation_data","NodeId":"-2787"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-2787","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"Comment":"","CommentCollapsed":true},{"Id":"-2803","ModuleId":"BigQuantSpace.cached.cached-v3","ModuleParameters":[{"Name":"run","Value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3):\n \n from keras.datasets import mnist\n from keras.utils import to_categorical\n \n (train_images, train_labels),(test_images, test_labels) = mnist.load_data()\n \n train_x = train_images.reshape((60000,784)).astype(\"float32\")/255\n test_x = test_images.reshape((10000,784)).astype(\"float32\")/255\n\n train_y = to_categorical(train_labels)\n test_y = to_categorical(test_labels)\n\n train = {\"x\":train_x,\"y\":train_y}\n test = {\"x\":test_x,\"y\":test_y}\n \n print(train_y.shape)\n print(train_x.shape)\n data_1 = DataSource.write_pickle(train)\n data_2 = DataSource.write_pickle(test)\n return Outputs(data_1=data_1, data_2=data_2, data_3=None)\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-2803"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-2803"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-2803"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-2803","OutputType":null},{"Name":"data_2","NodeId":"-2803","OutputType":null},{"Name":"data_3","NodeId":"-2803","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-2717' Position='58,94,200,200'/><NodePosition Node='-2725' Position='289.9244384765625,185.0755615234375,200,200'/><NodePosition Node='-2753' Position='264.292236328125,283.3777770996094,200,200'/><NodePosition Node='-2782' Position='98.41555786132812,405.6322021484375,200,200'/><NodePosition Node='-2787' Position='253.03778076171875,521.8866577148438,200,200'/><NodePosition Node='-2803' Position='484.3399658203125,378.3022155761719,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
    In [11]:
    # 本代码由可视化策略环境自动生成 2018年2月5日 17:42
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.dl_layer_input.v1(
        shape='784,',
        batch_shape='',
        dtype='float32',
        sparse=False,
        name=''
    )
    
    m2 = M.dl_layer_dense.v1(
        inputs=m1.data,
        units=512,
        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=''
    )
    
    m3 = M.dl_layer_dense.v1(
        inputs=m2.data,
        units=10,
        activation='softmax',
        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=m1.data,
        outputs=m3.data
    )
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m6_run_bigquant_run(input_1, input_2, input_3):
        
        from keras.datasets import mnist
        from keras.utils import to_categorical
        
        (train_images, train_labels),(test_images, test_labels) = mnist.load_data()
        
        train_x = train_images.reshape((60000,784)).astype("float32")/255
        test_x = test_images.reshape((10000,784)).astype("float32")/255
    
        train_y = to_categorical(train_labels)
        test_y = to_categorical(test_labels)
    
        train = {"x":train_x,"y":train_y}
        test = {"x":test_x,"y":test_y}
        
        print(train_y.shape)
        print(train_x.shape)
        data_1 = DataSource.write_pickle(train)
        data_2 = DataSource.write_pickle(test)
        return Outputs(data_1=data_1, data_2=data_2, data_3=None)
    
    m6 = M.cached.v3(
        run=m6_run_bigquant_run
    )
    
    m5 = M.dl_model_train.v1(
        input_model=m4.data,
        training_data=m6.data_1,
        validation_data=m6.data_2,
        optimizer='RMSprop',
        loss='categorical_crossentropy',
        metrics='accuracy',
        batch_size=128,
        epochs=5,
        n_gpus=0,
        verbose='2:每个epoch输出一行记录'
    )
    
    [2018-02-05 17:39:42.820319] INFO: bigquant: cached.v3 开始运行..
    [2018-02-05 17:39:42.825028] INFO: bigquant: 命中缓存
    [2018-02-05 17:39:42.826304] INFO: bigquant: cached.v3 运行完成[0.006059s].
    [2018-02-05 17:39:42.838917] INFO: bigquant: cached.v3 开始运行..
    [2018-02-05 17:39:42.843257] INFO: bigquant: 命中缓存
    [2018-02-05 17:39:42.844596] INFO: bigquant: cached.v3 运行完成[0.005698s].
    [2018-02-05 17:39:42.853189] INFO: bigquant: dl_model_train.v1 开始运行..
    [2018-02-05 17:39:43.140365] INFO: device_manager: 没有gpu资源,将使用cpu计算
    [2018-02-05 17:39:43.146045] INFO: device_manager: 本次操作不使用GPU
    [2018-02-05 17:39:47.210659] INFO: dl_model_train: 准备训练,训练样本个数:60000,迭代次数:5
    Train on 60000 samples, validate on 10000 samples
    Epoch 1/5
    14s - loss: 0.2552 - acc: 0.9261 - val_loss: 0.1389 - val_acc: 0.9579
    Epoch 2/5
    17s - loss: 0.1043 - acc: 0.9697 - val_loss: 0.0905 - val_acc: 0.9724
    Epoch 3/5
    15s - loss: 0.0691 - acc: 0.9792 - val_loss: 0.0788 - val_acc: 0.9749
    Epoch 4/5
    15s - loss: 0.0509 - acc: 0.9844 - val_loss: 0.0701 - val_acc: 0.9801
    Epoch 5/5
    21s - loss: 0.0373 - acc: 0.9889 - val_loss: 0.0693 - val_acc: 0.9789
    [2018-02-05 17:41:12.150540] INFO: dl_model_train: 训练结束,耗时:84.93s
    [2018-02-05 17:41:12.312077] INFO: bigquant: dl_model_train.v1 运行完成[89.458718s].
    

    (sold) #2

    支持干货的分享!!!


    (upndown) #3

    马上克隆了研究研究~~