def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run

    # p1_VM_Output : lambda_pls 반영 10 runs act결과 반영 vm
    # p1_ACT_Output : lambda_pls 반영 10 runs act결과 반영
    # p1_ez_run : prd - act (실제)
    # p1_y_act : lambda_pls 반영 안한 act
    # p1_y_prd : lambda_pls 반영 안하고 10 runs act결과 반영하지 않은 예측 값

    p1_VM_Output, p1_ACT_Output, p1_ez_run, p1_y_act, p1_y_prd = fwc_p1_vm.VM_Run(lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    # p1_q1_mape_Queue = []
    #
    # # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    # for z in np.arange(0, Z_VM, 1):
    #     mape = fdh_graph.mean_absolute_percentage_error(z + 1, p1_y_act[((z + 1) * M) - 1][0], p1_y_prd[((z + 1) * M) - 1][0])
    #     p1_q1_mape_Queue.append(mape)
    #
    # print('Process-1 q1 Every Metrology MAPE : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))
    # p1_q1_mape_Queue = []
    #
    # for i in range(Z_VM * M):
    #     mape = fdh_graph.mean_absolute_percentage_error(i + 1, p1_y_act[i][0], p1_y_prd[i][0])
    #     p1_q1_mape_Queue.append(mape)
    #
    # print('Process-1 q1 All MAPE : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))
    #
    # fdh_graph.plt_show1(Z_VM * M, p1_y_act[:, 0:1], p1_y_prd[:, 0:1])
    # fdh_graph.plt_show2(Z_VM, p1_ez_run[:, 0:1], p1_ez_run[:, 1:2])
    #
    # np.savetxt("output/p1_VM_Output.csv", p1_VM_Output, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_ACT_Output.csv", p1_ACT_Output, delimiter=",", fmt="%.4f")

    min_mape = 100
    t = 1000
    for m in range(1000):
        SEED2 = t + m
        fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd, p1_y_act, SEED2)
        fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M, f=p1_y_act)  #DoE Run ACT값으로 가능
        p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd = fwc_p2_act.VM_Run(lamda_PLS=v2_PLS, Z=Z_VM, M=M)

        p2_q2_mape_Queue = []

        for i in range(Z_VM * M):
            mape = fdh_graph.mean_absolute_percentage_error(i + 1, p2_y_act[i][1], p2_y_prd[i][1])
            p2_q2_mape_Queue.append(mape)

        mape = np.mean(p2_q2_mape_Queue)
        print('Process-2 q2 All MAPE : {0:.2f}%'.format(mape))

        if mape < min_mape:
            min_mape = mape
            seed_right = SEED2
            print('SEED2 : ', SEED2, ' , min_mape = ', min_mape)

    print('seed_right : ', seed_right, ' , min_mape = ', min_mape)
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_DynamicSampling_노이즈시뮬레이터(A_p1, d_p1, C_p1, dM,
                                                     dStart, SEED)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  #DoE Run
    VM_Output, ACT_Output, ez_run, y_act, y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=RUNS_CNT, M=M)

    np.savetxt("output/VM_Output.csv", VM_Output, delimiter=",", fmt="%.4f")
    np.savetxt("output/ACT_Output.csv", ACT_Output, delimiter=",", fmt="%.4f")
    np.savetxt("output/ez_run.csv", ez_run, delimiter=",", fmt="%.4f")
    np.savetxt("output/y_act.csv", y_act, delimiter=",", fmt="%.4f")
    np.savetxt("output/y_prd.csv", y_prd, delimiter=",", fmt="%.4f")

    fdh_graph.plt_show1(N, y_act[:, 0:1], y_prd[:, 0:1])
    fdh_graph.plt_show2(RUNS_CNT, ez_run[:, 0:1], ez_run[:, 1:2], Noise=True)

    ez_run_out = []
    runM = M

    ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, RUNS_CNT + 1):
        if z == dStart:
            runM = dM
        for k in np.arange(z * runM, (z + 1) * runM):
            ez_run_out.append(ez_run[z])
    ez_run_out = np.array(ez_run_out)

    np.savetxt("output/ez_run2.csv", ez_run_out, delimiter=",", fmt="%.4f")
    fdh_graph.plt_show5(ez_run_out, N, M, dM, S1, Noise=True)

    p1_q1_mape_Queue = []

    #metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, 40, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, y_act[((z + 1) * M) - 1][0], y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, N, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, y_act[i][0], y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  #DoE Run
    VM_Output, ACT_Output, ez_run, y_act, y_prd, ez_all_run = fwc_p1_vm.VM_Run(lamda_PLS=v_PLS, Z=Z_VM, M=M)

    fdh_graph.plt_show1(Z_VM * M, y_act[:, 0:1], y_prd[:, 0:1], 'Process-1 Normal Case', '1')
    fdh_graph.plt_show2(Z_VM, ez_run[:, 0:1], ez_run[:, 1:2], 'Process-1 Normal Case')

    p1_q1_mape_Queue = []

    #metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(0, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(z + 1, y_act[((z + 1) * M) - 1][0], y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []


    for i in range(Z_VM * M):
        mape = fdh_graph.mean_absolute_percentage_error(i + 1, y_act[i][0], y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))
    # np.savetxt("output/Normal_mape_Queue_Output.csv", p1_mape_Queue, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Normal_VM_Output.csv", VM_Output, delimiter=",", fmt="%.4f")
    np.savetxt("output/ez_all_run.csv", ez_all_run, delimiter=",", fmt="%.4f")
