Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the smooth curve in Fig.5 #4

Closed
nuomizai opened this issue May 7, 2022 · 1 comment
Closed

How to get the smooth curve in Fig.5 #4

nuomizai opened this issue May 7, 2022 · 1 comment

Comments

@nuomizai
Copy link

nuomizai commented May 7, 2022

Hi, I'm very interested in NPPAC and I'd like to take it as a comparison method. However, I got stuck in the evaluation metric. How to get the smooth curve as that in Fig. 5? I can only get a unsmooth curve with rllab.
image

@conglu1997
Copy link
Owner

def sliding_mean(data_array, window=5):
    data_array = np.array(data_array)
    new_list = []
    for i in range(len(data_array)):
        indices = list(range(max(i - window + 1, 0),
                             min(i + window + 1, len(data_array))))
        avg = 0
        for j in indices:
            avg += data_array[j]
        avg /= float(len(indices))
        new_list.append(avg)

    return np.array(new_list)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants