Пример #1
0
    train_x, train_y = transfer2PyArrays(trainSet)

    #print2DArray(train_x, 'train_xSet', 'train_x')
    #print2DArray(train_y, 'train_ySet', 'train_y')

    # run the training part
    for i in range(train_steps):
        if (i % 1000 == 0): print('Training step: ', i)
        sess.run(train, {x: train_x, y: train_y})

    print('End training: ', datetime.now())

    #print('W1: ', sess.run(W1))
    #print('b1: ', sess.run(b1))

    # run the verification part
    # =========================

    for factor in [0.7, 1.0, 1.2]:
        # retrieve a test case
        testCase = ipss_app.getTestCase(factor)
        test_x, test_y = transfer2PyArrays(testCase)
        #printArray(test_x, 'test_x')
        #printArray(test_y, 'test_y')

        # compute model output (network voltage)
        model_y = sess.run(nn_model(x), {x: [test_x]})
        #printArray(model_y[0], 'model_y')

        print('max error: ',
              np.sqrt(np.max(np.abs(np.square(model_y - test_y)))))
Пример #2
0
    #print2DArray(train_x, 'train_xSet', 'train_x')
    #print2DArray(train_y, 'train_ySet', 'train_y')

    # run the training part
    for i in range(train_steps):
        if (i % 1000 == 0): print('Training step: ', i)
        sess.run(train, {x: train_x, y: train_y})

    print('End training: ', datetime.now())
    '''
    print('W1: ', sess.run(W1))
    print('b1: ', sess.run(b1))
    '''

    # run the verification part
    # =========================

    # retrieve a test case
    testCase = ipss_app.getTestCase()
    test_x, test_y = np.array([testCase])[0]
    #printArray(test_x, 'test_x')
    #printArray(test_y, 'test_y')

    # compute model output (network voltage)
    model_y = sess.run(nn_model(x), {x: [test_x]})
    #printArray(model_y[0], 'model_y')

    netVoltage = transfer2JavaDblAry(model_y[0], size)
    print('model out mismatch: ', ipss_app.getMismatchInfo(netVoltage))