示例#4
0
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  #DoE Run
    VM_Output, ACT_Output, ez_run, y_act, y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=Z_VM, M=M)

    fdh_graph.plt_show1(Z_VM * M, y_act[:, 0:1], y_prd[:, 0:1])
    fdh_graph.plt_show2(Z_VM, ez_run[:, 0:1], ez_run[:, 1:2])

    p1_q1_mape_Queue = []

    #metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(0, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, y_act[((z + 1) * M) - 1][0], y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in range(Z_VM * M):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, y_act[i][0], y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_DynamicSampling_시뮬레이터(A_p1, d_p1, C_p1, dM, dStart,
                                                  SEED)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  # DoE Run
    VM_Output, ACT_Output, ez_run, y_act, y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=RUNS_CNT, M=M)

    np.savetxt("output/VM_Output.csv", VM_Output, delimiter=",", fmt="%.4f")
    np.savetxt("output/ACT_Output.csv", ACT_Output, delimiter=",", fmt="%.4f")
    np.savetxt("output/ez_run.csv", ez_run, delimiter=",", fmt="%.4f")
    np.savetxt("output/y_act.csv", y_act, delimiter=",", fmt="%.4f")
    np.savetxt("output/y_prd.csv", y_prd, delimiter=",", fmt="%.4f")

    fdh_graph.plt_show1(N, y_act[:, 0:1], y_prd[:, 0:1])
    fdh_graph.plt_show2(RUNS_CNT, ez_run[:, 0:1], ez_run[:, 1:2], Noise=False)

    ez_run_out = []
    runM = M

    ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, RUNS_CNT + 1):
        if z == dStart:
            runM = dM
        for k in np.arange(z * runM, (z + 1) * runM):
            ez_run_out.append(ez_run[z])
    #ez_run_out[0] = np.array([0, 0])
    ez_run_out = np.array(ez_run_out)

    np.savetxt("output/ez_run2.csv", ez_run_out, delimiter=",", fmt="%.4f")
    fdh_graph.plt_show5(ez_run_out, N, M, dM, S1, Noise=False)
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_노이즈시뮬레이터(A_p1, d_p1, C_p1, SEED)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  #DoE Run
    VM_Output, ACT_Output, ez_run, y_act, y_prd, abnormal_p1_ez_all_run_q1 = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=Z_VM, M=M)

    # fdh_graph.plt_show1(Z_VM * M, y_act[:, 0:1], y_prd[:, 0:1])
    # fdh_graph.plt_show2(Z_VM, ez_run[:, 0:1], ez_run[:, 1:2], Noise=True)

    fdh_graph.plt_show1(
        Z_VM * M, y_act[:, 0:1], y_prd[:, 0:1],
        'Process-1 Abnormal Case (' + str(Z_VM) + ' Metrology Runs)', '1')
    #fdh_graph.plt_show2_1(Z_VM * M, ez_run[:, 0:1], ez_run[:, 1:2], 'Process-1 Abnormal Case', color1='bx--', color2='rx-')

    #np.savetxt("output/p1_ez_run.csv", ez_run, delimiter=",", fmt="%.4f")
    # for z in np.arange(22, 34, 1):
    #     mape = fdh_graph.mean_absolute_percentage_error(z + 1, y_act[((z + 1) * M) - 1][0], y_prd[((z + 1) * M) - 1][0])
    #     p1_mape_Queue.append(mape)

    # for z in np.arange(21, 32, 1):
    #     mape_sum = 0
    #     for k in np.arange(z * M + 1, ((z + 1) * M) + 1):
    #         mape = fdh_graph.mean_absolute_percentage_error(k, y_act[k][0], y_prd[k][0])
    #         mape_sum += mape
    #     p1_mape_Queue.append(mape_sum / M)

    p1_q1_mape_Queue = []
    p1_q1_mape_Queue_temp = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN_1, Z_VM, 1):
        act = y_act[((z + 1) * M) - 1][0]
        prd = y_prd[((z + 1) * M) - 1][0]
        mape = fdh_graph.mean_absolute_percentage_error(z + 1, act, prd)
        if z >= 15 and z < 20:
            print('z = ', z, ', act = ', act, ', prd = ', prd, ', ez = ',
                  np.abs(act - prd), ', MAPE = ', mape)
            p1_q1_mape_Queue_temp.append(np.abs(act - prd))
        else:
            p1_q1_mape_Queue.append(mape)

    print(
        'Process-1 q1 Actual Metrology MAPE between 5 Lots (15 ~ 20 Lots) : {0:.2f}'
        .format(np.mean(p1_q1_mape_Queue_temp)))
    print('Process-1 q1 Every Metrology MAPE After 20 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN_2 * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, y_act[i][0], y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 20 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    # np.savetxt("output/noise_mape_Queue.csv", p1_mape_Queue, delimiter=",", fmt="%.4f")
    # np.savetxt("output/abNormal_VM_Output.csv", VM_Output, delimiter=",", fmt="%.4f")
    np.savetxt("output/noise_ez_run.csv", ez_run, delimiter=",", fmt="%.4f")
示例#7
0
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_노이즈시뮬레이터(A_p1, d_p1, C_p1, SEED)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  #DoE Run
    VM_Output, ACT_Output, ez_run, y_act, y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=Z_VM, M=M)

    fdh_graph.plt_show1(Z_VM * M, y_act[:, 0:1], y_prd[:, 0:1])
    fdh_graph.plt_show12(Z_VM, ez_run[:, 0:1], ez_run[:, 1:2])

    #np.savetxt("output/p1_ez_run.csv", ez_run, delimiter=",", fmt="%.4f")
    # for z in np.arange(22, 34, 1):
    #     mape = fdh_graph.mean_absolute_percentage_error(z + 1, y_act[((z + 1) * M) - 1][0], y_prd[((z + 1) * M) - 1][0])
    #     p1_mape_Queue.append(mape)

    # for z in np.arange(21, 32, 1):
    #     mape_sum = 0
    #     for k in np.arange(z * M + 1, ((z + 1) * M) + 1):
    #         mape = fdh_graph.mean_absolute_percentage_error(k, y_act[k][0], y_prd[k][0])
    #         mape_sum += mape
    #     p1_mape_Queue.append(mape_sum / M)

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, y_act[((z + 1) * M) - 1][0], y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, y_act[i][0], y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
示例#8
0
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_DynamicSampling_노이즈시뮬레이터(A_p1, d_p1, C_p1, dM,
                                                     dStart, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  # DoE Run
    Error_VMresult, Error_ACTResult, ez_run, p1_y_act, p1_y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=RUNS_CNT, M=M)

    ez_run_out = []
    runM = M

    ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, RUNS_CNT + 1):
        if z == dStart:
            runM = dM
        for k in np.arange(z * runM, (z + 1) * runM):
            ez_run_out.append(ez_run[z])
    ez_run_out = np.array(ez_run_out)

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN_1, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN_1 * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    min_mape = 100
    t = 1000
    for m in range(1000):
        SEED2 = t + m
        fwc_p2_act = VM_Process2_노이즈시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS,
                                          p1_y_prd, p1_y_act, SEED2)
        fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M,
                           f=o_y_act)  # DoE Run ACT값으로 가능
        p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd = fwc_p2_act.VM_Run(
            lamda_PLS=v2_PLS, Z=Z_VM, M=M)

        p2_q2_mape_Queue = []

        for i in np.arange(Nz_RUN_2 * M, Z_VM * M, 1):
            mape = fdh_graph.mean_absolute_percentage_error(
                i + 1, p2_y_act[i][1], p2_y_prd[i][1])
            p2_q2_mape_Queue.append(mape)

        mape = np.mean(p2_q2_mape_Queue)

        print('Process-2 q2 All MAPE After 20 Lot : {0:.2f}%'.format(mape))

        if mape < min_mape:
            min_mape = mape
            seed_right = SEED2
            print('SEED2 : ', SEED2, ' , min_mape = ', min_mape)

    print('seed_right : ', seed_right, ' , min_mape = ', min_mape)

    p2_q2_mape_Queue = []

    for z in np.arange(15, 20, 1):  # 15 ~ 20 5개 Metrology만 본 상태
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p2_y_act[((z + 1) * M) - 1][1],
            p2_y_prd[((z + 1) * M) - 1][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 Every Metrology MAPE After 5 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd = fwc_p1_vm.VM_Run(lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_DynamicSampling_노이즈시뮬레이터(A_p1, d_p1, C_p1, dM, dStart, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  # DoE Run
    VM_Output, ACT_Output, ez_run, p1_y_act, p1_y_prd = fwc_p1_vm.VM_Run(lamda_PLS=v_PLS, Z=RUNS_CNT, M=M)

    fdh_graph.plt_show1(N, p1_y_act[:, 0:1], p1_y_prd[:, 0:1])

    ez_run_out = []
    runM = M

    ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, RUNS_CNT + 1):
        if z == dStart:
            runM = dM
        for k in np.arange(z * runM, (z + 1) * runM):
            ez_run_out.append(ez_run[z])
    ez_run_out = np.array(ez_run_out)

    fdh_graph.plt_show5(ez_run_out, N, M, dM, S1, Noise=True)

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(z + 1, p1_y_act[((z + 1) * M) - 1][0], p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))

    np.savetxt("output/p1_mape.csv", p1_q1_mape_Queue, delimiter=",", fmt="%.4f")
    np.savetxt("output/Error_VMresult1.csv", VM_Output, delimiter=",", fmt="%.4f")
    np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    np.savetxt("output/Error_ACTResult.csv", ACT_Output, delimiter=",", fmt="%.4f")

    fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd, p1_y_act, SEED2)
    fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M, f=o_y_act)  # DoE Run ACT값으로 가능
    p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd = fwc_p2_act.VM_Run(lamda_PLS=v2_PLS, Z=Z_VM, M=M)

    fdh_graph.plt_show1(Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2])
    fdh_graph.plt_show2(Z_VM, p2_ez_run[:, 0:1], p2_ez_run[:, 1:2], Noise=True)

    p2_q2_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(z + 1, p2_y_act[((z + 1) * M) - 1][1], p2_y_prd[((z + 1) * M) - 1][1])
        #print("으아아악 : ", p2_y_act[((z + 1) * M) - 1][1], p2_y_prd[((z + 1) * M) - 1][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(np.mean(p2_q2_mape_Queue)))
    p2_q2_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(i + 1, p2_y_act[i][1], p2_y_prd[i][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 All MAPE After 15 Lot : {0:.2f}%'.format(np.mean(p2_q2_mape_Queue)))
示例#10
0
def main():
    noise_ez_run = np.loadtxt('output/noise_ez_run.csv',
                              delimiter=",",
                              dtype=np.float32)
    abnormal_p2_ez_all_run_q2 = np.loadtxt(
        'D:/10. 대학원/04. Source/09. VM_Source/04. VMOnly/output/abnormal_p2_ez_all_run_q2.csv',
        delimiter=",",
        dtype=np.float32)
    before_normal_p2_ez_all_run_q2 = np.loadtxt(
        'D:/10. 대학원/04. Source/09. VM_Source/04. VMOnly/output/before_normal_p2_ez_all_run_q2.csv',
        delimiter=",",
        dtype=np.float32)
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd, _ = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_DynamicSampling_노이즈시뮬레이터(A_p1, d_p1, C_p1, dM,
                                                     dStart, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  # DoE Run
    VM_Output, ACT_Output, ez_run, p1_y_act, p1_y_prd, p1_ez_all_run_q1 = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=RUNS_CNT, M=M)

    #fdh_graph.plt_show1(N, p1_y_act[:, 0:1], p1_y_prd[:, 0:1])

    ez_run_out = []
    noise_ez_run_out = []
    runM = M
    noise_ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, old_N + 1):
        for k in np.arange(z * M, (z + 1) * M):
            noise_ez_run_out.append(noise_ez_run[z])
    noise_ez_run_out = np.array(noise_ez_run_out)

    ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, RUNS_CNT + 1):
        if z == dStart:
            runM = dM
        for k in np.arange(z * runM, (z + 1) * runM):
            ez_run_out.append(ez_run[z])
    ez_run_out = np.array(ez_run_out)

    #fdh_graph.plt_show5(ez_run_out, N, M, dM, S1, Noise=True)
    #fdh_graph.plt_show5_1(noise_ez_run_out, ez_run_out, N, M, dM, S1, type=1)

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd,
                                   p1_y_act, SEED2)
    fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M,
                       f=o_y_act)  # DoE Run ACT값으로 가능
    p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd, p2_ez_all_run_q2 = fwc_p2_act.VM_Run(
        lamda_PLS=v2_PLS, Z=Z_VM, M=M)

    #fdh_graph.plt_show1(Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2])
    #fdh_graph.plt_show2(Z_VM, p2_ez_run[:, 0:1], p2_ez_run[:, 1:2], Noise=True)
    fdh_graph.plt_show1(
        Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2],
        'Process-2 Abnormal Case with Process-1 Dynamic Sampling', '2')
    fdh_graph.plt_show2_2(
        Z_VM * M,
        abnormal_p2_ez_all_run_q2[:, 1:2],
        p2_ez_all_run_q2[:, 1:2],
        'Process-2 UPStream Rule X with Process-1 Dynamic Sampling',
        '2',
        color1='bx-',
        color2='rx--')

    #fdh_graph.plt_show2_2(Z_VM * M, abnormal_p2_ez_all_run_q2[:, 1:2], p2_ez_all_run_q2[:, 1:2], before_normal_p2_ez_all_run_q2[:, 1:2], 'Process-2 Abnormal Case', '2', color1='bx-', color2='rx--', color3='gx--')

    p2_q2_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p2_y_act[((z + 1) * M) - 1][1],
            p2_y_prd[((z + 1) * M) - 1][1])
        #print("으아아악 : ", p2_y_act[((z + 1) * M) - 1][1], p2_y_prd[((z + 1) * M) - 1][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))
    p2_q2_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p2_y_act[i][1], p2_y_prd[i][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))
示例#11
0
def main():
    fdh_graph = FDC_Graph()
    ## Metrology마다 차이를 보여줌.. 근데.. Process-2의 변동량이 크지 않아 바꾸기로 결정 ('19.09.25)
    normal_p1_ez_all_run_q1 = np.loadtxt('output/p1_ez_all_run_q1.csv',
                                         delimiter=",",
                                         dtype=np.float32)
    normal_p2_ez_all_run_q2 = np.loadtxt('output/p2_ez_all_run_q2.csv',
                                         delimiter=",",
                                         dtype=np.float32)

    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd, _ = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_노이즈시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Error_VMresult, Error_ACTResult, ez_run, p1_y_act, p1_y_prd, abnormal_p1_ez_all_run_q1 = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fdh_graph.plt_show1(Z_VM * M, p1_y_act[:, 0:1], p1_y_prd[:, 0:1],
                        'Process-1 Abnormal Case', '1')
    fdh_graph.plt_show2_2(Z_VM * M,
                          normal_p1_ez_all_run_q1[:, 0:1],
                          abnormal_p1_ez_all_run_q1[:, 0:1],
                          'Process-1 Abnormal Case',
                          '1',
                          color1='bx-',
                          color2='rx--')
    #fdh_graph.plt_show2_1(Z_VM * M, p1_ez_run_q1, ez_run[:, 0:1], 'Process-1 Abnormal Case', color1='bx--', color2='rx-')

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    # np.savetxt("output/p1_mape.csv", p1_q1_mape_Queue, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_VMresult1.csv", Error_VMresult, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_ACTResult.csv", Error_ACTResult, delimiter=",", fmt="%.4f")

    fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd,
                                   p1_y_act, SEED2)
    fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M,
                       f=o_y_act)  # DoE Run ACT값으로 가능
    p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd, abnormal_p2_ez_all_run_q2 = fwc_p2_act.VM_Run(
        lamda_PLS=v2_PLS, Z=Z_VM, M=M)

    np.savetxt("output/abnormal_p2_ez_all_run_q2.csv",
               abnormal_p2_ez_all_run_q2,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/before_normal_p2_ez_all_run_q2.csv",
               normal_p2_ez_all_run_q2,
               delimiter=",",
               fmt="%.4f")

    fdh_graph.plt_show1(Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2],
                        'Process-2 Abnormal Case', '2')
    fdh_graph.plt_show2_2(Z_VM * M,
                          normal_p2_ez_all_run_q2[:, 1:2],
                          abnormal_p2_ez_all_run_q2[:, 1:2],
                          'Process-2 Abnormal Case',
                          '2',
                          color1='bx-',
                          color2='rx--')
    #fdh_graph.plt_show2_2(Z_VM * M, normal_p2_ez_all_run_q2[:, 0:1], abnormal_p2_ez_all_run_q2[:, 0:1], 'Process-2 Abnormal Case', color1='bx-', color2='rx--')
    #fdh_graph.plt_show2(Z_VM, p2_ez_run_q2, p2_ez_run[:, 1:2], 'Process-2 Abnormal Case')

    p2_q2_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p2_y_act[((z + 1) * M) - 1][1],
            p2_y_prd[((z + 1) * M) - 1][1])
        #print("으아아악 : ", p2_y_act[((z + 1) * M) - 1][1], p2_y_prd[((z + 1) * M) - 1][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))
    p2_q2_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p2_y_act[i][1], p2_y_prd[i][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run

    # p1_VM_Output : lambda_pls 반영 10 runs act결과 반영 vm
    # p1_ACT_Output : lambda_pls 반영 10 runs act결과 반영
    # p1_ez_run : prd - act (실제)
    # p1_y_act : lambda_pls 반영 안한 act
    # p1_y_prd : lambda_pls 반영 안하고 10 runs act결과 반영하지 않은 예측 값

    p1_VM_Output, p1_ACT_Output, p1_ez_run, p1_y_act, p1_y_prd, p1_ez_all_run = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(0, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in range(Z_VM * M):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))

    fdh_graph.plt_show1(Z_VM * M, p1_y_act[:, 0:1], p1_y_prd[:, 0:1],
                        'Process-1 Normal Case', '1')
    fdh_graph.plt_show2(Z_VM, p1_ez_run[:, 0:1], p1_ez_run[:, 1:2],
                        'Process-1 Normal Case')

    # np.savetxt("output/p1_VM_Output.csv", p1_VM_Output, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_ACT_Output.csv", p1_ACT_Output, delimiter=",", fmt="%.4f")
    np.savetxt("output/p1_ez_all_run_q1.csv",
               p1_ez_all_run,
               delimiter=",",
               fmt="%.4f")

    fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd,
                                   p1_y_act, SEED2)
    fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M,
                       f=p1_y_act)  #DoE Run ACT값으로 가능
    p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd, p2_ez_all_run = fwc_p2_act.VM_Run(
        lamda_PLS=v2_PLS, Z=Z_VM, M=M)

    p2_q2_mape_Queue = []
    for z in range(Z_VM):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p2_y_act[((z + 1) * M) - 1][1],
            p2_y_prd[((z + 1) * M) - 1][1])
        p2_q2_mape_Queue.append(mape)
    print('Process-2 q2 Every Metrology MAPE : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))

    p2_q2_mape_Queue = []

    for i in range(Z_VM * M):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p2_y_act[i][1], p2_y_prd[i][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 All MAPE : {0:.2f}%'.format(np.mean(p2_q2_mape_Queue)))

    # for i in np.arange(22 * M, 34 * M, 1):
    #     mape = fdh_graph.mean_absolute_percentage_error(i + 1, p2_y_act[i][1], p2_y_prd[i][1])
    #     p2_mape_Queue.append(mape)

    fdh_graph.plt_show1(Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2],
                        'Process-2 Normal Case', '2')
    fdh_graph.plt_show2(Z_VM, p2_ez_run[:, 0:1], p2_ez_run[:, 1:2],
                        'Process-2 Normal Case')

    # np.savetxt("output/p2_VM_Output.csv", p1_VM_Output, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p2_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p2_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p2_ACT_Output.csv", p1_ACT_Output, delimiter=",", fmt="%.4f")
    np.savetxt("output/p2_ez_all_run_q2.csv",
               p2_ez_all_run,
               delimiter=",",
               fmt="%.4f")
def main():
    fdh_graph = FDC_Graph()
    normal_p2_ez_all_run_q2 = np.loadtxt('output/p2_ez_all_run_q2.csv',
                                         delimiter=",",
                                         dtype=np.float32)
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd, _ = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_노이즈시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Error_VMresult, Error_ACTResult, ez_run, p1_y_act, p1_y_prd, _ = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    # fdh_graph.plt_show1(Z_VM * M, p1_y_act[:, 0:1], p1_y_prd[:, 0:1])
    # fdh_graph.plt_show2(Z_VM, ez_run[:, 0:1], ez_run[:, 1:2])

    # np.savetxt("output/Error_VMresult2.csv", Error_VMresult, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_ACTResult2.csv", Error_ACTResult, delimiter=",", fmt="%.4f")

    # for z in np.arange(21, 32, 1):
    #     for k in np.arange(z * M, (z + 1) * M):
    #         Error_VMresult[k] = Error_VMresult[((z + 1) * M) - 1]

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    p1_q1_mape_Queue = []

    for z in np.arange(0, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    # np.savetxt("output/p1_mape.csv", p1_q1_mape_Queue, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_VMresult1.csv", Error_VMresult, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_ACTResult.csv", Error_ACTResult, delimiter=",", fmt="%.4f")

    for z in np.arange(Nz_RUN, Z_VM, 1):
        if p1_q1_mape_Queue[z] >= Upstream_Rule_MAPE:
            x1 = p1_y_act[(z * M) - 1]
            x2 = p1_y_act[((z + 1) * M) - 1]
            s = (x2 - x1) / M
            for k in np.arange(z * M, (z + 1) * M - 1, 1):
                i = k % (z * M) + 1
                p1_y_prd[k] = x1 + s * i
                #print('test : ', x1, x2, p1_y_prd[k])
                #Error_VMresult[k] = Error_VMresult[((z + 1) * M) - 1]

    # for z in np.arange(15, 40, 1):
    #     if p1_mape_Queue[z] >= 10:
    #         for k in np.arange(z * M, (z + 1) * M - 1):
    #             Error_VMresult[k] = Error_VMresult[((z + 1) * M) - 1]

    np.savetxt("output/Error_VMresult_OK.csv",
               p1_y_prd,
               delimiter=",",
               fmt="%.4f")

    fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd,
                                   p1_y_act, SEED2)
    fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M,
                       f=o_y_act)  # DoE Run ACT값으로 가능
    p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd, reactive_p2_ez_all_run_q2 = fwc_p2_act.VM_Run(
        lamda_PLS=v2_PLS, Z=Z_VM, M=M)

    np.savetxt("output/reactive_p2_ez_all_run_q2.csv",
               reactive_p2_ez_all_run_q2,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/after_normal_p2_ez_all_run_q2.csv",
               normal_p2_ez_all_run_q2,
               delimiter=",",
               fmt="%.4f")

    fdh_graph.plt_show1(Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2],
                        'Reactive Process-2 Event Processing Case', '2')
    fdh_graph.plt_show2_2(Z_VM * M,
                          normal_p2_ez_all_run_q2[:, 1:2],
                          reactive_p2_ez_all_run_q2[:, 1:2],
                          'Reactive Process-2 Event Processing Case',
                          '2',
                          color1='bx-',
                          color2='rx--')
    #fdh_graph.plt_show2(Z_VM, p2_ez_run[:, 0:1], p2_ez_run[:, 1:2])

    p2_q2_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p2_y_act[i][1], p2_y_prd[i][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p2_y_act[((z + 1) * M) - 1][1],
            p2_y_prd[((z + 1) * M) - 1][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))
    p2_q2_mape_Queue = []

    np.savetxt("output/p2_mape.csv",
               p2_q2_mape_Queue,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/p2_ACT_Output.csv",
               Error_VMresult,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/p1_y_prd.csv", p2_y_prd, delimiter=",", fmt="%.4f")
    np.savetxt("output/p1_y_act.csv", p2_y_act, delimiter=",", fmt="%.4f")
    np.savetxt("output/p2_ACT_Output.csv",
               Error_ACTResult,
               delimiter=",",
               fmt="%.4f")
示例#14
0
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_DynamicSampling_노이즈시뮬레이터(A_p1, d_p1, C_p1, dM,
                                                     dStart, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  # DoE Run
    VM_Output, ACT_Output, ez_run, p1_y_act, p1_y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=RUNS_CNT, M=M)

    fdh_graph.plt_show1(Z_VM * M, p1_y_act[:, 0:1], p1_y_prd[:, 0:1])
    ez_run_out = []
    runM = M

    ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, RUNS_CNT + 1):
        if z == dStart:
            runM = dM
        for k in np.arange(z * runM, (z + 1) * runM):
            ez_run_out.append(ez_run[z])
    ez_run_out = np.array(ez_run_out)

    fdh_graph.plt_show5(ez_run_out, N, M, dM, S1, Noise=True)

    np.savetxt("output/Error_VMresult2.csv",
               VM_Output,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/Error_ACTResult2.csv",
               ACT_Output,
               delimiter=",",
               fmt="%.4f")

    # for z in np.arange(21, 32, 1):
    #     for k in np.arange(z * M, (z + 1) * M):
    #         Error_VMresult[k] = Error_VMresult[((z + 1) * M) - 1]

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    p1_q1_mape_Queue = []

    for z in np.arange(0, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    np.savetxt("output/p1_mape.csv",
               p1_q1_mape_Queue,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/Error_VMresult1.csv",
               VM_Output,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    np.savetxt("output/Error_ACTResult.csv",
               ACT_Output,
               delimiter=",",
               fmt="%.4f")

    for z in np.arange(Nz_RUN, Z_VM, 1):
        if p1_q1_mape_Queue[z] >= Upstream_Rule_MAPE:
            x1 = p1_y_act[(z * M) - 1]
            x2 = p1_y_act[((z + 1) * M) - 1]
            s = (x2 - x1) / M
            act_q1 = np.abs(x2[0] - x1[0])
            act_q2 = np.abs(x2[1] - x1[1])
            if act_q1 <= 4 or act_q2 <= 4:
                for k in np.arange(z * M, (z + 1) * M - 1, 1):
                    i = k % (z * M) + 1
                    #p1_y_prd[k] = x1 + s * i
                    p1_y_prd[k] = x2
                    #print('test : ', x1, x2, p1_y_prd[k])
                    #Error_VMresult[k] = Error_VMresult[((z + 1) * M) - 1]

    # for z in np.arange(15, 40, 1):
    #     if p1_mape_Queue[z] >= 10:
    #         for k in np.arange(z * M, (z + 1) * M - 1):
    #             Error_VMresult[k] = Error_VMresult[((z + 1) * M) - 1]

    np.savetxt("output/Error_VMresult_OK.csv",
               p1_y_prd,
               delimiter=",",
               fmt="%.4f")

    fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd,
                                   p1_y_act, SEED2)
    fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M,
                       f=o_y_act)  # DoE Run ACT값으로 가능
    p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd = fwc_p2_act.VM_Run(
        lamda_PLS=v2_PLS, Z=Z_VM, M=M)

    fdh_graph.plt_show1(Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2])
    fdh_graph.plt_show2(Z_VM, p2_ez_run[:, 0:1], p2_ez_run[:, 1:2], Noise=True)

    p2_q2_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p2_y_act[i][1], p2_y_prd[i][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p2_y_act[((z + 1) * M) - 1][1],
            p2_y_prd[((z + 1) * M) - 1][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))
    p2_q2_mape_Queue = []
def main():
    fdh_graph = FDC_Graph()
    noise_ez_run = np.loadtxt('output/noise_ez_run.csv',
                              delimiter=",",
                              dtype=np.float32)

    fwc_p1_vm = VM_Process1_DynamicSampling_노이즈시뮬레이터(A_p1, d_p1, C_p1, dM,
                                                     dStart, SEED)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  #DoE Run
    VM_Output, ACT_Output, ez_run, y_act, y_prd, abnormal_p1_ez_all_run_q1 = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=RUNS_CNT, M=M)

    # np.savetxt("output/VM_Output.csv", VM_Output, delimiter=",", fmt="%.4f")
    # np.savetxt("output/ACT_Output.csv", ACT_Output, delimiter=",", fmt="%.4f")
    # np.savetxt("output/ez_run.csv", ez_run, delimiter=",", fmt="%.4f")
    # np.savetxt("output/y_act.csv", y_act, delimiter=",", fmt="%.4f")
    # np.savetxt("output/y_prd.csv", y_prd, delimiter=",", fmt="%.4f")

    fdh_graph.plt_show1(
        N, y_act[:, 0:1], y_prd[:, 0:1], 'Process-1 Dynamic Sampling Case (' +
        str(RUNS_CNT) + ' Metrology Runs)', '1')
    #fdh_graph.plt_show2(RUNS_CNT, ez_run[:, 0:1], ez_run[:, 1:2], Noise=True)

    ds_ez_run_out = []
    noise_ez_run_out = []
    runM = M

    noise_ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, old_N + 1):
        for k in np.arange(z * M, (z + 1) * M):
            noise_ez_run_out.append(noise_ez_run[z])
    noise_ez_run_out = np.array(noise_ez_run_out)

    ds_ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, RUNS_CNT + 1):
        if z == dStart:
            runM = dM
        for k in np.arange(z * runM, (z + 1) * runM):
            ds_ez_run_out.append(ez_run[z])
    ez_run_out = np.array(ds_ez_run_out)

    #np.savetxt("output/ez_run2.csv", ez_run_out, delimiter=",", fmt="%.4f")
    #fdh_graph.plt_show5_1(noise_ez_run_out, ez_run_out, N, M, dM, S1, type=1)  #60 Metrology Runs
    fdh_graph.plt_show5_1(noise_ez_run_out, ez_run_out, N, M, dM, S1,
                          type=2)  # 100 Metrology Runs

    # p1_q1_mape_Queue = []

    # #metrology 마다 보여주는 MAPE 값이 의미가 없다. ==> 로직 고쳐야 함.. 40 runs가 아니라 60 Runs, 80 Runs 변경 계산 필요
    # for z in np.arange(Nz_RUN, old_N, 1):
    #     mape = fdh_graph.mean_absolute_percentage_error(z + 1, y_act[((z + 1) * M) - 1][0], y_prd[((z + 1) * M) - 1][0])
    #     p1_q1_mape_Queue.append(mape)
    #
    # print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))

    p1_q1_mape_Queue = []

    for i in np.arange(S1 * M, N, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, y_act[i][0], y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 20 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
示例#16
0
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_노이즈시뮬레이터(A_p1, d_p1, C_p1, SEED)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Error_VMresult, Error_ACTResult, ez_run, p1_y_act, p1_y_prd = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    # fdh_graph.plt_show1(Z_VM * M, p1_y_act[:, 0:1], p1_y_prd[:, 0:1])
    # fdh_graph.plt_show2(Z_VM, ez_run[:, 0:1], ez_run[:, 1:2])

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    np.savetxt("output/p1_mape.csv",
               p1_q1_mape_Queue,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/Error_VMresult1.csv",
               Error_VMresult,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    np.savetxt("output/Error_ACTResult.csv",
               Error_ACTResult,
               delimiter=",",
               fmt="%.4f")

    fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd,
                                   p1_y_act, SEED)
    fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M,
                       f=o_y_act)  # DoE Run ACT값으로 가능
    p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd = fwc_p2_act.VM_Run(
        lamda_PLS=v2_PLS, Z=Z_VM, M=M)

    fdh_graph.plt_show1(Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2])
    fdh_graph.plt_show2(Z_VM, p2_ez_run[:, 0:1], p2_ez_run[:, 1:2])

    p2_q2_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p2_y_act[((z + 1) * M) - 1][1],
            p2_y_prd[((z + 1) * M) - 1][1])
        #print("으아아악 : ", p2_y_act[((z + 1) * M) - 1][1], p2_y_prd[((z + 1) * M) - 1][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))
    p2_q2_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p2_y_act[i][1], p2_y_prd[i][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))

    np.savetxt("output/p2_mape.csv",
               p2_q2_mape_Queue,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/p2_ACT_Output.csv",
               Error_VMresult,
               delimiter=",",
               fmt="%.4f")
    np.savetxt("output/p1_y_prd.csv", p2_y_prd, delimiter=",", fmt="%.4f")
    np.savetxt("output/p1_y_act.csv", p2_y_act, delimiter=",", fmt="%.4f")
    np.savetxt("output/p2_ACT_Output.csv",
               Error_ACTResult,
               delimiter=",",
               fmt="%.4f")
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd, _ = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_노이즈시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Error_VMresult, Error_ACTResult, ez_run, p1_y_act, p1_y_prd, _ = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    # fdh_graph.plt_show1(Z_VM * M, p1_y_act[:, 0:1], p1_y_prd[:, 0:1])
    # fdh_graph.plt_show2(Z_VM, ez_run[:, 0:1], ez_run[:, 1:2])

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))
    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    p1_q1_mape_Queue = []

    for z in np.arange(0, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    for z in np.arange(Nz_RUN, Z_VM, 1):
        if p1_q1_mape_Queue[z] >= Upstream_Rule_MAPE:
            x1 = p1_y_act[(z * M) - 1]
            x2 = p1_y_act[((z + 1) * M) - 1]
            s = (x2 - x1) / M
            for k in np.arange(z * M, (z + 1) * M - 1, 1):
                i = k % (z * M) + 1
                p1_y_prd[k] = x1 + s * i

    # np.savetxt("output/p1_mape.csv", p1_q1_mape_Queue, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_VMresult1.csv", Error_VMresult, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_ACTResult.csv", Error_ACTResult, delimiter=",", fmt="%.4f")

    max_mape = 0
    min_mape = 1000000000000
    t = 0
    for m in range(1000):
        SEED2 = t + m
        fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS,
                                       p1_y_prd, p1_y_act, SEED2)
        fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M,
                           f=o_y_act)  # DoE Run ACT값으로 가능
        p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd, _ = fwc_p2_act.VM_Run(
            lamda_PLS=v2_PLS, Z=Z_VM, M=M)

        p2_q2_mape_Queue = []

        for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
            mape = fdh_graph.mean_absolute_percentage_error(
                i + 1, p2_y_act[i][1], p2_y_prd[i][1])
            p2_q2_mape_Queue.append(mape)

        mape = np.mean(p2_q2_mape_Queue)

        print('SEED2 : ', SEED2,
              'Process-2 q2 All MAPE After 15 Lot : {0:.2f}%'.format(mape))

        if mape > max_mape:
            max_mape = mape
            seed_right = SEED2
            print('SEED2 : ', SEED2, ' , max_mape = ', max_mape)
        if mape < min_mape:
            min_mape = mape
            seed_right1 = SEED2
            print('SEED2 : ', SEED2, ' , min_mape = ', min_mape)

    print('seed_right : ', seed_right, ' , max_mape = ', max_mape)
    print('seed_right1 : ', seed_right1, ' , min_mape = ', min_mape)
