Exemplo n.º 1
0
            print('stop at epoch {}'.format(i))
            break

        if (i % 10000 == 0) | (i == (epochs - 1)):

            y_tst = sess.run(y, feed_dict={x: x_tst})

            v_err = err(y_tst, y_tst2[0])
            fp = plt.figure()
            ax = plt.gca()
            plt.plot(loss_all, label='loss')
            plt.yscale('log')
            plt.xscale('log')
            plt.xlabel('x(*%s)' % (lossepoch), fontsize=18)
            fntmp = '%sloss' % (FolderName)
            mySaveFig(plt, fntmp, ax=ax, isax=1, iseps=0)

            fp = plt.figure()
            ax = plt.gca()
            if R['istanh'] == 0:
                if R['cscase'] == 1:
                    plt.plot(np.squeeze(x_tst),
                             cs(np.squeeze(x_tst)),
                             '--',
                             color='grey',
                             linewidth=4,
                             label='cubic-spline')
                else:
                    plt.plot(np.squeeze(x_train),
                             np.squeeze(y_train),
                             '--',
Exemplo n.º 2
0
        plt.figure()
        ax = plt.gca()
        plt.plot(train_inputs, y_train, 'm.', label='Train_fit')
        plt.plot(train_inputs,
                 R_variable['y_true_train'],
                 'b-',
                 label='Train_true')
        plt.legend(fontsize=16)
        plt.xlabel('x', fontsize=18)
        plt.ylabel('y', fontsize=18)
        plt.rc('xtick', labelsize=18)
        plt.rc('ytick', labelsize=18)
        plt.title('epoch: %s' % (i), fontsize=18)
        ax.set_position(pos, which='both')
        fntmp = '%sytrain%s' % (R_variable['FolderName'], i)
        mySaveFig(plt, fntmp, ax=ax, iseps=0)

        plt.figure()
        ax = plt.gca()
        plt.plot(test_inputs, y_test, 'r.', label='Test_fit')
        plt.plot(test_inputs,
                 R_variable['y_true_test'],
                 'g-',
                 label='Test_true')
        plt.legend(fontsize=16)
        plt.xlabel('x', fontsize=18)
        plt.ylabel('y', fontsize=18)
        plt.rc('xtick', labelsize=18)
        plt.rc('ytick', labelsize=18)
        plt.title('epoch: %s' % (i), fontsize=18)
        ax.set_position(pos, which='both')