示例#18
0
def main():
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd = fwc_p1_vm.VM_Run(lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_노이즈시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Error_VMresult, Error_ACTResult, ez_run, p1_y_act, p1_y_prd = fwc_p1_vm.VM_Run(lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    np.savetxt("output/ez_run.csv", ez_run, delimiter=",", fmt="%.4f")

    # fdh_graph.plt_show1(Z_VM * M, p1_y_act[:, 0:1], p1_y_prd[:, 0:1])
    # fdh_graph.plt_show2(Z_VM, ez_run[:, 0:1], ez_run[:, 1:2], Noise=True)

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN_1, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(z + 1, p1_y_act[((z + 1) * M) - 1][0], p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))

    np.savetxt("output/p1_mape.csv", p1_q1_mape_Queue, delimiter=",", fmt="%.4f")
    np.savetxt("output/Error_VMresult1.csv", Error_VMresult, delimiter=",", fmt="%.4f")
    np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    np.savetxt("output/Error_ACTResult.csv", Error_ACTResult, delimiter=",", fmt="%.4f")

    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN_1 * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    #print('Process-1 q1 All MAPE After 20 Lot : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))
    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(np.mean(p1_q1_mape_Queue)))




    # fdh_graph.plt_show1(Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2])
    # fdh_graph.plt_show2(Z_VM, p2_ez_run[:, 0:1], p2_ez_run[:, 1:2], Noise=False)

    max_mape = 0
    t = 0
    for m in range(1000):
        SEED2 = t + m
        fwc_p2_act = VM_Process2_노이즈시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd, p1_y_act, SEED2)
        fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M, f=o_y_act)  # DoE Run ACT값으로 가능
        p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd = fwc_p2_act.VM_Run(lamda_PLS=v2_PLS, Z=Z_VM, M=M)

        p2_q2_mape_Queue = []

        for i in np.arange(Nz_RUN_2 * M, Z_VM * M, 1):
            mape = fdh_graph.mean_absolute_percentage_error(i + 1, p2_y_act[i][1], p2_y_prd[i][1])
            p2_q2_mape_Queue.append(mape)

        mape = np.mean(p2_q2_mape_Queue)

        print('Process-2 q2 All MAPE After 20 Lot : {0:.2f}%'.format(mape))

        if mape > max_mape:
            max_mape = mape
            seed_right = SEED2
            print('SEED2 : ', SEED2, ' , max_mape = ', max_mape)

    print('seed_right : ', seed_right, ' , max_mape = ', max_mape)
def main():
    noise_ez_run = np.loadtxt('output/noise_ez_run.csv',
                              delimiter=",",
                              dtype=np.float32)
    reactive_p2_ez_all_run_q2 = np.loadtxt(
        'D:/10. 대학원/04. Source/09. VM_Source/04. VMOnly/output/reactive_p2_ez_all_run_q2.csv',
        delimiter=",",
        dtype=np.float32)
    after_normal_p2_ez_all_run_q2 = np.loadtxt(
        'D:/10. 대학원/04. Source/09. VM_Source/04. VMOnly/output/after_normal_p2_ez_all_run_q2.csv',
        delimiter=",",
        dtype=np.float32)
    fdh_graph = FDC_Graph()
    fwc_p1_vm = VM_Process1_시뮬레이터(A_p1, d_p1, C_p1, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v1_PLS, Z=Z_DoE, M=M)  # DoE Run
    Normal_VMResult, Normal_ACTResult, ez_run, o_y_act, o_y_prd, _ = fwc_p1_vm.VM_Run(
        lamda_PLS=v1_PLS, Z=Z_VM, M=M)

    fwc_p1_vm = VM_Process1_DynamicSampling_노이즈시뮬레이터(A_p1, d_p1, C_p1, dM,
                                                     dStart, SEED1)
    fwc_p1_vm.DoE_Run(lamda_PLS=v_PLS, Z=Z_DoE, M=M)  # DoE Run
    VM_Output, ACT_Output, ez_run, p1_y_act, p1_y_prd, p1_ez_all_run_q1 = fwc_p1_vm.VM_Run(
        lamda_PLS=v_PLS, Z=RUNS_CNT, M=M)

    #fdh_graph.plt_show1(Z_VM * M, p1_y_act[:, 0:1], p1_y_prd[:, 0:1])
    ez_run_out = []
    noise_ez_run_out = []
    runM = M

    noise_ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, old_N + 1):
        for k in np.arange(z * M, (z + 1) * M):
            noise_ez_run_out.append(noise_ez_run[z])
    noise_ez_run_out = np.array(noise_ez_run_out)

    ez_run_out.append(np.array([0, 0]))
    for z in np.arange(1, RUNS_CNT + 1):
        if z == dStart:
            runM = dM
        for k in np.arange(z * runM, (z + 1) * runM):
            ez_run_out.append(ez_run[z])
    ez_run_out = np.array(ez_run_out)

    #fdh_graph.plt_show5(ez_run_out, N, M, dM, S1, Noise=True)
    ##fdh_graph.plt_show5_1(noise_ez_run_out, ez_run_out, N, M, dM, S1, type=1)

    # np.savetxt("output/Error_VMresult2.csv", VM_Output, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_ACTResult2.csv", ACT_Output, delimiter=",", fmt="%.4f")

    # for z in np.arange(21, 32, 1):
    #     for k in np.arange(z * M, (z + 1) * M):
    #         Error_VMresult[k] = Error_VMresult[((z + 1) * M) - 1]

    p1_q1_mape_Queue = []

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    p1_q1_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p1_y_act[i][0], p1_y_prd[i][0])
        p1_q1_mape_Queue.append(mape)

    print('Process-1 q1 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p1_q1_mape_Queue)))

    p1_q1_mape_Queue = []

    for z in np.arange(0, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p1_y_act[((z + 1) * M) - 1][0],
            p1_y_prd[((z + 1) * M) - 1][0])
        p1_q1_mape_Queue.append(mape)

    # np.savetxt("output/p1_mape.csv", p1_q1_mape_Queue, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_VMresult1.csv", VM_Output, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_prd.csv", p1_y_prd, delimiter=",", fmt="%.4f")
    # np.savetxt("output/p1_y_act.csv", p1_y_act, delimiter=",", fmt="%.4f")
    # np.savetxt("output/Error_ACTResult.csv", ACT_Output, delimiter=",", fmt="%.4f")

    for z in np.arange(Nz_RUN, Z_VM, 1):
        if p1_q1_mape_Queue[z] >= Upstream_Rule_MAPE:
            x1 = p1_y_act[(z * M) - 1]
            x2 = p1_y_act[((z + 1) * M) - 1]
            s = (x2 - x1) / M
            # act_q1 = np.abs(x2[0] - x1[0])
            # act_q2 = np.abs(x2[1] - x1[1])
            # if act_q1 <= 4 or act_q2 <= 4:
            for k in np.arange(z * M, (z + 1) * M - 1, 1):
                i = k % (z * M) + 1
                p1_y_prd[k] = x1 + s * i
                #p1_y_prd[k] = x2
                #print('test : ', x1, x2, p1_y_prd[k])
                #Error_VMresult[k] = Error_VMresult[((z + 1) * M) - 1]

    # for z in np.arange(15, 40, 1):
    #     if p1_mape_Queue[z] >= 10:
    #         for k in np.arange(z * M, (z + 1) * M - 1):
    #             Error_VMresult[k] = Error_VMresult[((z + 1) * M) - 1]

    np.savetxt("output/Error_VMresult_OK.csv",
               p1_y_prd,
               delimiter=",",
               fmt="%.4f")

    fwc_p2_act = VM_Process2_시뮬레이터(A_p2, d_p2, C_p2, F_p2, v1_PLS, p1_y_prd,
                                   p1_y_act, SEED2)
    fwc_p2_act.DoE_Run(lamda_PLS=v2_PLS, Z=Z_DoE, M=M,
                       f=o_y_act)  # DoE Run ACT값으로 가능
    p2_VM_Output, p2_ACT_Output, p2_ez_run, p2_y_act, p2_y_prd, p2_ez_all_run_q2 = fwc_p2_act.VM_Run(
        lamda_PLS=v2_PLS, Z=Z_VM, M=M)

    #fdh_graph.plt_show1(Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2])
    #fdh_graph.plt_show2(Z_VM, p2_ez_run[:, 0:1], p2_ez_run[:, 1:2], Noise=True)
    fdh_graph.plt_show1(
        Z_VM * M, p2_y_act[:, 1:2], p2_y_prd[:, 1:2],
        'Process-2 UpStream Rule Case with Process-1 Dynamic Sampling', '2')
    fdh_graph.plt_show2_4(
        Z_VM * M,
        reactive_p2_ez_all_run_q2[:, 1:2],
        p2_ez_all_run_q2[:, 1:2],
        'Process-2 UPStream Rule X with Process-1 Dynamic Sampling',
        '2',
        color1='bx-',
        color2='rx--')

    p2_q2_mape_Queue = []

    for i in np.arange(Nz_RUN * M, Z_VM * M, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            i + 1, p2_y_act[i][1], p2_y_prd[i][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 All MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))

    # metrology 마다 보여주는 MAPE 값이 의미가 없다.
    for z in np.arange(Nz_RUN, Z_VM, 1):
        mape = fdh_graph.mean_absolute_percentage_error(
            z + 1, p2_y_act[((z + 1) * M) - 1][1],
            p2_y_prd[((z + 1) * M) - 1][1])
        p2_q2_mape_Queue.append(mape)

    print('Process-2 q2 Every Metrology MAPE After 15 Lot : {0:.2f}%'.format(
        np.mean(p2_q2_mape_Queue)))
    p2_q2_mape_Queue = []